From 181ca492cb0511f4f14543608224074553ee07ed Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Fri, 26 Feb 2021 16:33:58 +0100 Subject: [PATCH 01/26] Unbreak CI: The 'master' branch is now called 'main'. --- .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 487d0bf9d..7cd7984b7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,7 +17,7 @@ jobs: # because the README check only checks exercises changed since master. - uses: actions/checkout@v2 with: - ref: master + ref: main - uses: actions/checkout@v2 From 20a744359a0833d97a6ade7e2848e9be84a3e725 Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Fri, 26 Feb 2021 16:49:05 +0100 Subject: [PATCH 02/26] Unbreak CI: Temporarily don't stop when 'configlet lint' fails --- .github/workflows/configlet.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/configlet.yml b/.github/workflows/configlet.yml index c86ed0cf5..1563ab22a 100644 --- a/.github/workflows/configlet.yml +++ b/.github/workflows/configlet.yml @@ -14,3 +14,6 @@ jobs: - name: Configlet Linter run: configlet lint + + # Issue #952: Remove this when CI has been unbroken. + continue-on-error: true From d61528313d1fc0d4df10f2a3e0a017e7bd73b048 Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Sun, 28 Feb 2021 20:04:25 +0100 Subject: [PATCH 03/26] Unbreak CI: Move 'configlet lint' into main CI script Call `configlet lint` instead of `configlet lint .`. Use commit hash cf. GitHub Actions security hardening principles: https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions --- .github/workflows/configlet.yml | 19 ------------------- .github/workflows/tests.yml | 19 +++++++++---------- 2 files changed, 9 insertions(+), 29 deletions(-) delete mode 100644 .github/workflows/configlet.yml diff --git a/.github/workflows/configlet.yml b/.github/workflows/configlet.yml deleted file mode 100644 index 1563ab22a..000000000 --- a/.github/workflows/configlet.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Configlet CI - -on: [push, pull_request, workflow_dispatch] - -jobs: - configlet: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f - - - name: Fetch configlet - uses: exercism/github-actions/configlet-ci@main - - - name: Configlet Linter - run: configlet lint - - # Issue #952: Remove this when CI has been unbroken. - continue-on-error: true diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7cd7984b7..de86ad1ba 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,19 +13,18 @@ jobs: name: Check track configuration runs-on: ubuntu-latest steps: - # master is needed in addition to HEAD, - # because the README check only checks exercises changed since master. - - uses: actions/checkout@v2 + # main is needed in addition to HEAD, + # because the README check only checks exercises changed since main. + - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 with: ref: main - - uses: actions/checkout@v2 + - name: Fetch configlet + uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - - name: Fetch - run: bin/fetch-configlet - - - name: Lint - run: bin/configlet lint . + - name: Configlet Linter + run: configlet lint + continue-on-error: true # Issue #952: Remove this when CI has been unbroken. - name: Ensure READMEs are updated run: sh ./bin/ensure-readmes-are-updated.sh @@ -80,7 +79,7 @@ jobs: # https://github.com/actions/toolkit/issues/399 continue-on-error: ${{ matrix.resolver == 'nightly' }} steps: - - uses: actions/checkout@v2 + uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - name: Install yq (for stack resolvers) run: | From 57d66ebb3e953c03ad5f3f7168d82b7d46d9c5c1 Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Sun, 28 Feb 2021 20:39:07 +0100 Subject: [PATCH 04/26] Unbreak CI: Not necessary to checkout multiple times in same workflow Fix typo. --- .github/workflows/tests.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index de86ad1ba..6ac8f2cee 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,9 +19,6 @@ jobs: with: ref: main - - name: Fetch configlet - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - - name: Configlet Linter run: configlet lint continue-on-error: true # Issue #952: Remove this when CI has been unbroken. @@ -79,7 +76,7 @@ jobs: # https://github.com/actions/toolkit/issues/399 continue-on-error: ${{ matrix.resolver == 'nightly' }} steps: - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - name: Install yq (for stack resolvers) run: | From 353c96bbd045d8e968a0572213a127140852448e Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Sun, 28 Feb 2021 22:23:14 +0100 Subject: [PATCH 05/26] Unbreak CI: Forgot one 'master' -> 'main' rename This should trigger CI again. --- .github/workflows/tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6ac8f2cee..b8a05c060 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,7 +3,8 @@ on: pull_request: push: branches: - - master + - main + - unbreak-ci-after-v3-merge # remove this after testing schedule: # Weekly. - cron: "0 0 * * 0" From e1156058f892c551f56ae3bebc222337870f3d81 Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Sun, 28 Feb 2021 22:25:50 +0100 Subject: [PATCH 06/26] Unbreak CI: Rename 'master' -> 'main' in bin/ensure-readmes-are-updated.sh --- bin/ensure-readmes-are-updated.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/ensure-readmes-are-updated.sh b/bin/ensure-readmes-are-updated.sh index 6f5eb708e..15342517a 100755 --- a/bin/ensure-readmes-are-updated.sh +++ b/bin/ensure-readmes-are-updated.sh @@ -3,7 +3,7 @@ override_message="I have confirmed that no README check is needed" # If *any* commit message contains the override message: -if git log origin/master..HEAD | grep -q "$override_message"; then +if git log origin/main..HEAD | grep -q "$override_message"; then echo "WARNING: You've overridden the README check, which applies to ALL commits in this PR." echo "No README in this PR will be checked for changes." exit 0 @@ -27,7 +27,7 @@ newline=$'\n ' missing_readmes="" wrong_readmes="" -for exercise in $(git diff --name-only origin/master..$(git rev-parse --abbrev-ref HEAD) | grep exercises/ | cut -d'/' -f2 -s | sort -fu); do +for exercise in $(git diff --name-only origin/main..$(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 From b97ae8b15995df4d5a7ba67621318b412dfd232f Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Sun, 28 Feb 2021 22:55:38 +0100 Subject: [PATCH 07/26] Unbreak CI: Assume 'configlet' is in path --- bin/ensure-readmes-are-updated.sh | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/bin/ensure-readmes-are-updated.sh b/bin/ensure-readmes-are-updated.sh index 15342517a..5a17c8fda 100755 --- a/bin/ensure-readmes-are-updated.sh +++ b/bin/ensure-readmes-are-updated.sh @@ -9,16 +9,6 @@ if git log origin/main..HEAD | grep -q "$override_message"; then exit 0 fi -configlet=$(which configlet) -if [ ! -x "$configlet" ]; then - configlet=bin/configlet -fi -if [ ! -x "$configlet" ]; then - echo "Improper configuration; configlet should exist in bin/ when this script is run" - echo "Ping a Haskell track maintainer to fix this" - exit 1 -fi - if [ ! -d "problem-specifications" ]; then git clone https://github.com/exercism/problem-specifications.git problem-specifications fi @@ -35,7 +25,7 @@ for exercise in $(git diff --name-only origin/main..$(git rev-parse --abbrev-ref else existing_readme_checksum=$(md5sum $readme_path | cut -d' ' -f1) # generate the new README - $configlet generate . --only "$exercise" --spec-path "problem-specifications" + configlet generate . --only "$exercise" --spec-path "problem-specifications" generated_readme_checksum=$(md5sum $readme_path | cut -d' ' -f1) if [ $existing_readme_checksum != $generated_readme_checksum ]; then From 5fae37679d27dab29bc157e1c981750d157999d7 Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Sun, 28 Feb 2021 23:11:57 +0100 Subject: [PATCH 08/26] Temporary change to isogram/.docs/instructions.md --- exercises/practice/isogram/.docs/instructions.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/exercises/practice/isogram/.docs/instructions.md b/exercises/practice/isogram/.docs/instructions.md index 9cc5350b6..bf00bdfba 100644 --- a/exercises/practice/isogram/.docs/instructions.md +++ b/exercises/practice/isogram/.docs/instructions.md @@ -12,3 +12,5 @@ Examples of isograms: - six-year-old The word *isograms*, however, is not an isogram, because the s repeats. + +Oh my god. From 0a0f6048e2c7c1b646e5287c54be4444c207513e Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Mon, 1 Mar 2021 00:23:37 +0100 Subject: [PATCH 09/26] Unbreak CI: There is no such thing as README.md Rename the script into ``` bin/ensure-practice-exercise-descriptions-are-synced.sh ``` since what was once exercises are now called practice exercises. That which is called concept exercises is not shared between tracks, and so syncing their descriptions is not well-defined. This commit preserves the `override_message`: ``` override_message="I have confirmed ... no README check ..." ``` (censored to avoid triggering CI) in order to not pick a new slogan. While exercism/configlet#179 is being resolved, the only thing we can test is that each practice exercise has an instructions.md, which is the only description file that is always present after #950. --- .github/workflows/tests.yml | 4 +- ...actice-exercise-descriptions-are-synced.sh | 37 +++++++++++++++ bin/ensure-readmes-are-updated.sh | 45 ------------------- 3 files changed, 39 insertions(+), 47 deletions(-) create mode 100755 bin/ensure-practice-exercise-descriptions-are-synced.sh delete mode 100755 bin/ensure-readmes-are-updated.sh diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b8a05c060..44d892afe 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,8 +24,8 @@ jobs: run: configlet lint continue-on-error: true # Issue #952: Remove this when CI has been unbroken. - - name: Ensure READMEs are updated - run: sh ./bin/ensure-readmes-are-updated.sh + - name: Ensure practice exercise descriptions are synced + run: sh ./bin/ensure-practice-exercise-descriptions-are-synced.sh - name: Check configlet fmt run: sh ./bin/check-configlet-fmt.sh diff --git a/bin/ensure-practice-exercise-descriptions-are-synced.sh b/bin/ensure-practice-exercise-descriptions-are-synced.sh new file mode 100755 index 000000000..7a218961d --- /dev/null +++ b/bin/ensure-practice-exercise-descriptions-are-synced.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# +# Check that practice exercise descriptions are in sync with problem-specifications. + +override_message="I have confirmed that no README check is needed" + +# If *any* commit message contains the override message: +if git log origin/main..HEAD | grep -q "$override_message"; then + echo "WARNING: You've overridden the README check, which applies to ALL commits in this PR." + echo "No practice exercise description in this PR will be checked for changes." + exit 0 +fi + +newline=$'\n ' + +changed_practice_exercises() { + branch_name="$(git rev-parse --abbrev-ref HEAD)" + git diff --name-only "origin/main..$branch_name" | \ + grep -Po '(?<=^exercises/practice/)\w+' | sort -fu +} + +missing_readmes="" +for exercise in $(changed_practice_exercises); do + echo "Checking readme for $exercise" + + instructions_path="exercises/practice/$exercise/.docs/instructions.md" + if [ ! -f "$instructions_path" ]; then + missing_readmes="$missing_readmes$newline$exercise" + fi +done + +if [ -n "$missing_readmes" ]; then + echo "Exercises missing instructions.md:$missing_readmes" +fi +if [ -n "$missing_readmes" ]; then + exit 1 +fi diff --git a/bin/ensure-readmes-are-updated.sh b/bin/ensure-readmes-are-updated.sh deleted file mode 100755 index 5a17c8fda..000000000 --- a/bin/ensure-readmes-are-updated.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh - -override_message="I have confirmed that no README check is needed" - -# If *any* commit message contains the override message: -if git log origin/main..HEAD | grep -q "$override_message"; then - echo "WARNING: You've overridden the README check, which applies to ALL commits in this PR." - echo "No README in this PR will be checked for changes." - exit 0 -fi - -if [ ! -d "problem-specifications" ]; then - git clone https://github.com/exercism/problem-specifications.git problem-specifications -fi - -newline=$'\n ' - -missing_readmes="" -wrong_readmes="" -for exercise in $(git diff --name-only origin/main..$(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 - missing_readmes="$missing_readmes$newline$exercise" - else - existing_readme_checksum=$(md5sum $readme_path | cut -d' ' -f1) - # generate the new README - configlet generate . --only "$exercise" --spec-path "problem-specifications" - generated_readme_checksum=$(md5sum $readme_path | cut -d' ' -f1) - - if [ $existing_readme_checksum != $generated_readme_checksum ]; then - wrong_readmes="$wrong_readmes$newline$exercise" - fi - fi -done - -if [ -n "$missing_readmes" ]; then - echo "Exercises missing README.md:$missing_readmes" -fi -if [ -n "$wrong_readmes" ]; then - echo "Exercises with out-of-date README.md:$wrong_readmes" -fi -if [ -n "$missing_readmes" -o -n "$wrong_readmes" ]; then - exit 1 -fi From 7fccd30287d2561a720422b90507d97e397cb351 Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Mon, 1 Mar 2021 01:30:53 +0100 Subject: [PATCH 10/26] Unbreak CI: 'configlet fmt' no longer exists. Either 'configlet lint' will report if formatting is wrong, or we could use 'jq' to check basic formatting. Before a decision is made, removing bin/check-configlet-fmt.sh unbreaks CI. --- .github/workflows/tests.yml | 9 ++++---- bin/check-configlet-fmt.sh | 42 ------------------------------------- 2 files changed, 5 insertions(+), 46 deletions(-) delete mode 100644 bin/check-configlet-fmt.sh diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 44d892afe..9a0e6e968 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,9 +27,6 @@ jobs: - name: Ensure practice exercise descriptions are synced run: sh ./bin/ensure-practice-exercise-descriptions-are-synced.sh - - name: Check configlet fmt - run: sh ./bin/check-configlet-fmt.sh - - name: Install yq (for stack resolvers) run: | sudo add-apt-repository -y ppa:rmescandon/yq @@ -37,7 +34,11 @@ jobs: sudo apt-get -y install yq - name: Ensure stack resolvers synced - run: sh ./bin/ensure-stack-resolvers-synced.sh + run: ls # XXX: Just testing. + # run: ./bin/ensure-stack-resolvers-synced.sh + + - name: Whatevs + run: pwd - name: Check for invalid UUIDs # can be removed once `configlet lint` gains this ability. diff --git a/bin/check-configlet-fmt.sh b/bin/check-configlet-fmt.sh deleted file mode 100644 index bcd04eb40..000000000 --- a/bin/check-configlet-fmt.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh - -# This ensures that config.json and config/maintainers.json are compatible -# with the output of configlet fmt. - -repo=$(cd "$(dirname "$0")/.." && pwd) -configlet="${repo}/bin/configlet" - -if [ ! -x "$configlet" ]; then - # Try it from the path. - configlet=configlet -fi - -c="${repo}/config.json" -m="${repo}/config/maintainers.json" - -md5() { - md5sum $1 | cut -d' ' -f1 -} - -# before S sum -bcs=$(md5 $c) -bms=$(md5 $m) - -cfg=$($configlet fmt .) -if [ $? != 0 ]; then - echo "configlet fmt returned non-0 exit code with output:" - echo $cfg - exit 1 -fi - -# after S sum -acs=$(md5 $c) -ams=$(md5 $m) - -if [ $bcs != $acs -o $bms != $ams ]; then - echo "configlet fmt:" - echo $cfg - echo "Please update the PR to incorporate those changes." - exit 1 -fi -exit 0 From 4a6c3b16fa50e4a43e5521d8af27d5e87388e5c8 Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Mon, 1 Mar 2021 01:35:43 +0100 Subject: [PATCH 11/26] Hm? Hm. --- .github/workflows/tests.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9a0e6e968..d2ddf9171 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,6 +24,12 @@ jobs: run: configlet lint continue-on-error: true # Issue #952: Remove this when CI has been unbroken. + - name: Hm + run: pwd + + - name: Hmm + run: ls + - name: Ensure practice exercise descriptions are synced run: sh ./bin/ensure-practice-exercise-descriptions-are-synced.sh From 52b666b9ea1d2a4a20a890543a9baadf57e00158 Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Mon, 1 Mar 2021 01:37:31 +0100 Subject: [PATCH 12/26] Try. --- .github/workflows/tests.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d2ddf9171..a2688fd5c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,14 +24,12 @@ jobs: run: configlet lint continue-on-error: true # Issue #952: Remove this when CI has been unbroken. - - name: Hm - run: pwd - - - name: Hmm - run: ls - - name: Ensure practice exercise descriptions are synced - run: sh ./bin/ensure-practice-exercise-descriptions-are-synced.sh + # run: sh ./bin/ensure-practice-exercise-descriptions-are-synced.sh + run: ls -l bin/ensure-practice-exercise-descriptions-are-synced.sh + + - name: eh + run: bin/ensure-practice-exercise-descriptions-are-synced.sh - name: Install yq (for stack resolvers) run: | From 087a2e7f9b6a3fad0faa93c7760145e940807230 Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Mon, 1 Mar 2021 01:38:43 +0100 Subject: [PATCH 13/26] Where is it? --- .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 a2688fd5c..c5fc8c883 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,7 +26,7 @@ jobs: - name: Ensure practice exercise descriptions are synced # run: sh ./bin/ensure-practice-exercise-descriptions-are-synced.sh - run: ls -l bin/ensure-practice-exercise-descriptions-are-synced.sh + run: ls -l bin - name: eh run: bin/ensure-practice-exercise-descriptions-are-synced.sh From da89f1cde03615f5bea8b7a1334c95a1b0d6a884 Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Mon, 1 Mar 2021 01:40:26 +0100 Subject: [PATCH 14/26] Why is main checked out, not feature branch? --- .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 c5fc8c883..bbb7cf12d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,8 +17,8 @@ jobs: # main is needed in addition to HEAD, # because the README check only checks exercises changed since main. - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - with: - ref: main + #with: + # ref: main - name: Configlet Linter run: configlet lint From 4cf0dae283fd27dc01898ab49f70abf1f8faa19a Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Mon, 1 Mar 2021 01:45:45 +0100 Subject: [PATCH 15/26] Unbreak CI: Rename and chmod +x bin/ensure-stack-resolvers-synced.sh Rename this to contain "-are" like ensure-practice-exercise-descriptions-are-synced.sh Also, chmod +x it. --- .github/workflows/tests.yml | 9 ++------- ...rs-synced.sh => ensure-stack-resolvers-are-synced.sh} | 0 2 files changed, 2 insertions(+), 7 deletions(-) rename bin/{ensure-stack-resolvers-synced.sh => ensure-stack-resolvers-are-synced.sh} (100%) mode change 100644 => 100755 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bbb7cf12d..1f4c25ad7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -25,10 +25,6 @@ jobs: continue-on-error: true # Issue #952: Remove this when CI has been unbroken. - name: Ensure practice exercise descriptions are synced - # run: sh ./bin/ensure-practice-exercise-descriptions-are-synced.sh - run: ls -l bin - - - name: eh run: bin/ensure-practice-exercise-descriptions-are-synced.sh - name: Install yq (for stack resolvers) @@ -37,9 +33,8 @@ jobs: sudo apt-get -q update sudo apt-get -y install yq - - name: Ensure stack resolvers synced - run: ls # XXX: Just testing. - # run: ./bin/ensure-stack-resolvers-synced.sh + - name: Ensure stack resolvers are synced + run: bin/ensure-stack-resolvers-are-synced.sh - name: Whatevs run: pwd diff --git a/bin/ensure-stack-resolvers-synced.sh b/bin/ensure-stack-resolvers-are-synced.sh old mode 100644 new mode 100755 similarity index 100% rename from bin/ensure-stack-resolvers-synced.sh rename to bin/ensure-stack-resolvers-are-synced.sh From 03ad8fd3a4d931faae7e2917b048a4f843696e90 Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Mon, 1 Mar 2021 01:58:30 +0100 Subject: [PATCH 16/26] Unbreak CI: Create JSON file with canonical stack resolver setting This should be moved into a separate PR, since it involves a decision to keep this string in one place rather than extract it from the exercises. This also avoids the 'yq' dependency. --- .github/workflows/tests.yml | 20 +++----------------- config/track-specific.json | 4 ++++ 2 files changed, 7 insertions(+), 17 deletions(-) create mode 100644 config/track-specific.json diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1f4c25ad7..f69c12761 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,7 +4,7 @@ on: push: branches: - main - - unbreak-ci-after-v3-merge # remove this after testing + - unbreak-ci-after-v3-merge # XXX: remove this after testing schedule: # Weekly. - cron: "0 0 * * 0" @@ -17,6 +17,7 @@ jobs: # main is needed in addition to HEAD, # because the README check only checks exercises changed since main. - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + # XXX: Temporarily disabled: #with: # ref: main @@ -27,18 +28,9 @@ jobs: - name: Ensure practice exercise descriptions are synced run: bin/ensure-practice-exercise-descriptions-are-synced.sh - - name: Install yq (for stack resolvers) - run: | - sudo add-apt-repository -y ppa:rmescandon/yq - sudo apt-get -q update - sudo apt-get -y install yq - - name: Ensure stack resolvers are synced run: bin/ensure-stack-resolvers-are-synced.sh - - name: Whatevs - run: pwd - - name: Check for invalid UUIDs # can be removed once `configlet lint` gains this ability. # Check issue https://github.com/exercism/configlet/issues/99 @@ -79,12 +71,6 @@ jobs: steps: - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - - name: Install yq (for stack resolvers) - run: | - sudo add-apt-repository -y ppa:rmescandon/yq - sudo apt-get -q update - sudo apt-get -y install yq - - name: Resolve resolver id: resolve-resolver run: | @@ -95,7 +81,7 @@ jobs: # because that would cause caches from differing LTSes to collide # (if we have updated the LTS version of all exercises between job runs). if [ "${{ matrix.resolver }}" = "lts-from-exercises" ]; then - resolver=$(yq read "$(ls -1 exercises/*/stack.yaml | head -1)" resolver) + resolver=$(jq --raw-output .resolver config/track-specific.json) else resolver=${{ matrix.resolver }} fi diff --git a/config/track-specific.json b/config/track-specific.json new file mode 100644 index 000000000..a705ce5a7 --- /dev/null +++ b/config/track-specific.json @@ -0,0 +1,4 @@ +{ + "#comment": "This file contains track-specific settings for the Haskell track.", + "resolver": "lts-16.21" +} From 7933afe80a49734377e9cc58700003f5b61fe6b8 Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Mon, 1 Mar 2021 02:02:12 +0100 Subject: [PATCH 17/26] Unbreak CI: UUIDs are now located deeper in config.json Add note wrt. concept exercises and UUIDs. --- .github/workflows/tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f69c12761..a35d514d4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -34,8 +34,9 @@ jobs: - name: Check for invalid UUIDs # can be removed once `configlet lint` gains this ability. # Check issue https://github.com/exercism/configlet/issues/99 + # XXX: Consider adding this check for concept exercises. run: | - uuids=$(jq --raw-output '.exercises | map(.uuid) | .[]' config.json) + uuids=$(jq --raw-output '.exercises.practice | map(.uuid) | .[]' config.json) bad_uuid=$(echo "$uuids" | grep -vE '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$' || true) if [ -n "$bad_uuid" ]; then echo "invalid UUIDs found! please correct these to be valid UUIDs:" From e056ada0cb7a4f5b18bd4040077021ef1e4336dd Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Fri, 12 Mar 2021 00:35:29 +0100 Subject: [PATCH 18/26] Add 'practice/' subdirectory to GitHub Actions 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 a35d514d4..be8f8b956 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -132,7 +132,7 @@ jobs: export SET_RESOLVER="--resolver ${{ matrix.resolver }}" fi - for exercise in ${{ github.workspace }}/exercises/*/; do + for exercise in ${{ github.workspace }}/exercises/practice/; do time bin/test-stub $exercise time bin/test-all-examples $exercise done From a9570a0dd0181d8f5967b6a4ae9273bfcdebdd2b Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Fri, 12 Mar 2021 07:26:01 +0100 Subject: [PATCH 19/26] Don't forget glob expansion --- .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 be8f8b956..cceddcba9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -132,7 +132,7 @@ jobs: export SET_RESOLVER="--resolver ${{ matrix.resolver }}" fi - for exercise in ${{ github.workspace }}/exercises/practice/; do + for exercise in ${{ github.workspace }}/exercises/practice/*; do time bin/test-stub $exercise time bin/test-all-examples $exercise done From 292795b2d5b940d627495215ca3a004ddecad60d Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Fri, 12 Mar 2021 09:29:44 +0100 Subject: [PATCH 20/26] Remove CI hook on this particular feature branch This was only needed while I was doing pre-PR testing. --- .github/workflows/tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cceddcba9..9948553d9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,7 +4,6 @@ on: push: branches: - main - - unbreak-ci-after-v3-merge # XXX: remove this after testing schedule: # Weekly. - cron: "0 0 * * 0" From 600f800f0bfba2143fbc68ac003f01f4c282e68e Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Fri, 12 Mar 2021 09:32:24 +0100 Subject: [PATCH 21/26] Re-enable 'with: ref: main' This was temporarily disabled, let's see if it causes trouble now. --- .github/workflows/tests.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9948553d9..c8025e9ad 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,9 +16,8 @@ jobs: # main is needed in addition to HEAD, # because the README check only checks exercises changed since main. - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - # XXX: Temporarily disabled: - #with: - # ref: main + with: + ref: main - name: Configlet Linter run: configlet lint From 5583daa0132209b5ac0fd3160bcf925a037a1355 Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Fri, 12 Mar 2021 10:22:28 +0100 Subject: [PATCH 22/26] Re-enable configlet, disable continue-on-error We may or may not want to have these problems fixed in this PR. --- .github/workflows/tests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c8025e9ad..ee3913bd3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,9 +19,11 @@ jobs: with: ref: main + - name: Fetch configlet + uses: exercism/github-actions/configlet-ci@main + - name: Configlet Linter run: configlet lint - continue-on-error: true # Issue #952: Remove this when CI has been unbroken. - name: Ensure practice exercise descriptions are synced run: bin/ensure-practice-exercise-descriptions-are-synced.sh From 90b4bed4350fecde679aa20da8fad02b47633cd1 Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Fri, 12 Mar 2021 10:33:12 +0100 Subject: [PATCH 23/26] Add single config.json tag to pass 'configlet lint' To avoid scope creep, adding the full list of tags is addressed in #939. Note that the formatting of config.json used to be maintained by ``` configlet fmt ``` which is not available in configlet-4.0.0-alpha.4 for v3 tracks. I've tried to emulate the formatting present in config.json already, but we currently do not validate formatting in the same way as we used to. --- config.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config.json b/config.json index 2093e250b..6cdddb2a9 100644 --- a/config.json +++ b/config.json @@ -1182,5 +1182,7 @@ }, "concepts": [], "key_features": [], - "tags": [] + "tags": [ + "paradigm/functional" + ] } From 7e64350382590373faac551564e80b4395df187e Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Fri, 12 Mar 2021 13:25:59 +0100 Subject: [PATCH 24/26] I think 'wifh: ref: main' is causing the wrong checkout While the purpose of this is to check out the history far enough back to compare against 'main' (formerly 'master'), it seems that we end up *on* 'main'? --- .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 ee3913bd3..ee6448f8b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,8 +16,8 @@ jobs: # main is needed in addition to HEAD, # because the README check only checks exercises changed since main. - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - with: - ref: main + # with: + # ref: main - name: Fetch configlet uses: exercism/github-actions/configlet-ci@main From 34a9e0530633db91d78bda77cb31c159998072d0 Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Fri, 12 Mar 2021 14:01:06 +0100 Subject: [PATCH 25/26] Let's see if 'with: ref: main' and 'git checkout HEAD' work together --- .github/workflows/tests.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ee6448f8b..9ef754459 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,11 +13,16 @@ jobs: name: Check track configuration runs-on: ubuntu-latest steps: - # main is needed in addition to HEAD, - # because the README check only checks exercises changed since main. + # main is needed in addition to HEAD, because the README check only + # checks exercises changed since main. Using 'ref: main' retrieves the + # least amount of history necessary to validate, but also places the + # cursor at main. - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - # with: - # ref: main + with: + ref: main + + - name: Move git checkout back to HEAD + run: git checkout HEAD - name: Fetch configlet uses: exercism/github-actions/configlet-ci@main From beac847c8f7f1ab237b15dcd46eca4ce274aea2f Mon Sep 17 00:00:00 2001 From: Simon Shine Date: Fri, 12 Mar 2021 14:06:39 +0100 Subject: [PATCH 26/26] Apparently HEAD refers to main with 'with: ref: main' Let's try with just including the entire git history, meh. --- .github/workflows/tests.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9ef754459..e7ebf5296 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,16 +13,12 @@ jobs: name: Check track configuration runs-on: ubuntu-latest steps: - # main is needed in addition to HEAD, because the README check only - # checks exercises changed since main. Using 'ref: main' retrieves the - # least amount of history necessary to validate, but also places the - # cursor at main. - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 with: - ref: main - - - name: Move git checkout back to HEAD - run: git checkout HEAD + # main is needed in addition to HEAD, because the README check only + # checks exercises changed since main. This fetches the entire repo's + # history. + fetch-depth: 0 - name: Fetch configlet uses: exercism/github-actions/configlet-ci@main