Bump actions/checkout from 4.1.4 to 4.1.5 #267
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: | |
branches: | |
- main | |
- master | |
pull_request: | |
jobs: | |
test: | |
name: Automated tests | |
runs-on: ubuntu-22.04 | |
# Change this to add or remove tests | |
env: | |
TESTS: all_passing,all_passing_with_debugging,everything_at_once,one_fail,one_passing,truncated_output,grains,complex-numbers,test_logs,using_stdlib | |
JULIA_NUM_THREADS: 2 | |
steps: | |
- name: Disable GHA commands | |
run: echo "::stop-commands::`cat /dev/urandom | base64 | head -c 64`" | |
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b | |
- name: Build image | |
run: docker build -t jtr-img . | |
- name: Run test runners | |
shell: julia --color=yes --project {0} | |
run: | | |
const tests = split(ENV["TESTS"], ",") | |
@info "The following tests will be run:\n - $(join(tests, "\n - "))" | |
mkdir("results") | |
Threads.@threads for test in tests | |
@info "Running test: $test..." | |
# Create container | |
run(`docker create --name jtr-$test jtr-img irrelevant /tmp/ /tmp/`) | |
# Copy test file(s) to container | |
run(`docker cp "test/fixtures/$test/runtests.jl" jtr-$test:/tmp/`) | |
isfile("test/fixtures/$test/$test.jl") && | |
run(`docker cp "test/fixtures/$test/$test.jl" jtr-$test:/tmp/`) | |
# Start container to run the test runner | |
run(`docker start -a jtr-$test`) | |
# Copy result back to host | |
run(`docker cp jtr-$test:/tmp/results.json "results/$test.json"`) | |
end | |
- name: Install Julia dependencies for comparing results | |
run: julia --project --color=yes -e "using Pkg; Pkg.instantiate()" | |
- name: Compare created and expected results.json | |
shell: julia --color=yes --project {0} | |
run: | | |
using JSON | |
using Test | |
const tests = split(ENV["TESTS"], ",") | |
# Shorten the error messages so we don't need to care about specific paths, file numbers, etc. | |
function shorten_messages!(result) | |
if result["status"] == "error" && haskey(result, "message") | |
result["message"] = split(result["message"], '\n')[1] | |
end | |
end | |
@testset "Compare results.json files" begin | |
@testset "$test" for test in tests | |
expected = JSON.parsefile(joinpath("test", "fixtures", "$test", "expected_results.json")) | |
created = JSON.parsefile(joinpath("results", "$test.json")) | |
shorten_messages!(expected) | |
shorten_messages!(created) | |
foreach(shorten_messages!, expected["tests"]) | |
foreach(shorten_messages!, created["tests"]) | |
@test expected == created | |
end | |
end |