-
Notifications
You must be signed in to change notification settings - Fork 18
162 lines (150 loc) · 5.12 KB
/
CI.yml
File metadata and controls
162 lines (150 loc) · 5.12 KB
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: CI
on:
push:
branches:
- '*'
paths:
- 'test/**'
- 'src/**'
- 'benchmark/**'
- '.github/workflows/**'
- 'Project.toml'
pull_request:
paths:
- 'test/**'
- 'src/**'
- 'benchmark/**'
- '.github/workflows/**'
- 'Project.toml'
jobs:
test:
name: Julia ${{ matrix.julia-version }} - ${{ matrix.os }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
julia-version:
- '1'
os:
- ubuntu-latest
- windows-latest
- macOS-latest
include:
- os: ubuntu-latest
julia-version: '1.10'
steps:
- uses: actions/checkout@v4
- name: "Set up Julia"
uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.julia-version }}
- name: "Cache artifacts"
uses: julia-actions/cache@v2
- name: "Build package"
uses: julia-actions/julia-buildpkg@v1
- name: "Run tests"
run: |
julia --color=yes -e 'import Pkg; Pkg.add("Coverage")'
julia --color=yes --threads=auto --check-bounds=yes --depwarn=yes --code-coverage=user -e 'import Coverage; import Pkg; Pkg.activate("."); Pkg.test(coverage=true)'
julia --color=yes coverage.jl
shell: bash
- name: Upload coverage artifact
if: success()
uses: actions/upload-artifact@v6
with:
name: coverage-${{ matrix.os }}-julia-${{ matrix.julia-version }}
path: lcov.info
additional_tests:
name: test ${{ matrix.test_name }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
os:
- "ubuntu-latest"
julia-version:
- "1"
test_name:
# - "enzyme" # flaky; seems to infinitely compile and fail the CI
- "jet"
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.julia-version }}
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- name: Run tests
id: run-tests
continue-on-error: ${{ matrix.test_name == 'enzyme' }}
run: |
julia --color=yes -e 'import Pkg; Pkg.add("Coverage")'
SR_TEST=${{ matrix.test_name }} julia --color=yes --threads=auto --check-bounds=yes --depwarn=yes --code-coverage=user -e 'import Coverage; import Pkg; Pkg.activate("."); Pkg.test(coverage=true)'
julia --color=yes coverage.jl
shell: bash
- name: Upload coverage artifact
if: steps.run-tests.outcome == 'success'
uses: actions/upload-artifact@v6
with:
name: coverage-${{ matrix.test_name }}-${{ matrix.os }}-julia-${{ matrix.julia-version }}
path: lcov.info
optim_v1_smoketest:
name: Optim v1 (NLSolversBase v7) - ubuntu-latest
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- name: Pin Optim v1 + NLSolversBase v7
run: |
julia --color=yes -e 'import Pkg; Pkg.add("Coverage")'
julia --color=yes -e 'import Pkg; Pkg.activate("."); Pkg.add(Pkg.PackageSpec(name="Optim", version="1")); Pkg.add(Pkg.PackageSpec(name="NLSolversBase", version="7")); Pkg.status(["Optim", "NLSolversBase"])'
shell: bash
- name: Run Optim tests (with coverage)
id: run-tests
run: |
SR_TEST=optim julia --color=yes --threads=auto --check-bounds=yes --depwarn=yes --code-coverage=user -e 'import Coverage; import Pkg; Pkg.activate("."); Pkg.test(coverage=true)'
julia --color=yes coverage.jl
shell: bash
- name: Upload coverage artifact
if: steps.run-tests.outcome == 'success'
uses: actions/upload-artifact@v6
with:
name: coverage-optim-v1-${{ runner.os }}-julia-1
path: lcov.info
codecov:
name: Upload combined coverage to Codecov
runs-on: ubuntu-latest
needs:
- test
- additional_tests
- optim_v1_smoketest
steps:
# Codecov uploader expects a git checkout (commit metadata + repo root)
- uses: actions/checkout@v4
- name: Download coverage artifacts
uses: actions/download-artifact@v7
with:
pattern: coverage-*
path: coverage
- name: Merge lcov files
run: |
set -euxo pipefail
cd coverage
find . -name 'lcov.info' -print
cat $(find . -name 'lcov.info' -print | sort) > merged-lcov.info
# Normalize Windows path separators so Codecov can match sources.
sed -i -e '/^SF:/ s#\\\\#/#g' merged-lcov.info
wc -l merged-lcov.info
- name: Upload to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/merged-lcov.info
disable_search: true