Skip to content

Add stub file telling student to define a struct (#656) #613

Add stub file telling student to define a struct (#656)

Add stub file telling student to define a struct (#656) #613

name: Exercise CI
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "exercises/**"
- "runtests.jl"
- ".github/workflows/exercise-tests.yml"
pull_request:
paths:
- "exercises/**"
- "runtests.jl"
- ".github/workflows/exercise-tests.yml"
jobs:
test:
name: Julia ${{ matrix.julia-version }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
julia-version: ["1.6", "1", nightly]
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- uses: julia-actions/setup-julia@f40c4b69330df1d22e7590c12e76dc2f9c66e0bc
with:
version: ${{ matrix.julia-version }}
- uses: julia-actions/cache@569d290d51d6c22c1cd4ceec591a1bf112aab9c0
- name: Install test dependencies
run: julia --color=yes --project -e "using Pkg; Pkg.instantiate()"
- name: Test exercises
run: julia --color=yes --project runtests.jl
test-runner:
name: Julia Test Runner
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- name: Pull julia-test-runner image
run: docker pull exercism/julia-test-runner
- name: Install Julia dependencies
run: julia --color=yes --project -e "using Pkg; Pkg.instantiate()"
- name: Generate test reports using julia-test-runner
id: generate-reports
run: julia --color=yes --project runtestrunner.jl
- name: Upload reports as artifact
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
with:
name: test-reports
path: ${{ steps.generate-reports.outputs.results-path }}
- name: Check if all tests passed
run: |
using JSON
any_errors = false
for report in readdir(ENV["RESULTS"])
result = JSON.parsefile(joinpath(ENV["RESULTS"], report))
if result["status"] != "pass"
global any_errors = true
@error "Exercise failed tests" report
run(`jq -C '.' $(joinpath(ENV["RESULTS"], report))`)
end
end
any_errors && exit(1)
env:
RESULTS: ${{ steps.generate-reports.outputs.results-path }}
shell: julia --color=yes --project {0}