build(deps): bump actions/checkout from 4.1.0 to 4.1.4 #601
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
env: | |
NIM_VERSION: 2.0.2 | |
jobs: | |
job1: | |
name: trunner.nim | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b | |
# Our tests require Nim to be installed to `/nim` because some error messages contain | |
# e.g. `/nim/lib/pure/unittest.nim(654)`. | |
# The `jiro4989/setup-nim-action` action doesn't allow customizing the installation | |
# directory, so let's just install Nim here from the pre-built binaries. | |
- name: Install Nim | |
run: | | |
FILENAME="nim-${NIM_VERSION}-linux_x64.tar.xz" | |
curl -sSfLO --retry 5 "https://nim-lang.org/download/${FILENAME}" | |
tar xf "${FILENAME}" | |
INSTALL_DIR='/nim' | |
sudo mv "nim-${NIM_VERSION}" "${INSTALL_DIR}" | |
echo "${INSTALL_DIR}/bin" >> "${GITHUB_PATH}" | |
- name: Install tcc | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y tcc | |
- name: Install ynfle's fork of the `diff` package pinned to desired the commit | |
run: "nimble install https://github.com/ynfle/diff@#ae470e7702fd07a6ea850b2a6f2de701130fa048 -y" | |
- name: Compile and run `tests/trunner.nim` | |
run: "nim c -r --threads:off --styleCheck:error --hint[Processing]:off tests/trunner.nim" | |
job2: | |
name: Docker - build image and run | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b | |
- name: Download all `exercism/nim` exercises | |
run: git clone --depth 1 https://github.com/exercism/nim.git | |
- name: Build image | |
run: docker build -t "exercism/nim-test-runner:${NIM_VERSION}" . | |
- name: Smoke test the image (using the `bin/run.sh` production interface) | |
run: | | |
# Create a container named `ntr` from the image we built, using the | |
# `ENTRYPOINT` defined in the Dockerfule. Note that the arguments to `bin/run.sh` | |
# must come after the image name. | |
docker create --name ntr "exercism/nim-test-runner:${NIM_VERSION}" hello-world /tmp/ /tmp/out/ | |
# Copy an exercise solution and test file from the `exercism/nim` repo. | |
docker cp nim/exercises/practice/hello-world/test_hello_world.nim ntr:/tmp/ | |
docker cp nim/exercises/practice/hello-world/.meta/example.nim ntr:/tmp/hello_world.nim | |
# Start the container. The runner runs the `hello-world` test. | |
docker start -a ntr | |
# Copy the runner's JSON output from the container to the host. | |
docker cp ntr:/tmp/out/results.json results.json | |
# Remove the container. | |
docker rm ntr | |
# Write the expected output (which does not contain a newline). | |
printf '{"version":2,"status":"pass","tests":[{"name":"say hi!","status":"pass","output":"","test_code":"check hello() == \\"Hello, World!\\""}]}' \ | |
> expected_results.json | |
# Fail if the output JSON is not as expected. | |
diff results.json expected_results.json | |
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b | |
with: | |
repository: 'ynfle/diff' | |
ref: 'ae470e7702fd07a6ea850b2a6f2de701130fa048' | |
path: 'diff' | |
- name: Run tests inside container (including for exercises from `exercism/nim`) | |
run: | | |
# Create a container from the image we built, overriding the `ENTRYPOINT` | |
docker create --rm --entrypoint nim --name ntr "exercism/nim-test-runner:${NIM_VERSION}" \ | |
c --cc:tcc --threads:off -r --styleCheck:error --hint[Processing]:off --hint[CC]:off -d:repoSolutions tests/trunner.nim | |
# Copy the required files and run the tests. | |
docker cp src/runner.nim ntr:/opt/test-runner/src/ | |
docker cp tests/ ntr:/opt/test-runner/tests/ | |
docker cp diff/src/diff.nim ntr:/opt/test-runner/tests/diff.nim | |
docker cp nim/ ntr:/tmp/exercism-nim/ | |
docker start -a ntr |