Replace Travis CI with GitHub Actions#975
Replace Travis CI with GitHub Actions#975coriolinus merged 17 commits intoexercism:masterfrom dgunay:master
Conversation
|
One thing I don't see in this PR is a replication of the stable/beta/nightly and environment matrix. For example, on Travis, both stable and beta channels run both with and without |
Co-authored-by: Sascha Mann <git@mail.saschamann.eu>
|
@coriolinus You're right, I did not replicate that. I'll try and implement that. |
|
Another thing I just noticed: in several places in rust/_test/check-exercise-crate.sh Line 7 in a268661 That will have to be dealt with one way or another. At the most basic level, we can re-write the scripts to use a different mechanism to detect whether they're running in a pull request, or we can inject that environment variable if the action was triggered by a pull request, as opposed to just checking the most recent commit of the |
|
Interesting. I'm having a hard time replicating that error--I don't know what git version they're using, but it appears to be different than mine--but I think we can at least improve error propagation by injecting set -e -o pipefailinto the affected scripts near the top. |
|
Also, the error seems to imply that |
|
I believe this might be what's happening: https://github.bokerqi.topmunity/t/git-ambiguous-argument-master/17832/2 I think changing the script to refer to |
|
This makes the jobs fail at least, but changing to |
|
Added another step to each job to checkout the master branch locally - turns out that wasn't happening when I had a look with |
Various commits to a branch in the fork, squashed to avoid spamming the PR: * test1 * test2 * try putting entire expression in curly braces * big commit * delete comment * delete continue on error * delete not linting lines * Update tests.yml * comment out compilation job * add temp branch * uncomment compilation job * try using deny warnings * forgot what i did * fix nightly toolchain * try toolchain again * try toolchain again * try toolchain again * add travis env var * try changing master to origin/master to make actions not fail * add set -e -o pipefail to script * fail fast during CI for pull requests * add check PR files * look at git branch -a * try to check out master first * see if remotes origin master works * fix master branch path * checkout master for configlet job * fix master ref in ensure readmes updated * check out master for nightly
|
As far as I am aware, the remaining things left to fix:
|
|
I haven't experimented with this, but in the docs, I see the following snippet: env:
my_env_var: ${{ <expression> }}This is tempting, but apparently wrong, because github actions syntax does not support inline conditional expressions. Instead, we should keep looking. For example:
Follow through with the pull request object docs, the commands docs, and a bit of bash variable expansion magic and it looks like what we need is something like this: steps:
- name: set TRAVIS_PULL_REQUEST
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
run: echo "TRAVIS_PULL_REQUEST=${PR_NUMBER:-false}" >> $GITHUB_ENVDid the suggestion here fail? If yes, how? |
commit 5790f28ef86d72c9bcc57344d6f5064d101c45f0
Author: Devin gunay <devingunay@gmail.com>
Date: Thu Oct 8 21:45:55 2020 -0700
probably working gh actions configuration
commit 4c07754
Author: Devin gunay <devingunay@gmail.com>
Date: Thu Oct 8 21:43:21 2020 -0700
test if whole job fails
commit 666653b
Author: Devin gunay <devingunay@gmail.com>
Date: Thu Oct 8 21:38:50 2020 -0700
test failure on CI w denywarnings
commit 641db7e
Author: Devin gunay <devingunay@gmail.com>
Date: Thu Oct 8 21:25:41 2020 -0700
edit script to check cont on error
commit 85801de
Author: Devin gunay <devingunay@gmail.com>
Date: Thu Oct 8 21:18:18 2020 -0700
fix toolchain and try continue on error
commit 1c2e590
Author: Devin gunay <devingunay@gmail.com>
Date: Thu Oct 8 21:08:11 2020 -0700
remove travis pr echo
commit 4a623fc
Author: Devin gunay <devingunay@gmail.com>
Date: Thu Oct 8 21:03:11 2020 -0700
print pr var
commit c79f0c1
Author: Devin gunay <devingunay@gmail.com>
Date: Thu Oct 8 21:01:06 2020 -0700
try travis pr again
commit 21ddc40
Author: Devin gunay <devingunay@gmail.com>
Date: Thu Oct 8 20:55:52 2020 -0700
set travis pr var conditionally
commit 3a580b6
Author: Devin Gunay <devingunay@gmail.com>
Date: Wed Oct 7 17:05:25 2020 -0700
check out master for nightly
commit 67bb71d
Author: Devin Gunay <devingunay@gmail.com>
Date: Wed Oct 7 17:02:51 2020 -0700
fix master ref in ensure readmes updated
commit 05c6951
Author: Devin Gunay <devingunay@gmail.com>
Date: Wed Oct 7 17:00:44 2020 -0700
checkout master for configlet job
commit 9e31662
Author: Devin Gunay <devingunay@gmail.com>
Date: Wed Oct 7 16:58:55 2020 -0700
fix master branch path
commit 749a92c
Author: Devin Gunay <devingunay@gmail.com>
Date: Wed Oct 7 16:55:21 2020 -0700
see if remotes origin master works
commit 33a0704
Author: Devin Gunay <devingunay@gmail.com>
Date: Wed Oct 7 16:54:21 2020 -0700
try to check out master first
commit 8739869
Author: Devin Gunay <devingunay@gmail.com>
Date: Wed Oct 7 16:51:03 2020 -0700
look at git branch -a
commit 96001e2
Author: Devin Gunay <devingunay@gmail.com>
Date: Wed Oct 7 16:46:16 2020 -0700
add check PR files
commit 2be04c5
Author: Devin Gunay <devingunay@gmail.com>
Date: Wed Oct 7 16:38:02 2020 -0700
fail fast during CI for pull requests
commit 02101b2
Author: Devin Gunay <devingunay@gmail.com>
Date: Wed Oct 7 16:36:08 2020 -0700
add set -e -o pipefail to script
commit c5e255a
Author: Devin Gunay <devingunay@gmail.com>
Date: Wed Oct 7 16:27:02 2020 -0700
try changing master to origin/master to make actions not fail
commit 3b4395a
Author: Devin Gunay <devingunay@gmail.com>
Date: Wed Oct 7 00:47:17 2020 -0700
add travis env var
commit 497d3a3
Author: Devin Gunay <devingunay@gmail.com>
Date: Wed Oct 7 00:26:24 2020 -0700
try toolchain again
commit 359269f
Author: Devin Gunay <devingunay@gmail.com>
Date: Wed Oct 7 00:25:37 2020 -0700
try toolchain again
commit 04df9cb
Author: Devin Gunay <devingunay@gmail.com>
Date: Wed Oct 7 00:24:41 2020 -0700
try toolchain again
commit 42b6e16
Author: Devin Gunay <devingunay@gmail.com>
Date: Wed Oct 7 00:18:00 2020 -0700
fix nightly toolchain
commit 2c7354d
Author: Devin Gunay <devingunay@gmail.com>
Date: Wed Oct 7 00:17:18 2020 -0700
forgot what i did
commit 7560f0b
Author: Devin Gunay <devingunay@gmail.com>
Date: Wed Oct 7 00:09:38 2020 -0700
try using deny warnings
commit 80b6d76
Author: Devin Gunay <devingunay@gmail.com>
Date: Wed Oct 7 00:07:15 2020 -0700
uncomment compilation job
commit 5badd46
Author: Devin Gunay <devingunay@gmail.com>
Date: Wed Oct 7 00:06:24 2020 -0700
add temp branch
commit ef58cdb
Author: Devin Gunay <devingunay@gmail.com>
Date: Wed Oct 7 00:05:27 2020 -0700
comment out compilation job
commit 0ef5ed2
Author: Devin Gunay <devingunay@gmail.com>
Date: Wed Oct 7 00:04:30 2020 -0700
Update tests.yml
commit 66db311
Author: Devin Gunay <devingunay@gmail.com>
Date: Wed Oct 7 00:00:40 2020 -0700
delete not linting lines
commit 803a507
Author: Devin Gunay <devingunay@gmail.com>
Date: Tue Oct 6 23:59:38 2020 -0700
delete continue on error
commit c34c8f6
Author: Devin Gunay <devingunay@gmail.com>
Date: Tue Oct 6 23:58:33 2020 -0700
delete comment
commit dbd4e1c
Author: Devin Gunay <devingunay@gmail.com>
Date: Tue Oct 6 23:57:11 2020 -0700
big commit
commit ba883ef
Author: Devin Gunay <devingunay@gmail.com>
Date: Tue Oct 6 23:41:41 2020 -0700
try putting entire expression in curly braces
commit 524b3e7
Author: Devin Gunay <devingunay@gmail.com>
Date: Tue Oct 6 23:40:25 2020 -0700
test2
commit 96c5547
Author: Devin Gunay <devingunay@gmail.com>
Date: Tue Oct 6 23:39:37 2020 -0700
test1
|
Okay, I think I've got something that works as intended. Things addressed:
I tested it by altering the I'm not super happy about the copying and pasting but perhaps someone with more knowledge of GitHub Actions could make it more DRY. By the way, |
|
Oh, another thing - is |
|
Great! At this point, it seems that the only things remaining will be to clean up some of the comment-only edits to the test scripts, and actually test the whole thing. It is definitely possible to reduce duplication within the source file by using some YAML Anchor and Alias trickery, but I have mixed feelings about that; I've seen the technique used to produce very dense configurations which were almost impossible to understand. I don't oppose trying it out, but I'd reserve the right to ask to revert those changes. I'm sorry to be so vague about the acceptance criteria for this, but I'm finding them hard to verbalize. All I can say is that if the anchor/aliased config is readable and well-documented, I'll probably accept it; if I find it confusing, I'd ask it to be reverted. Thanks for spotting the DENYWARNINGS failure on stable!
|
|
Sorry for the lack of activity - school kind of took over my life for a bit. Do you have any recommendations for how to test it? Otherwise I guess I was just going to run it manually in these scenarios (third dimension not pictured: with and without failing code):
I do hope there's a good automated way of testing GitHub actions because it seems like a lot of work... |
|
No worries about lack of activity; this is volunteer work for all of us, and we've all got other things going on in our lives. I don't think you need to worry about pushing some code which behaves differently according to the stable/beta/nightly dimension; manual verification that those stages have been run is sufficient. Testing direct push to To my mind, what we really want to demonstrate are these cases:
As for how to demonstrate this, I think creating a PR based on this PR targeting your own fork of this repo will cause the actions to run. Create some innocuous commit in that PR to demonstrate the success case, then add / revert commits to demonstrate each of the failure cases. Once that is all done, just link to that separate PR here, and we can inspect to verify that things worked as expected. |
|
I did #983 to test that these actions work as expected; they succeeded very nicely. I'm going to do a little bit of cleanup now, then approve/merge. |
Changing the behavior of the scripts is out of scope of this PR. If we see erroneous CI in the future, we can fix things then. We therefore don't need new comment-only changes in the scripts.
coriolinus
left a comment
There was a problem hiding this comment.
Thanks for doing all this work @dgunay!
|
@coriolinus Thank you and @SaschaMann for the feedback! Glad I could help and learn a bit about GitHub Actions in the process. |
When moving off of Travis in #975, there were some instances of TRAVIS_PULL_REQUEST left over as a transitionary strategy. Now we have been hurt by leaving TRAVIS_PULL_REQUEST in: In #1006 a new GitHub Actions job was added that forgot to set TRAVIS_PULL_REQUEST and caused incorrect behaviour. So let's remove TRAVIS_PULL_REQUEST and instead change it to GITHUB_EVENT_NAME. Documentation: https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables

Addressing this issue: #974
One note: this only runs the tests on the latest Ubuntu. I saw there is a different process for running the tests on Windows - that would probably require more work to configure correctly. Let me know if anything needs to be changed.