From 1ef5d395b320663ac0e62cbdaa60c59287e18fcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A1s=20B=20Nagy?= <20251272+BNAndras@users.noreply.github.com> Date: Sat, 17 Feb 2024 23:33:05 -0800 Subject: [PATCH] Add draft test CI --- .github/workflows/test.yml | 35 ++++++++++++++++++++++++++++++++++ .travis.yml | 20 ------------------- appveyor.yml | 22 --------------------- bin/verify-exercises | 39 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 74 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml delete mode 100644 appveyor.yml create mode 100755 bin/verify-exercises diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..7a2da046 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,35 @@ +# This workflow will do a clean install of the dependencies and run tests across different versions +# +# Replace with the track name +# Replace with an image to run the jobs on +# Replace with a github action to setup tooling on the image +# Replace with a cli command to install the dependencies +# +# Find Github Actions to setup tooling here: +# - https://github.com/actions/?q=setup&type=&language= +# - https://github.com/actions/starter-workflows/tree/main/ci +# - https://github.com/marketplace?type=actions&query=setup +# +# Requires scripts: +# - bin/verify-exercises + +name: Verify Exercises + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +jobs: + ci: + runs-on: ubuntu-22.04 + container: + image: exercism/lfe-test-runner + + steps: + - name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + + - name: Verify all exercises + run: bin/verify-exercises diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d6ef1a5f..00000000 --- a/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -language: erlang -install: true -before_script: -- wget https://s3.amazonaws.com/rebar3/rebar3 -- chmod +x rebar3 -env: PATH=$PATH:. -script: -- bin/fetch-configlet -- bin/configlet lint . -- make test -cache: -- apt -otp_release: -- 19.0 -- 18.3 -- 18.2 -- 18.0 -- 17.5 -- 17.4 diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index df6c11e9..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: 1.0.{build} -install: -- cmd: >- - git clone -q https://github.com/rebar/rebar3.git %APPVEYOR_BUILD_FOLDER%\bin\rebar3 - - cd %APPVEYOR_BUILD_FOLDER%\bin\rebar3 - - .\bootstrap.bat - - cd %APPVEYOR_BUILD_FOLDER% - - curl -fsSL -o configlet.zip https://github.com/exercism/configlet/releases/download/v1.0.6/configlet-windows-32bit.zip - - 7z e configlet.zip - - .\configlet.exe . -build: off -test_script: -- cmd: >- - cd %APPVEYOR_BUILD_FOLDER% - - %APPVEYOR_BUILD_FOLDER%\bin\rebar3\rebar3.cmd eunit -m accumulate-tests,allergies-tests,anagram-tests,atbash-cipher-tests,bank-account-tests,beer-song-tests,binary-string-tests,bob-tests,circular-buffer-tests,clock-tests,difference-of-squares-tests,etl-tests,gigasecond-tests,grade-school-tests,grains-tests,hamming-tests,largest-series-product-tests,leap-tests,luhn-tests,meetup-tests,dna-tests,parallel-letter-frequency-tests,phone-tests,rna-transcription-tests,robot-simulator-tests,series-tests,space-age-tests,strain-tests,sum-of-multiples-tests,trinary-tests,word-count-tests diff --git a/bin/verify-exercises b/bin/verify-exercises new file mode 100755 index 00000000..47e8686d --- /dev/null +++ b/bin/verify-exercises @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +temp_dir_base=$(mktemp -d) + +run_test() { + slug=$(basename $1) + temp_dir=${temp_dir_base}/${slug} + mkdir -p ${temp_dir} + + cp -r "$1/." $temp_dir + cp $temp_dir/.meta/example.lfe $temp_dir/src/$slug.lfe + + (cd /opt/test-runner && bin/run.sh $slug $temp_dir $temp_dir) || exit 1 + + test_status="$(jq -r '.status' $temp_dir/results.json)" + + if [ "$test_status" != "pass" ]; then + echo "Tests for $slug have failed:" + cat $temp_dir/results.json + exit 1 + fi +} + + + +for concept_exercise_dir in ./exercises/concept/*/; do + if [ -d $concept_exercise_dir ]; then + echo "Checking $(basename "${concept_exercise_dir}") exercise..." + run_test $concept_exercise_dir + fi +done + +# Verify the Practice Exercises +for practice_exercise_dir in ./exercises/practice/*/; do + if [ -d $practice_exercise_dir ]; then + echo "Checking $(basename "${practice_exercise_dir}") exercise..." + run_test $practice_exercise_dir + fi +done \ No newline at end of file