-
Notifications
You must be signed in to change notification settings - Fork 5
142 lines (139 loc) · 4.99 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
test:
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} - Julia ${{ matrix.version }} - ${{ github.event_name }}
strategy:
fail-fast: false
matrix:
version:
- '1'
- '1.6'
os:
- ubuntu-latest
include:
- version: '1'
os: macOS-latest
# Do not run tests on Windows since they often result in weird
# Python errors, e.g.,
# `AttributeError: module 'brotli' has no attribute 'error'`
# in https://github.com/ranocha/BSeries.jl/pull/145
# - version: '1'
# os: windows-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
env:
PYTHON: ""
- name: Fix weird Conda.jl/PyCall.jl/SymPy.jl build error
env:
PYTHON: ""
shell: julia --color=yes {0}
run: |
using Pkg
Pkg.activate("test")
println("Try instantiating the test environment")
try
Pkg.instantiate()
println("Successfully instantiated the test environment")
catch e
display(e)
end
println("Try building SymPy")
try
Pkg.build("SymPy")
import SymPy
println("Successfully built SymPy")
catch e
display(e)
end
- uses: julia-actions/julia-runtest@v1
env:
PYTHON: ""
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v5
with:
file: lcov.info
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
# The standard setup of Coveralls is just annoying for parallel builds, see, e.g.,
# https://github.com/trixi-framework/Trixi.jl/issues/691
# https://github.com/coverallsapp/github-action/issues/47
# https://github.com/coverallsapp/github-action/issues/67
# This standard setup is reproduced below for completeness.
# - uses: coverallsapp/github-action@master
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# flag-name: run-${{ matrix.version }}-${{ github.run_id }}
# parallel: true
# path-to-lcov: ./lcov.info
# Instead, we use a more tedious approach:
# - Store all individual coverage files as artifacts (directly below)
# - Download and merge individual coverage reports in another step
# - Upload only the merged coverage report to Coveralls
- shell: bash
run: |
cp ./lcov.info ./lcov-${{ matrix.os }}-${{ matrix.version }}-${{ github.run_id }}.info
- uses: actions/upload-artifact@v4
with:
name: lcov-${{ matrix.os }}-${{ matrix.version }}-${{ github.run_id }}
path: ./lcov-${{ matrix.os }}-${{ matrix.version }}-${{ github.run_id }}.info
finish:
needs: test
runs-on: ubuntu-latest
steps:
# The standard setup of Coveralls is just annoying for parallel builds, see, e.g.,
# https://github.com/trixi-framework/Trixi.jl/issues/691
# https://github.com/coverallsapp/github-action/issues/47
# https://github.com/coverallsapp/github-action/issues/67
# This standard setup is reproduced below for completeness.
# - name: Coveralls Finished
# uses: coverallsapp/github-action@master
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# parallel-finished: true
# Instead, we use the more tedious approach described above.
# At first, we check out the repository and download all artifacts
# (and list files for debugging).
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- run: ls -R
# Next, we merge the individual coverage files and upload
# the combined results to Coveralls.
- name: Merge lcov files using Coverage.jl
shell: julia --color=yes {0}
run: |
using Pkg
Pkg.activate(temp=true)
Pkg.add("Coverage")
using Coverage
coverage = LCOV.readfolder(".")
for cov in coverage
cov.filename = replace(cov.filename, "\\" => "/")
end
filter!(c -> basename(c.filename) != "precompile.jl", coverage)
coverage = merge_coverage_counts(coverage)
@show covered_lines, total_lines = get_summary(coverage)
LCOV.writefile("./lcov.info", coverage)
- uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./lcov.info
# Upload merged coverage data as artifact for debugging
- uses: actions/upload-artifact@v4
with:
name: lcov
path: ./lcov.info
# That's it
- run: echo "Finished testing BSeries"