Skip to content

Commit 3189117

Browse files
committed
Run tests with code coverage enabled, and upload coverage to Codecov (attempt 2)
1 parent c7d03e7 commit 3189117

File tree

5 files changed

+43
-4
lines changed

5 files changed

+43
-4
lines changed

.github/workflows/ci.yml

+14-1
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,17 @@ jobs:
4444
docker exec -t slurmctld srun -n 4 hostname
4545
- name: Test SlurmClusterManager
4646
run: |
47-
docker exec -t slurmctld julia -e 'import Pkg; Pkg.activate("SlurmClusterManager"); Pkg.test()'
47+
docker exec -t slurmctld /home/docker/SlurmClusterManager/ci/ci_entrypoint.bash
48+
- run: find . -type f -name '*.cov'
49+
- run: docker exec slurmctld /bin/bash -c 'cd /home/docker/SlurmClusterManager && tar -cf - src/*.cov' | tar -xvf -
50+
- run: find . -type f -name '*.cov'
51+
# - run: find . -type f -name '*.cov' -exec cat {} \;
52+
- uses: julia-actions/julia-processcoverage@v1
53+
- uses: codecov/codecov-action@v5
54+
with:
55+
files: lcov.info
56+
token: ${{ secrets.CODECOV_TOKEN }}
57+
# If this PR is from a fork, then do NOT fail CI if the Codecov upload errors.
58+
# If this PR is NOT from a fork, then DO fail CI if the Codecov upload errors.
59+
# If this is not a PR, then DO fail CI if the Codecov upload errors.
60+
fail_ci_if_error: ${{ github.event_name != 'pull_request' || github.repository == github.event.pull_request.head.repo.full_name }}

ci/ci_entrypoint.bash

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
3+
set -euf -o pipefail
4+
5+
set -x
6+
7+
pwd
8+
9+
ls -la .
10+
11+
ls -la ./SlurmClusterManager
12+
13+
julia --project=./SlurmClusterManager -e 'import Pkg; Pkg.instantiate()'
14+
15+
julia --project=./SlurmClusterManager -e 'import Pkg; Pkg.status()'
16+
17+
julia --project=./SlurmClusterManager -e 'import Pkg; Pkg.test(; coverage=true)'
18+
19+
find . -type f -name '*.cov'

test/runtests.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ end
2424
project_path = abspath(joinpath(@__DIR__, ".."))
2525
@info "" project_path
2626
jobid = withenv("JULIA_PROJECT"=>project_path) do
27-
strip(read(`sbatch --export=ALL --parsable -n 4 -o test.out script.jl`, String))
27+
strip(read(`sbatch --export=ALL --parsable -n 4 -o test.out script.bash`, String))
2828
end
2929
@info "" jobid
3030

test/script.bash

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
set -euf -o pipefail
4+
5+
set -x
6+
7+
pwd
8+
9+
julia --code-coverage=user script.jl

test/script.jl

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/usr/bin/env julia
2-
31
# We don't use `using Foo` here.
42
# We either use `using Foo: hello, world`, or we use `import Foo`.
53
# https://github.com/JuliaLang/julia/pull/42080

0 commit comments

Comments
 (0)