From c788c2e05cd6a6186e5e2eeb5f215b78fee2b33f Mon Sep 17 00:00:00 2001 From: Devin gunay Date: Mon, 5 Oct 2020 23:46:10 -0700 Subject: [PATCH 01/15] First attempt at breaking out Travis CI into GitHub Actions --- .github/workflows/tests.yml | 60 +++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 000000000..ad113704d --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,60 @@ +name: Super-Linter + +# Run this workflow every time a new commit is pushed to the repository +on: push + +jobs: + super-lint: + name: Lint code base + + # TODO: not sure what the best OS to run on is so ubuntu will do for now + runs-on: ubuntu-latest + + steps: + # Checks out a copy of your repository on the ubuntu-latest machine + - name: Checkout code + uses: actions/checkout@v2 + + # Runs the Super-Linter action + # - name: Run Super-Linter + # uses: github/super-linter@v3 + # env: + # DEFAULT_BRANCH: main + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # run these as steps + - name: Check exercises + run: ./_test/check-exercises.sh + + - name: Ensure src/lib.rs files exist + run: bash ./_test/ensure-lib-src-rs-exist.sh + + - name: Ensure stubs compile + run: sh ./_test/ensure-stubs-compile.sh + + - name: Count ignores + run: sh ./_test/count-ignores.sh + + - name: Fetch configlet + run: ./bin/fetch-configlet + + - name: Check configlet format + run: ./_test/check-configlet-fmt.sh + + - name: Ensure readmes are updated + run: sh ./_test/ensure-readmes-are-updated.sh + + - name: Lint configlet + run: ./bin/configlet lint . + + - name: Check UUIDs + run: sh ./_test/check-uuids.sh + + - name: Verify exercise difficulties + run: ./_test/verify-exercise-difficulties.sh + + - name: Check exercises for authors + run: ./_test/check-exercises-for-authors.sh + + - name: Check exercise crate + run: sh ./_test/check-exercise-crate.sh \ No newline at end of file From af8dddaa29b8ccdb3e9bbb63bfdffea2f8a4bbf1 Mon Sep 17 00:00:00 2001 From: Devin gunay Date: Mon, 5 Oct 2020 23:48:05 -0700 Subject: [PATCH 02/15] Rename actions to run all tests --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ad113704d..d9dca3ea6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,10 +1,10 @@ -name: Super-Linter +name: Run all tests # Run this workflow every time a new commit is pushed to the repository on: push jobs: - super-lint: + run-all-tests: name: Lint code base # TODO: not sure what the best OS to run on is so ubuntu will do for now From a8b6d610b1a639f181228883610c05a192a6b150 Mon Sep 17 00:00:00 2001 From: Devin gunay Date: Mon, 5 Oct 2020 23:48:51 -0700 Subject: [PATCH 03/15] Rename missed name from GH actions template --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d9dca3ea6..b657933ce 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,7 +5,7 @@ on: push jobs: run-all-tests: - name: Lint code base + name: Run all tests # TODO: not sure what the best OS to run on is so ubuntu will do for now runs-on: ubuntu-latest From 91b831f025ba77b72f99ec7aba8fa9339932a40b Mon Sep 17 00:00:00 2001 From: Devin gunay Date: Mon, 5 Oct 2020 23:53:12 -0700 Subject: [PATCH 04/15] delete travis.yml --- .travis.yml | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index eb332772d..000000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ ---- -language: rust -script: -- "./_test/check-exercises.sh" -- "bash ./_test/ensure-lib-src-rs-exist.sh" -- "sh ./_test/ensure-stubs-compile.sh" -- "sh ./_test/count-ignores.sh" -- "./bin/fetch-configlet" -- "./_test/check-configlet-fmt.sh" -- "sh ./_test/ensure-readmes-are-updated.sh" -- "./bin/configlet lint ." -- "sh ./_test/check-uuids.sh" -- "./_test/verify-exercise-difficulties.sh" -- "./_test/check-exercises-for-authors.sh" -- "sh ./_test/check-exercise-crate.sh" -sudo: false -rust: - - stable - - beta -env: - - DENYWARNINGS= - - DENYWARNINGS=1 -matrix: - include: - - rust: nightly - env: BENCHMARK=1 - script: "./_test/check-exercises.sh" - allow_failures: - - rust: nightly - - rust: beta - env: DENYWARNINGS=1 From 1e1bfb016930b16522fb9551fdc6eaeb3651da24 Mon Sep 17 00:00:00 2001 From: Devin gunay Date: Mon, 5 Oct 2020 23:54:05 -0700 Subject: [PATCH 05/15] delete leftover commented out code from template --- .github/workflows/tests.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b657933ce..b4d382aa5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,13 +14,6 @@ jobs: # Checks out a copy of your repository on the ubuntu-latest machine - name: Checkout code uses: actions/checkout@v2 - - # Runs the Super-Linter action - # - name: Run Super-Linter - # uses: github/super-linter@v3 - # env: - # DEFAULT_BRANCH: main - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # run these as steps - name: Check exercises From d56eab6d8793f3d9bd66c76211df9a0bec016c31 Mon Sep 17 00:00:00 2001 From: Devin Gunay Date: Tue, 6 Oct 2020 08:43:51 -0700 Subject: [PATCH 06/15] Run tests on pushes to master and pull requests Co-authored-by: Sascha Mann --- .github/workflows/tests.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b4d382aa5..57fbcce39 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,7 +1,11 @@ name: Run all tests # Run this workflow every time a new commit is pushed to the repository -on: push +on: + push: + branches: + - master + pull_request: jobs: run-all-tests: @@ -50,4 +54,4 @@ jobs: run: ./_test/check-exercises-for-authors.sh - name: Check exercise crate - run: sh ./_test/check-exercise-crate.sh \ No newline at end of file + run: sh ./_test/check-exercise-crate.sh From 531120daa46a33052d3e5b3dbb32a5ba8889cc10 Mon Sep 17 00:00:00 2001 From: Devin gunay Date: Tue, 6 Oct 2020 10:30:37 -0700 Subject: [PATCH 07/15] first attempt at recreating build matrix --- .github/workflows/tests.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b4d382aa5..e572a0e8d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,11 +10,29 @@ jobs: # TODO: not sure what the best OS to run on is so ubuntu will do for now runs-on: ubuntu-latest + strategy: + # Allows running the build multiple times with different configurations + matrix: + rust: ["stable", "nightly", "beta"] + deny_warnings: ['', 1] + + # For nightly rust, run the check-exercises.sh script with DENYWARNINGS=1 + include: + - rust: nightly + deny_warnings: 1 + run: ./_test/check-exercises.sh DENYWARNINGS=${{ matrix.deny_warnings }} + + + # Allow failures on nightly rust, or beta if DENYWARNINGS is enabled + continue-on-error: ${{ matrix.rust == "nightly || (matrix.rust == "beta" && DENYWARNINGS == 1)}} + steps: # Checks out a copy of your repository on the ubuntu-latest machine - name: Checkout code uses: actions/checkout@v2 - + env: + DENYWARNINGS: ${{ matrix.deny_warnings }} + # run these as steps - name: Check exercises run: ./_test/check-exercises.sh From d31adde2438cd97a9039a18128e9f9cc001d306d Mon Sep 17 00:00:00 2001 From: Devin Gunay Date: Tue, 6 Oct 2020 10:34:48 -0700 Subject: [PATCH 08/15] fix missing " in workflow --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 63bebc3c0..f92968de0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,7 +28,7 @@ jobs: # Allow failures on nightly rust, or beta if DENYWARNINGS is enabled - continue-on-error: ${{ matrix.rust == "nightly || (matrix.rust == "beta" && DENYWARNINGS == 1)}} + continue-on-error: ${{ matrix.rust == "nightly" || (matrix.rust == "beta" && DENYWARNINGS == 1)}} steps: # Checks out a copy of your repository on the ubuntu-latest machine From cb706451e035f47d9def5f21c66fa53a3d0b1c20 Mon Sep 17 00:00:00 2001 From: Devin gunay Date: Tue, 6 Oct 2020 10:40:43 -0700 Subject: [PATCH 09/15] attempt to fix special-case nightly include --- .github/workflows/tests.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f92968de0..0b0ba5f1f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,15 +17,13 @@ jobs: strategy: # Allows running the build multiple times with different configurations matrix: - rust: ["stable", "nightly", "beta"] + rust: ["stable", "beta"] deny_warnings: ['', 1] # For nightly rust, run the check-exercises.sh script with DENYWARNINGS=1 include: - rust: nightly deny_warnings: 1 - run: ./_test/check-exercises.sh DENYWARNINGS=${{ matrix.deny_warnings }} - # Allow failures on nightly rust, or beta if DENYWARNINGS is enabled continue-on-error: ${{ matrix.rust == "nightly" || (matrix.rust == "beta" && DENYWARNINGS == 1)}} From 742aa5f3d9dea560f199e25f8c4a899bb6f5e394 Mon Sep 17 00:00:00 2001 From: Devin gunay Date: Tue, 6 Oct 2020 10:49:44 -0700 Subject: [PATCH 10/15] another attempt at making the file lint --- .github/workflows/tests.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0b0ba5f1f..bc3498bcb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,13 +20,14 @@ jobs: rust: ["stable", "beta"] deny_warnings: ['', 1] - # For nightly rust, run the check-exercises.sh script with DENYWARNINGS=1 + # TODO: I don't know how to make it run only the check_exercises.sh script + # For nightly rust, run the job with DENYWARNINGS=1 include: - rust: nightly deny_warnings: 1 # Allow failures on nightly rust, or beta if DENYWARNINGS is enabled - continue-on-error: ${{ matrix.rust == "nightly" || (matrix.rust == "beta" && DENYWARNINGS == 1)}} + continue-on-error: ${{ matrix.rust }} == "nightly" || ( ${{ matrix.rust }} == "beta" && DENYWARNINGS == 1 ) steps: # Checks out a copy of your repository on the ubuntu-latest machine From ab113cf27d573ff1967e2d0a36b48686c90bb9a1 Mon Sep 17 00:00:00 2001 From: Devin Gunay Date: Wed, 7 Oct 2020 17:11:02 -0700 Subject: [PATCH 11/15] Merge work to fix problems in GitHub Actions CI (#1) 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 --- .github/workflows/tests.yml | 137 +++++++++++++++++++++------- _test/check-configlet-fmt.sh | 6 +- _test/check-exercise-crate.sh | 6 +- _test/check-exercises.sh | 6 +- _test/ensure-readmes-are-updated.sh | 2 +- _test/ensure-stubs-compile.sh | 6 +- 6 files changed, 124 insertions(+), 39 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bc3498bcb..97ab3c4c0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,54 +5,55 @@ on: push: branches: - master + - actions-test # TODO: remove when done testing pull_request: jobs: - run-all-tests: - name: Run all tests - - # TODO: not sure what the best OS to run on is so ubuntu will do for now + ensure-conventions: + name: Ensure conventions are followed runs-on: ubuntu-latest - strategy: - # Allows running the build multiple times with different configurations - matrix: - rust: ["stable", "beta"] - deny_warnings: ['', 1] - - # TODO: I don't know how to make it run only the check_exercises.sh script - # For nightly rust, run the job with DENYWARNINGS=1 - include: - - rust: nightly - deny_warnings: 1 - - # Allow failures on nightly rust, or beta if DENYWARNINGS is enabled - continue-on-error: ${{ matrix.rust }} == "nightly" || ( ${{ matrix.rust }} == "beta" && DENYWARNINGS == 1 ) - steps: # Checks out a copy of your repository on the ubuntu-latest machine - name: Checkout code uses: actions/checkout@v2 - env: - DENYWARNINGS: ${{ matrix.deny_warnings }} - - # run these as steps - - name: Check exercises - run: ./_test/check-exercises.sh - name: Ensure src/lib.rs files exist run: bash ./_test/ensure-lib-src-rs-exist.sh - - name: Ensure stubs compile - run: sh ./_test/ensure-stubs-compile.sh - - name: Count ignores run: sh ./_test/count-ignores.sh + - name: Check UUIDs + run: sh ./_test/check-uuids.sh + + - name: Verify exercise difficulties + run: ./_test/verify-exercise-difficulties.sh + + - name: Check exercises for authors + run: ./_test/check-exercises-for-authors.sh + + configlet: + name: Setup configlet + runs-on: ubuntu-latest + + steps: + # Checks out master locally so that it is available to the scripts. + - name: Checkout master + uses: actions/checkout@v2 + with: + ref: master + + # Checks out a copy of your repository on the ubuntu-latest machine + - name: Checkout code + uses: actions/checkout@v2 + - name: Fetch configlet run: ./bin/fetch-configlet - name: Check configlet format + env: + TRAVIS_PULL_REQUEST: true # TODO: perhaps refactor the name run: ./_test/check-configlet-fmt.sh - name: Ensure readmes are updated @@ -61,14 +62,82 @@ jobs: - name: Lint configlet run: ./bin/configlet lint . - - name: Check UUIDs - run: sh ./_test/check-uuids.sh - - name: Verify exercise difficulties - run: ./_test/verify-exercise-difficulties.sh + compilation: + name: Check compilation + runs-on: ubuntu-latest - - name: Check exercises for authors - run: ./_test/check-exercises-for-authors.sh + strategy: + # Allows running the job multiple times with different configurations + matrix: + rust: ["stable", "beta"] + deny_warnings: ['', '1'] + + # TODO: figure out how to make this work for beta + denywarnings + # - continue-on-error: true + # if: ( matrix.rust == 'beta' && DENYWARNINGS == '1' ) + + steps: + # Checks out master locally so that it is available to the scripts. + - name: Checkout master + uses: actions/checkout@v2 + with: + ref: master + + # Checks out a copy of your repository on the ubuntu-latest machine + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + + # run scripts as steps + # TODO: the TRAVIS_PULL_REQUEST variable is a holdover from before the + # migration to GitHub Actions. The scripts that use it may require some + # changes to work properly - check the workflow logs for details. + # TODO: I'm not sure how to conditionally set TRAVIS_PULL_REQUEST depending on + # whether this is a PR or not. + - name: Check exercises + env: + DENYWARNINGS: ${{ matrix.deny_warnings }} + TRAVIS_PULL_REQUEST: true + run: ./_test/check-exercises.sh + + - name: Ensure stubs compile + env: + DENYWARNINGS: ${{ matrix.deny_warnings }} + TRAVIS_PULL_REQUEST: true + run: sh ./_test/ensure-stubs-compile.sh - name: Check exercise crate + env: + DENYWARNINGS: ${{ matrix.deny_warnings }} + TRAVIS_PULL_REQUEST: true run: sh ./_test/check-exercise-crate.sh + + nightly-compilation: + name: Check exercises on nightly (benchmark enabled) + runs-on: ubuntu-latest + + steps: + # Checks out master locally so that it is available to the scripts. + - name: Checkout master + uses: actions/checkout@v2 + with: + ref: master + + # Checks out a copy of your repository on the ubuntu-latest machine + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup nightly toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + + - name: Check exercises + env: + BENCHMARK: '1' + run: ./_test/check-exercises.sh diff --git a/_test/check-configlet-fmt.sh b/_test/check-configlet-fmt.sh index 281e5205a..b9f3c9ffe 100755 --- a/_test/check-configlet-fmt.sh +++ b/_test/check-configlet-fmt.sh @@ -3,12 +3,16 @@ # This ensures that config.json and config/maintainers.json are compatible # with the output of configlet fmt. +# FIXME: causes failures in CI +# # Improve error propagation during CI +# set -e -o pipefail + # Check if config.json or maintainers.json were modified check_pattern="config.json\|config/maintainers.json" if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then # Check the changes on the current branch against master branch - git diff --name-only master | grep "$check_pattern" + git diff --name-only remotes/origin/master | grep "$check_pattern" else # Check the commits on the master branch made during the week # This is because Travis cron is set to test the master branch weekly. diff --git a/_test/check-exercise-crate.sh b/_test/check-exercise-crate.sh index 79cc11301..68a39c5ee 100755 --- a/_test/check-exercise-crate.sh +++ b/_test/check-exercise-crate.sh @@ -2,11 +2,15 @@ # A script to ensure that the util/exercise crate builds after it was modified. +# FIXME: causes failures in CI +# # Improve error propagation during CI +# set -e -o pipefail + EXERCISE_CRATE_PATH="util/exercise" if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then # Check the changes on the current branch against master branch - git diff --name-only master | grep "$EXERCISE_CRATE_PATH" + git diff --name-only remotes/origin/master | grep "$EXERCISE_CRATE_PATH" else # Check the commits on the master branch made during the week # This is because Travis cron is set to test the master branch weekly. diff --git a/_test/check-exercises.sh b/_test/check-exercises.sh index f97615c96..47de77e08 100755 --- a/_test/check-exercises.sh +++ b/_test/check-exercises.sh @@ -1,5 +1,9 @@ #!/bin/bash +# NOTE: this causes the job to fail always +# # Improve error propagation during CI +# set -e -o pipefail + # test for existence and executability of the test-exercise script # this depends on that if [ ! -f "./bin/test-exercise" ]; then @@ -28,7 +32,7 @@ fi repo=$(cd "$(dirname "$0")/.." && pwd) if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then - files="$(git diff --diff-filter=d --name-only master | grep "exercises/" | cut -d '/' -f -2 | sort -u | awk -v repo=$repo '{print repo"/"$1}')" + files="$(git diff --diff-filter=d --name-only remotes/origin/master | grep "exercises/" | cut -d '/' -f -2 | sort -u | awk -v repo=$repo '{print repo"/"$1}')" else files=$repo/exercises/* fi diff --git a/_test/ensure-readmes-are-updated.sh b/_test/ensure-readmes-are-updated.sh index e84b57a73..33abb130c 100755 --- a/_test/ensure-readmes-are-updated.sh +++ b/_test/ensure-readmes-are-updated.sh @@ -12,7 +12,7 @@ newline=$'\n ' missing_readmes="" wrong_readmes="" -for exercise in $(git diff --diff-filter=d --name-only master..$(git rev-parse --abbrev-ref HEAD) | grep exercises/ | cut -d'/' -f2 -s | sort -fu); do +for exercise in $(git diff --diff-filter=d --name-only remotes/origin/master..$(git rev-parse --abbrev-ref HEAD) | grep exercises/ | cut -d'/' -f2 -s | sort -fu); do echo "Checking readme for $exercise" readme_path="exercises/${exercise}/README.md" if [ ! -f $readme_path ]; then diff --git a/_test/ensure-stubs-compile.sh b/_test/ensure-stubs-compile.sh index e2822aa98..b81ba2500 100755 --- a/_test/ensure-stubs-compile.sh +++ b/_test/ensure-stubs-compile.sh @@ -1,9 +1,13 @@ #!/bin/sh +# FIXME: causes failures in CI +# # Improve error propagation during CI +# set -e -o pipefail + repo=$(cd "$(dirname "$0")/.." && pwd) if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then - changed_exercises="$(git diff --diff-filter=d --name-only master | grep "exercises/" | cut -d '/' -f -2 | sort -u | awk -v repo=$repo '{print repo"/"$1}')" + changed_exercises="$(git diff --diff-filter=d --name-only remotes/origin/master | grep "exercises/" | cut -d '/' -f -2 | sort -u | awk -v repo=$repo '{print repo"/"$1}')" else changed_exercises=$repo/exercises/* fi From e037ed88e996784e4cca270c11daa6d75d074374 Mon Sep 17 00:00:00 2001 From: Devin gunay Date: Thu, 8 Oct 2020 21:46:43 -0700 Subject: [PATCH 12/15] Squashed commit - should be pretty close to working as intended: commit 5790f28ef86d72c9bcc57344d6f5064d101c45f0 Author: Devin gunay Date: Thu Oct 8 21:45:55 2020 -0700 probably working gh actions configuration commit 4c077547062947116eac55a68233116514112b0a Author: Devin gunay Date: Thu Oct 8 21:43:21 2020 -0700 test if whole job fails commit 666653bef8c60c5f21359d136bd33068f933e171 Author: Devin gunay Date: Thu Oct 8 21:38:50 2020 -0700 test failure on CI w denywarnings commit 641db7e03fb476fdb098df6ef684a8f172e4bbe5 Author: Devin gunay Date: Thu Oct 8 21:25:41 2020 -0700 edit script to check cont on error commit 85801de027e91e5c2fe914999ce46853629beca8 Author: Devin gunay Date: Thu Oct 8 21:18:18 2020 -0700 fix toolchain and try continue on error commit 1c2e590306cdecd69b2c8322aa14bbfe34af53d3 Author: Devin gunay Date: Thu Oct 8 21:08:11 2020 -0700 remove travis pr echo commit 4a623fc4f4f6f6f6187a1de3ac50c617cdf88d03 Author: Devin gunay Date: Thu Oct 8 21:03:11 2020 -0700 print pr var commit c79f0c19bc11b80e0652512aa822d91ef704ad85 Author: Devin gunay Date: Thu Oct 8 21:01:06 2020 -0700 try travis pr again commit 21ddc4083a84505014d88dcb5a093a53f359b64f Author: Devin gunay Date: Thu Oct 8 20:55:52 2020 -0700 set travis pr var conditionally commit 3a580b682e66862cb9e8fc851e97bfcc17a5e721 Author: Devin Gunay Date: Wed Oct 7 17:05:25 2020 -0700 check out master for nightly commit 67bb71de0670eff9dfb5066cacf4482915530473 Author: Devin Gunay Date: Wed Oct 7 17:02:51 2020 -0700 fix master ref in ensure readmes updated commit 05c6951e931497b702c923d231bd9ad9cff16b32 Author: Devin Gunay Date: Wed Oct 7 17:00:44 2020 -0700 checkout master for configlet job commit 9e3166262d5113b033afc6b82f336ddd065623b3 Author: Devin Gunay Date: Wed Oct 7 16:58:55 2020 -0700 fix master branch path commit 749a92cc19e65cb1f90c03fbb4ed44a8755c63f7 Author: Devin Gunay Date: Wed Oct 7 16:55:21 2020 -0700 see if remotes origin master works commit 33a0704d95b49064518200377efe773192d1f83c Author: Devin Gunay Date: Wed Oct 7 16:54:21 2020 -0700 try to check out master first commit 8739869c1cbdb65b9c7ba9907aff333d8fc4e121 Author: Devin Gunay Date: Wed Oct 7 16:51:03 2020 -0700 look at git branch -a commit 96001e244469baebd37663bf242f02f54d84cdd9 Author: Devin Gunay Date: Wed Oct 7 16:46:16 2020 -0700 add check PR files commit 2be04c53f38df9d48c427ed7c361ef80d76ca196 Author: Devin Gunay Date: Wed Oct 7 16:38:02 2020 -0700 fail fast during CI for pull requests commit 02101b294ff70a0f1c97f722666a0a830b06d0e6 Author: Devin Gunay Date: Wed Oct 7 16:36:08 2020 -0700 add set -e -o pipefail to script commit c5e255a86959fbcbf37222475946a6d94cfcb32d Author: Devin Gunay Date: Wed Oct 7 16:27:02 2020 -0700 try changing master to origin/master to make actions not fail commit 3b4395a11ebd452c036a4ec3e7ee77fed89a133c Author: Devin Gunay Date: Wed Oct 7 00:47:17 2020 -0700 add travis env var commit 497d3a3f76a0fcfdc650f88b34f56e82f85cc60d Author: Devin Gunay Date: Wed Oct 7 00:26:24 2020 -0700 try toolchain again commit 359269f3b348aa53be38510d85f3b09e10360476 Author: Devin Gunay Date: Wed Oct 7 00:25:37 2020 -0700 try toolchain again commit 04df9cb9189f7e6ec9a5c7eecf9d3f1fc099b238 Author: Devin Gunay Date: Wed Oct 7 00:24:41 2020 -0700 try toolchain again commit 42b6e16616eb8e737b6f1f315d321bd1548aa5ec Author: Devin Gunay Date: Wed Oct 7 00:18:00 2020 -0700 fix nightly toolchain commit 2c7354d6daf3dc2e1e668ed8b1dc872108927add Author: Devin Gunay Date: Wed Oct 7 00:17:18 2020 -0700 forgot what i did commit 7560f0b58775b9fc5daf192c6501269d7e2962a6 Author: Devin Gunay Date: Wed Oct 7 00:09:38 2020 -0700 try using deny warnings commit 80b6d7688bbb47f4dbddfec8188a6e2a397819b6 Author: Devin Gunay Date: Wed Oct 7 00:07:15 2020 -0700 uncomment compilation job commit 5badd4612b451ae04278fc05c7cede6ceb9d29a6 Author: Devin Gunay Date: Wed Oct 7 00:06:24 2020 -0700 add temp branch commit ef58cdb8b19b02e037e1a07cfcda902c9295cbce Author: Devin Gunay Date: Wed Oct 7 00:05:27 2020 -0700 comment out compilation job commit 0ef5ed2222f8c467599325aaddf91e00e0814028 Author: Devin Gunay Date: Wed Oct 7 00:04:30 2020 -0700 Update tests.yml commit 66db3112c3a806dce4efce48c43d4e1d1945d5ca Author: Devin Gunay Date: Wed Oct 7 00:00:40 2020 -0700 delete not linting lines commit 803a50719d9469eef91681c9377e904e9221dfb7 Author: Devin Gunay Date: Tue Oct 6 23:59:38 2020 -0700 delete continue on error commit c34c8f69d0911d2689fdad640fd316d11f5ac3bd Author: Devin Gunay Date: Tue Oct 6 23:58:33 2020 -0700 delete comment commit dbd4e1c83e651e101cf5454a2113bf3805d4fb62 Author: Devin Gunay Date: Tue Oct 6 23:57:11 2020 -0700 big commit commit ba883ef9f270ded618abcb1668aecdacb644dfdf Author: Devin Gunay Date: Tue Oct 6 23:41:41 2020 -0700 try putting entire expression in curly braces commit 524b3e72e2992f45d754ab6ca8cc3e59961f911a Author: Devin Gunay Date: Tue Oct 6 23:40:25 2020 -0700 test2 commit 96c55471453e1f186a211f0cc9b9acded2258698 Author: Devin Gunay Date: Tue Oct 6 23:39:37 2020 -0700 test1 --- .github/workflows/tests.yml | 143 +++++++++++++++++++++------- _test/check-configlet-fmt.sh | 6 +- _test/check-exercise-crate.sh | 6 +- _test/check-exercises.sh | 7 +- _test/ensure-readmes-are-updated.sh | 2 +- _test/ensure-stubs-compile.sh | 6 +- 6 files changed, 131 insertions(+), 39 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bc3498bcb..1b3e2c2b7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,47 +8,51 @@ on: pull_request: jobs: - run-all-tests: - name: Run all tests - - # TODO: not sure what the best OS to run on is so ubuntu will do for now + ensure-conventions: + name: Ensure conventions are followed runs-on: ubuntu-latest - strategy: - # Allows running the build multiple times with different configurations - matrix: - rust: ["stable", "beta"] - deny_warnings: ['', 1] - - # TODO: I don't know how to make it run only the check_exercises.sh script - # For nightly rust, run the job with DENYWARNINGS=1 - include: - - rust: nightly - deny_warnings: 1 - - # Allow failures on nightly rust, or beta if DENYWARNINGS is enabled - continue-on-error: ${{ matrix.rust }} == "nightly" || ( ${{ matrix.rust }} == "beta" && DENYWARNINGS == 1 ) - steps: # Checks out a copy of your repository on the ubuntu-latest machine - name: Checkout code uses: actions/checkout@v2 - env: - DENYWARNINGS: ${{ matrix.deny_warnings }} - - # run these as steps - - name: Check exercises - run: ./_test/check-exercises.sh - name: Ensure src/lib.rs files exist run: bash ./_test/ensure-lib-src-rs-exist.sh - - name: Ensure stubs compile - run: sh ./_test/ensure-stubs-compile.sh - - name: Count ignores run: sh ./_test/count-ignores.sh + - name: Check UUIDs + run: sh ./_test/check-uuids.sh + + - name: Verify exercise difficulties + run: ./_test/verify-exercise-difficulties.sh + + - name: Check exercises for authors + run: ./_test/check-exercises-for-authors.sh + + configlet: + name: Setup configlet + runs-on: ubuntu-latest + + steps: + # Checks out master locally so that it is available to the scripts. + - name: Checkout master + uses: actions/checkout@v2 + with: + ref: master + + # Checks out a copy of your repository on the ubuntu-latest machine + - name: Checkout code + uses: actions/checkout@v2 + + # Sets TRAVIS_PULL_REQUEST to false if this is not a pull request. + - name: set TRAVIS_PULL_REQUEST + env: + PR_NUMBER: ${{ github.event.pull_request.number }} + run: echo "TRAVIS_PULL_REQUEST=${PR_NUMBER:-false}" >> $GITHUB_ENV + - name: Fetch configlet run: ./bin/fetch-configlet @@ -61,14 +65,85 @@ jobs: - name: Lint configlet run: ./bin/configlet lint . - - name: Check UUIDs - run: sh ./_test/check-uuids.sh - - name: Verify exercise difficulties - run: ./_test/verify-exercise-difficulties.sh + compilation: + name: Check compilation + runs-on: ubuntu-latest - - name: Check exercises for authors - run: ./_test/check-exercises-for-authors.sh + strategy: + # Allows running the job multiple times with different configurations + matrix: + rust: ["stable", "beta"] + deny_warnings: ['', '1'] + + steps: + # Checks out master locally so that it is available to the scripts. + - name: Checkout master + uses: actions/checkout@v2 + with: + ref: master + + # Checks out a copy of your repository on the ubuntu-latest machine + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + default: true + + # Sets TRAVIS_PULL_REQUEST to false if this is not a pull request. + - name: set TRAVIS_PULL_REQUEST + env: + PR_NUMBER: ${{ github.event.pull_request.number }} + run: echo "TRAVIS_PULL_REQUEST=${PR_NUMBER:-false}" >> $GITHUB_ENV + + # run scripts as steps + # TODO: the TRAVIS_PULL_REQUEST variable is a holdover from before the + # migration to GitHub Actions. The scripts that use it do so in order to + # run only on changed files. + - name: Check exercises + env: + DENYWARNINGS: ${{ matrix.deny_warnings }} + run: ./_test/check-exercises.sh + continue-on-error: ${{ matrix.rust == 'beta' && matrix.deny_warnings == '1' }} + + - name: Ensure stubs compile + env: + DENYWARNINGS: ${{ matrix.deny_warnings }} + run: sh ./_test/ensure-stubs-compile.sh + continue-on-error: ${{ matrix.rust == 'beta' && matrix.deny_warnings == '1' }} - name: Check exercise crate + env: + DENYWARNINGS: ${{ matrix.deny_warnings }} run: sh ./_test/check-exercise-crate.sh + continue-on-error: ${{ matrix.rust == 'beta' && matrix.deny_warnings == '1' }} + + nightly-compilation: + name: Check exercises on nightly (benchmark enabled) + runs-on: ubuntu-latest + continue-on-error: true # It's okay if the nightly job fails + + steps: + # Checks out master locally so that it is available to the scripts. + - name: Checkout master + uses: actions/checkout@v2 + with: + ref: master + + # Checks out a copy of your repository on the ubuntu-latest machine + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup nightly toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + default: true + + - name: Check exercises + env: + BENCHMARK: '1' + run: ./_test/check-exercises.sh diff --git a/_test/check-configlet-fmt.sh b/_test/check-configlet-fmt.sh index 281e5205a..b9f3c9ffe 100755 --- a/_test/check-configlet-fmt.sh +++ b/_test/check-configlet-fmt.sh @@ -3,12 +3,16 @@ # This ensures that config.json and config/maintainers.json are compatible # with the output of configlet fmt. +# FIXME: causes failures in CI +# # Improve error propagation during CI +# set -e -o pipefail + # Check if config.json or maintainers.json were modified check_pattern="config.json\|config/maintainers.json" if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then # Check the changes on the current branch against master branch - git diff --name-only master | grep "$check_pattern" + git diff --name-only remotes/origin/master | grep "$check_pattern" else # Check the commits on the master branch made during the week # This is because Travis cron is set to test the master branch weekly. diff --git a/_test/check-exercise-crate.sh b/_test/check-exercise-crate.sh index 79cc11301..68a39c5ee 100755 --- a/_test/check-exercise-crate.sh +++ b/_test/check-exercise-crate.sh @@ -2,11 +2,15 @@ # A script to ensure that the util/exercise crate builds after it was modified. +# FIXME: causes failures in CI +# # Improve error propagation during CI +# set -e -o pipefail + EXERCISE_CRATE_PATH="util/exercise" if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then # Check the changes on the current branch against master branch - git diff --name-only master | grep "$EXERCISE_CRATE_PATH" + git diff --name-only remotes/origin/master | grep "$EXERCISE_CRATE_PATH" else # Check the commits on the master branch made during the week # This is because Travis cron is set to test the master branch weekly. diff --git a/_test/check-exercises.sh b/_test/check-exercises.sh index f97615c96..a9eff2f93 100755 --- a/_test/check-exercises.sh +++ b/_test/check-exercises.sh @@ -1,5 +1,10 @@ #!/bin/bash +# NOTE: this causes the job to fail always +# # Improve error propagation during CI +# set -e -o pipefail + + # test for existence and executability of the test-exercise script # this depends on that if [ ! -f "./bin/test-exercise" ]; then @@ -28,7 +33,7 @@ fi repo=$(cd "$(dirname "$0")/.." && pwd) if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then - files="$(git diff --diff-filter=d --name-only master | grep "exercises/" | cut -d '/' -f -2 | sort -u | awk -v repo=$repo '{print repo"/"$1}')" + files="$(git diff --diff-filter=d --name-only remotes/origin/master | grep "exercises/" | cut -d '/' -f -2 | sort -u | awk -v repo=$repo '{print repo"/"$1}')" else files=$repo/exercises/* fi diff --git a/_test/ensure-readmes-are-updated.sh b/_test/ensure-readmes-are-updated.sh index e84b57a73..33abb130c 100755 --- a/_test/ensure-readmes-are-updated.sh +++ b/_test/ensure-readmes-are-updated.sh @@ -12,7 +12,7 @@ newline=$'\n ' missing_readmes="" wrong_readmes="" -for exercise in $(git diff --diff-filter=d --name-only master..$(git rev-parse --abbrev-ref HEAD) | grep exercises/ | cut -d'/' -f2 -s | sort -fu); do +for exercise in $(git diff --diff-filter=d --name-only remotes/origin/master..$(git rev-parse --abbrev-ref HEAD) | grep exercises/ | cut -d'/' -f2 -s | sort -fu); do echo "Checking readme for $exercise" readme_path="exercises/${exercise}/README.md" if [ ! -f $readme_path ]; then diff --git a/_test/ensure-stubs-compile.sh b/_test/ensure-stubs-compile.sh index e2822aa98..b81ba2500 100755 --- a/_test/ensure-stubs-compile.sh +++ b/_test/ensure-stubs-compile.sh @@ -1,9 +1,13 @@ #!/bin/sh +# FIXME: causes failures in CI +# # Improve error propagation during CI +# set -e -o pipefail + repo=$(cd "$(dirname "$0")/.." && pwd) if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then - changed_exercises="$(git diff --diff-filter=d --name-only master | grep "exercises/" | cut -d '/' -f -2 | sort -u | awk -v repo=$repo '{print repo"/"$1}')" + changed_exercises="$(git diff --diff-filter=d --name-only remotes/origin/master | grep "exercises/" | cut -d '/' -f -2 | sort -u | awk -v repo=$repo '{print repo"/"$1}')" else changed_exercises=$repo/exercises/* fi From 79e1c8e0d2c158b41c9ddb1867f7d216f833053b Mon Sep 17 00:00:00 2001 From: Devin gunay Date: Thu, 8 Oct 2020 22:10:45 -0700 Subject: [PATCH 13/15] remove leftover always true TRAVIS_PULL_REQUEST --- .github/workflows/tests.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 30fc0afd6..1b3e2c2b7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,7 +5,6 @@ on: push: branches: - master - - actions-test # TODO: remove when done testing pull_request: jobs: @@ -58,8 +57,6 @@ jobs: run: ./bin/fetch-configlet - name: Check configlet format - env: - TRAVIS_PULL_REQUEST: true # TODO: perhaps refactor the name run: ./_test/check-configlet-fmt.sh - name: Ensure readmes are updated From 230b1b18f9dfa85bdf36133fdf4623d95d3a0586 Mon Sep 17 00:00:00 2001 From: Peter Goodspeed-Niklaus Date: Thu, 15 Oct 2020 22:31:54 +0200 Subject: [PATCH 14/15] shorten overall CI name for brevity --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1b3e2c2b7..0b217d738 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: Run all tests +name: CI # Run this workflow every time a new commit is pushed to the repository on: @@ -105,7 +105,7 @@ jobs: # run only on changed files. - name: Check exercises env: - DENYWARNINGS: ${{ matrix.deny_warnings }} + DENYWARNINGS: ${{ matrix.deny_warnings }} run: ./_test/check-exercises.sh continue-on-error: ${{ matrix.rust == 'beta' && matrix.deny_warnings == '1' }} From 7ac069dd1f1aaeab9f066414de66b454564837d9 Mon Sep 17 00:00:00 2001 From: Peter Goodspeed-Niklaus Date: Thu, 15 Oct 2020 22:34:10 +0200 Subject: [PATCH 15/15] remove new comments in scripts 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. --- _test/check-configlet-fmt.sh | 4 ---- _test/check-exercise-crate.sh | 6 +----- _test/check-exercises.sh | 4 ---- _test/ensure-stubs-compile.sh | 4 ---- 4 files changed, 1 insertion(+), 17 deletions(-) diff --git a/_test/check-configlet-fmt.sh b/_test/check-configlet-fmt.sh index b9f3c9ffe..54a5b4d7e 100755 --- a/_test/check-configlet-fmt.sh +++ b/_test/check-configlet-fmt.sh @@ -3,10 +3,6 @@ # This ensures that config.json and config/maintainers.json are compatible # with the output of configlet fmt. -# FIXME: causes failures in CI -# # Improve error propagation during CI -# set -e -o pipefail - # Check if config.json or maintainers.json were modified check_pattern="config.json\|config/maintainers.json" diff --git a/_test/check-exercise-crate.sh b/_test/check-exercise-crate.sh index 68a39c5ee..65e55fa11 100755 --- a/_test/check-exercise-crate.sh +++ b/_test/check-exercise-crate.sh @@ -2,10 +2,6 @@ # A script to ensure that the util/exercise crate builds after it was modified. -# FIXME: causes failures in CI -# # Improve error propagation during CI -# set -e -o pipefail - EXERCISE_CRATE_PATH="util/exercise" if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then @@ -27,7 +23,7 @@ TRACK_ROOT="$(git rev-parse --show-toplevel)" if !(cd "$TRACK_ROOT/$EXERCISE_CRATE_PATH" && cargo check); then echo "\nAn error has occurred while building the exercise crate.\nPlease make it compile." - + exit 1 else echo "\nexercise crate has been successfully built." diff --git a/_test/check-exercises.sh b/_test/check-exercises.sh index 47de77e08..0ea61e2b7 100755 --- a/_test/check-exercises.sh +++ b/_test/check-exercises.sh @@ -1,9 +1,5 @@ #!/bin/bash -# NOTE: this causes the job to fail always -# # Improve error propagation during CI -# set -e -o pipefail - # test for existence and executability of the test-exercise script # this depends on that if [ ! -f "./bin/test-exercise" ]; then diff --git a/_test/ensure-stubs-compile.sh b/_test/ensure-stubs-compile.sh index b81ba2500..8880dbf90 100755 --- a/_test/ensure-stubs-compile.sh +++ b/_test/ensure-stubs-compile.sh @@ -1,9 +1,5 @@ #!/bin/sh -# FIXME: causes failures in CI -# # Improve error propagation during CI -# set -e -o pipefail - repo=$(cd "$(dirname "$0")/.." && pwd) if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then