Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add draft test CI #195

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading