Skip to content

Commit

Permalink
Add draft test CI
Browse files Browse the repository at this point in the history
  • Loading branch information
BNAndras committed Feb 18, 2024
1 parent dd47682 commit 1ef5d39
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 42 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This workflow will do a clean install of the dependencies and run tests across different versions
#
# Replace <track> with the track name
# Replace <image-name> with an image to run the jobs on
# Replace <action to setup tooling> with a github action to setup tooling on the image
# Replace <install dependencies> 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
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

22 changes: 0 additions & 22 deletions appveyor.yml

This file was deleted.

39 changes: 39 additions & 0 deletions bin/verify-exercises
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1ef5d39

Please sign in to comment.