Pkg add Coverage #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: ['*'] | |
pull_request: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} | |
jobs: | |
test: | |
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
version: | |
- '1.9' | |
os: | |
- ubuntu-latest | |
arch: | |
- x64 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: julia-actions/setup-julia@v1 | |
with: | |
version: ${{ matrix.version }} | |
arch: ${{ matrix.arch }} | |
- name: Cache Julia packages | |
uses: actions/cache@v2 | |
with: | |
path: ~/.julia | |
key: ${{ runner.os }}-julia-${{ matrix.version }}-${{ hashFiles('**/Project.toml', '**/Manifest.toml') }} | |
restore-keys: | | |
${{ runner.os }}-julia-${{ matrix.version }}- | |
${{ runner.os }}-julia- | |
- name: Install Xvfb | |
run: sudo apt-get install -y xvfb | |
- name: Create script for tests with Xvfb | |
run: | | |
echo '#!/bin/bash' > run_tests.sh | |
echo 'export JULIA_PKG_SERVER=""' >> run_tests.sh | |
echo 'export JULIA_NUM_THREADS=1' >> run_tests.sh | |
echo 'julia --project --code-coverage=user -e "using Pkg; Pkg.test()"' >> run_tests.sh | |
chmod +x run_tests.sh | |
- name: Install Coverage.jl | |
run: julia --project -e 'using Pkg; Pkg.add("Coverage")' | |
- name: Run tests with Xvfb | |
run: xvfb-run --auto-servernum --server-args="-screen 0 1024x768x24" ./run_tests.sh | |
- name: Process coverage with Coverage.jl | |
run: julia --project -e 'using Coverage; LCOV.writefile("lcov.info", process_folder())' | |
- uses: codecov/codecov-action@v3 | |
with: | |
files: lcov.info |