Skip to content

Commit 9cc63f8

Browse files
authored
Run tests with code coverage enabled, and upload coverage to Codecov (attempt 2) (#42)
Replaces #41 (closes #41). --- Alright, Codecov is finally working. Looks like we have 89% line coverage currently. We can work on getting that up to 100% in future PRs. To see the code coverage, go to this URL: https://app.codecov.io/gh/JuliaParallel/SlurmClusterManager.jl/pull/42/tree You will probably need to log into Codecov using your GitHub account.
1 parent b0891a2 commit 9cc63f8

File tree

5 files changed

+44
-4
lines changed

5 files changed

+44
-4
lines changed

Diff for: .github/workflows/ci.yml

+15-1
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,18 @@ 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+
- name: Copy .cov files out of the Docker container
50+
run: docker exec slurmctld /bin/bash -c 'cd /home/docker/SlurmClusterManager && tar -cf - src/*.cov' | tar -xvf -
51+
- run: find . -type f -name '*.cov'
52+
# - run: find . -type f -name '*.cov' -exec cat {} \;
53+
- uses: julia-actions/julia-processcoverage@v1
54+
- uses: codecov/codecov-action@v5
55+
with:
56+
files: lcov.info
57+
token: ${{ secrets.CODECOV_TOKEN }}
58+
# If this PR is from a fork, then do NOT fail CI if the Codecov upload errors.
59+
# If this PR is NOT from a fork, then DO fail CI if the Codecov upload errors.
60+
# If this is not a PR, then DO fail CI if the Codecov upload errors.
61+
fail_ci_if_error: ${{ github.event_name != 'pull_request' || github.repository == github.event.pull_request.head.repo.full_name }}

Diff for: 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'

Diff for: 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

Diff for: 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

Diff for: 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)