Skip to content

Commit

Permalink
[Ci]: Introduce ci which test exercises (exercism#202)
Browse files Browse the repository at this point in the history
* test-ci

* Change permissions

* Fixes

* Fixes

* Fixed filepath

* Add newline

* Delete old test files

* Remove install steps

* Fix structure
  • Loading branch information
meatball133 authored Jul 11, 2023
1 parent d4b2a3f commit c71f43d
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 14 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Tests
on:
pull_request:
push:
branches:
- main
schedule:
# Weekly.
- cron: '0 0 * * 0'

jobs:
exercises:
name: Check exercises
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- name: Install CoffeeScript
run: npm install -g jasmine-node coffeescript
- name: Run tests
run: ./bin/test-exercises.sh
9 changes: 0 additions & 9 deletions bin/run_all_tests

This file was deleted.

21 changes: 21 additions & 0 deletions bin/test-exercises.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
test_run() {
dic=$(mktemp -d)
echo "Testing $1"
source_file="$(jq -r '.files.solution[0]' $1/.meta/config.json)"
test_file="$(jq -r '.files.test[0]' $1/.meta/config.json)"
echo "source_file: ${source_file}"
cat "$1/.meta/example.coffee" > "${dic}/${source_file}"
cat "$1/${test_file}" > "${dic}/${test_file}"
sed -i -e 's/xit/it/g' ${dic}/${test_file}
jasmine-node --coffee "${dic}/${test_file}" || exit 1
}

for exercise in ./exercises/practice/*; do
test_run ${exercise}
done

if [ -d "./exercises/concept" ]; then
for exercise in ./exercises/concept/*; do
test_run ${exercise}
done
fi
5 changes: 0 additions & 5 deletions bin/test_exercise

This file was deleted.

0 comments on commit c71f43d

Please sign in to comment.