Skip to content

Commit d4176ca

Browse files
authored
Switch automated tests to Github Actions (#5111)
1 parent 726d0d8 commit d4176ca

File tree

5 files changed

+154
-35
lines changed

5 files changed

+154
-35
lines changed

.github/workflows/merge.yaml

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Merge to release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
inputs:
9+
commit_message:
10+
description: Commit message
11+
required: true
12+
13+
jobs:
14+
release:
15+
runs-on: ubuntu-latest
16+
env:
17+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
18+
steps:
19+
- uses: actions/checkout@v2
20+
if: github.event_name == 'push'
21+
- uses: actions/checkout@v2
22+
if: github.event_name == 'workflow_dispatch'
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Checkout release branch
27+
uses: actions/checkout@v2
28+
with:
29+
ref: 'v1.0.1'
30+
path: './release'
31+
32+
- name: Check for relevant changes
33+
if: github.event_name == 'push'
34+
uses: dorny/paths-filter@v2
35+
id: release
36+
with:
37+
list-files: shell
38+
filters: |
39+
updated:
40+
- added|modified: [ '*.csl', '*.xml' ]
41+
deleted:
42+
- deleted: [ '*.csl', '*.xml' ]
43+
44+
- name: Changed files
45+
if: github.event_name == 'push'
46+
run: |
47+
echo updated: ${{ steps.release.outputs.updated_files }}
48+
echo deleted: ${{ steps.release.outputs.deleted_files }}
49+
50+
- name: Set up Ruby
51+
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (steps.release.outputs.updated == 'true' || steps.release.outputs.deleted == 'true'))
52+
uses: ruby/setup-ruby@v1
53+
with:
54+
ruby-version: 2.7.1
55+
- name: but use cache to speed that up
56+
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (steps.release.outputs.updated == 'true' || steps.release.outputs.deleted == 'true'))
57+
uses: actions/cache@v2
58+
with:
59+
path: vendor/bundle
60+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
61+
restore-keys: |
62+
${{ runner.os }}-gems-
63+
- name: Bundle install
64+
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (steps.release.outputs.updated == 'true' || steps.release.outputs.deleted == 'true'))
65+
run: |
66+
bundle config path vendor/bundle
67+
bundle update sheldon --jobs 4 --retry 3
68+
69+
- name: Populate new branch
70+
run: bundle exec sheldon --token=$GITHUB_TOKEN --verbose --populate release
71+
if: github.event_name == 'workflow_dispatch'
72+
73+
- name: update the timestamps and add the changes
74+
run: bundle exec sheldon --token=$GITHUB_TOKEN --verbose --release release ${{ steps.release.outputs.updated_files }}
75+
if: github.event_name == 'push' && steps.release.outputs.updated == 'true'
76+
77+
- name: delete deleted files
78+
run: cd release && git rm ${{ steps.release.outputs.deleted_files }}
79+
if: github.event_name == 'push' && steps.release.outputs.deleted == 'true'
80+
81+
- uses: stefanzweifel/git-auto-commit-action@v4
82+
with:
83+
repository: 'release'
84+
commit_message: Releasing ${{ steps.release.outputs.updated_files }} ${{ steps.release.outputs.deleted_files }}
85+
if: github.event_name == 'push' && (steps.release.outputs.updated == 'true' || steps.release.outputs.deleted == 'true')
86+
87+
- uses: stefanzweifel/git-auto-commit-action@v4
88+
with:
89+
repository: 'release'
90+
commit_message: ${{ github.event.inputs.commit_message }}
91+
if: github.event_name == 'workflow_dispatch'

.github/workflows/sheldon.yaml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Pull request feedback
2+
3+
on:
4+
pull_request_target:
5+
types: [ opened, synchronize ]
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
env:
11+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- name: Check for relevant changes
16+
uses: dorny/paths-filter@v2
17+
id: sheldon
18+
with:
19+
list-files: shell
20+
filters: |
21+
changed:
22+
- '*.csl'
23+
24+
- name: Changed files
25+
run: |
26+
echo changed: ${{ steps.sheldon.outputs.changed_files }}
27+
28+
- name: Set up Ruby
29+
if: steps.sheldon.outputs.changed == 'true'
30+
uses: ruby/setup-ruby@v1
31+
with:
32+
ruby-version: 2.7.1
33+
- name: but use cache to speed that up
34+
if: steps.sheldon.outputs.changed == 'true'
35+
uses: actions/cache@v2
36+
with:
37+
path: vendor/bundle
38+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
39+
restore-keys: |
40+
${{ runner.os }}-gems-
41+
- name: Bundle install
42+
if: steps.sheldon.outputs.changed == 'true'
43+
run: |
44+
bundle config path vendor/bundle
45+
bundle update sheldon --jobs 4 --retry 3
46+
47+
- name: Apply the PR
48+
if: steps.sheldon.outputs.changed == 'true'
49+
run: bundle exec sheldon --token=$GITHUB_TOKEN --apply
50+
51+
- name: Welcome to a new PR
52+
if: github.event.action == 'opened' && steps.sheldon.outputs.changed == 'true'
53+
run: bundle exec sheldon --token=$GITHUB_TOKEN --welcome
54+
55+
- name: See if the styles work
56+
if: steps.sheldon.outputs.changed == 'true'
57+
run: bundle exec rake
58+
59+
- name: report
60+
if: (failure() || success()) && steps.sheldon.outputs.changed == 'true'
61+
run: bundle exec sheldon --token=$GITHUB_TOKEN --report --verbose

.travis.yml

-23
This file was deleted.

Gemfile.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
GIT
22
remote: https://github.com/citation-style-language/Sheldon.git
3-
revision: 7822dbda11e229cbd933f84a3a1cfdbe8e75dfaf
3+
revision: 1962fad73610a3e0b1610e0c24c16669d584196b
44
specs:
55
sheldon (1.0.2)
66
citeproc-ruby

Rakefile

+1-11
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,10 @@ rescue Bundler::BundlerError => e
77
exit e.status_code
88
end
99

10-
if ENV['TRAVIS']
11-
at_exit do
12-
system('bundle exec sheldon')
13-
end
14-
end
15-
1610
require 'rspec/core'
1711
require 'rspec/core/rake_task'
1812
RSpec::Core::RakeTask.new(:spec) do |spec|
19-
if ENV['TRAVIS']
20-
spec.rspec_opts = %w{ --require spec_helper.rb --format Fuubar --color --format json --out spec/sheldon/travis.json }
21-
else
22-
spec.rspec_opts = %w{ --require spec_helper.rb --format Fuubar --color --format json --out spec/sheldon/travis.json }
23-
end
13+
spec.rspec_opts = %w{ --require spec_helper.rb --format Fuubar --color --format json --out spec/sheldon/ci.json }
2414
end
2515

2616
task :default => [:spec]

0 commit comments

Comments
 (0)