Skip to content

Fix typo in TESTS.md #1126

Fix typo in TESTS.md

Fix typo in TESTS.md #1126

Workflow file for this run

name: Tests
on:
pull_request:
push:
branches:
- main
schedule:
# Weekly.
- cron: "0 0 * * 0"
jobs:
track-config:
name: Check track configuration
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
# 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: 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: 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.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:"
echo "$bad_uuid"
exit 1
fi
exercises:
name: Check exercises
runs-on: ubuntu-22.04
strategy:
matrix:
resolver:
# We say lts-from-exercises here instead of a specific version. Reason:
# Required CI checks are designated by their name + matrix values.
#
# If we wrote lts-A.B here,
# then we'd ask an admin to make "Check exercises (lts-A.B)" required.
# But what happens when we update to lts-C.D?
# Then, an admin would need to make "Check exercises (lts-A.B)" not required,
# and "Check exercises (lts-C.D)" required.
#
# We don't want to ask for that much admin intervention.
# So we write lts-from-exercises,
# and an admin only needs to make "Check exercises (lts-from-exercises)" required.
- lts-from-exercises
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- 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: |
# We need this in two places:
# 1. cache key
# 2. --resolver arg to installing hlint
# It's unsafe to just use lts-from-exercises as the cache key,
# because that would cause caches from differing LTSes to collide
# (if we have updated the LTS version of all exercises between job runs).
resolver=$(yq eval .resolver "$(ls -1 exercises/practice/*/stack.yaml | head -1)")
echo "::set-output name=resolver::$resolver"
- name: Week number
id: week-no
run: |
# We use this to form part of the cache key.
# This will get us to periodically rebuild from scratch,
# just to make sure that everything still works from scratch.
# Because we also have a weekly build at the start of every week,
# most of the time caches should hit.
echo "::set-output name=week-no::$(date -u +%Y-%U)"
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
id: cache
with:
path: |
~/.stack
~/.foldercache
~/.local/bin/hlint
key: ${{ steps.resolve-resolver.outputs.resolver }}-${{ steps.week-no.outputs.week-no }}-${{ hashFiles('exercises/**/package.yaml') }}
restore-keys: ${{ steps.resolve-resolver.outputs.resolver }}-${{ steps.week-no.outputs.week-no }}-
- uses: haskell-actions/setup@dd344bc1cec854a369df8814ce17ef337d6e6170
with:
enable-stack: true
stack-version: "latest"
- name: Install hlint
run: |
if [ -x ${HOME}/.local/bin/hlint ]; then
echo already installed
else
stack --resolver ${{ steps.resolve-resolver.outputs.resolver }} install hlint
fi
${HOME}/.local/bin/hlint --version
- name: HLint
run: ${HOME}/.local/bin/hlint ${{ github.workspace }}
- name: Check exercises
run: |
for exercise in ${{ github.workspace }}/exercises/{concept,practice}/*; do
time bin/test-stub $exercise
time bin/test-all-examples $exercise
done