diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8c925c..3dddbfd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,4 +44,18 @@ jobs: docker exec -t slurmctld srun -n 4 hostname - name: Test SlurmClusterManager run: | - docker exec -t slurmctld julia -e 'import Pkg; Pkg.activate("SlurmClusterManager"); Pkg.test()' + docker exec -t slurmctld /home/docker/SlurmClusterManager/ci/ci_entrypoint.bash + - run: find . -type f -name '*.cov' + - name: Copy .cov files out of the Docker container + run: docker exec slurmctld /bin/bash -c 'cd /home/docker/SlurmClusterManager && tar -cf - src/*.cov' | tar -xvf - + - run: find . -type f -name '*.cov' + # - run: find . -type f -name '*.cov' -exec cat {} \; + - uses: julia-actions/julia-processcoverage@v1 + - uses: codecov/codecov-action@v5 + with: + files: lcov.info + token: ${{ secrets.CODECOV_TOKEN }} + # If this PR is from a fork, then do NOT fail CI if the Codecov upload errors. + # If this PR is NOT from a fork, then DO fail CI if the Codecov upload errors. + # If this is not a PR, then DO fail CI if the Codecov upload errors. + fail_ci_if_error: ${{ github.event_name != 'pull_request' || github.repository == github.event.pull_request.head.repo.full_name }} diff --git a/ci/ci_entrypoint.bash b/ci/ci_entrypoint.bash new file mode 100755 index 0000000..44ed677 --- /dev/null +++ b/ci/ci_entrypoint.bash @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -euf -o pipefail + +set -x + +pwd + +ls -la . + +ls -la ./SlurmClusterManager + +julia --project=./SlurmClusterManager -e 'import Pkg; Pkg.instantiate()' + +julia --project=./SlurmClusterManager -e 'import Pkg; Pkg.status()' + +julia --project=./SlurmClusterManager -e 'import Pkg; Pkg.test(; coverage=true)' + +find . -type f -name '*.cov' diff --git a/test/runtests.jl b/test/runtests.jl index ad357e6..8772e5b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -24,7 +24,7 @@ end project_path = abspath(joinpath(@__DIR__, "..")) @info "" project_path jobid = withenv("JULIA_PROJECT"=>project_path) do - strip(read(`sbatch --export=ALL --parsable -n 4 -o test.out script.jl`, String)) + strip(read(`sbatch --export=ALL --parsable -n 4 -o test.out script.bash`, String)) end @info "" jobid diff --git a/test/script.bash b/test/script.bash new file mode 100755 index 0000000..c1b0289 --- /dev/null +++ b/test/script.bash @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -euf -o pipefail + +set -x + +pwd + +julia --code-coverage=user script.jl diff --git a/test/script.jl b/test/script.jl index f218f9f..68e6076 100644 --- a/test/script.jl +++ b/test/script.jl @@ -1,5 +1,3 @@ -#!/usr/bin/env julia - # We don't use `using Foo` here. # We either use `using Foo: hello, world`, or we use `import Foo`. # https://github.com/JuliaLang/julia/pull/42080