Skip to content

Run tests with code coverage enabled, and upload coverage to Codecov (attempt 2) #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
19 changes: 19 additions & 0 deletions ci/ci_entrypoint.bash
Original file line number Diff line number Diff line change
@@ -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'
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 9 additions & 0 deletions test/script.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

set -euf -o pipefail

set -x

pwd

julia --code-coverage=user script.jl
2 changes: 0 additions & 2 deletions test/script.jl
Original file line number Diff line number Diff line change
@@ -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
Expand Down