-
Notifications
You must be signed in to change notification settings - Fork 59
150 lines (139 loc) · 4.69 KB
/
CI.yml
File metadata and controls
150 lines (139 loc) · 4.69 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
name: CI
on:
push:
branches:
- 'main'
- 'release-'
tags: '*'
paths-ignore:
- 'docs/**'
pull_request:
types: [opened, synchronize, reopened, ready_for_review, converted_to_draft]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# Cancel intermediate builds: only if it is a pull request build.
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
jobs:
setup-matrix:
runs-on: ubuntu-latest
outputs:
groups: ${{ steps.mk.outputs.groups }}
version: ${{ steps.mk.outputs.version }}
os: ${{ steps.mk.outputs.os }}
steps:
- uses: actions/checkout@v6
- id: mk
shell: bash
run: |
# Auto-discover test groups from all subdirectory names.
groups=$(find test -mindepth 1 -maxdepth 1 -type d \
| xargs -I{} basename {} | sort \
| jq -R -s -c '[split("\n")[] | select(length > 0)]')
echo "groups=${groups}" >> "$GITHUB_OUTPUT"
# Draft PR: only run ubuntu-latest + version=1
if [[ "${{ github.event_name }}" == "pull_request" && "${{ github.event.pull_request.draft }}" == "true" ]]; then
echo 'version=["1"]' >> "$GITHUB_OUTPUT"
echo 'os=["ubuntu-latest"]' >> "$GITHUB_OUTPUT"
else
echo 'version=["lts","1"]' >> "$GITHUB_OUTPUT"
echo 'os=["ubuntu-latest","macOS-latest","windows-latest"]' >> "$GITHUB_OUTPUT"
fi
test:
name: "Tests (${{ matrix.group }}, ${{ matrix.os }}, Julia ${{ matrix.version }})"
needs: setup-matrix
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.setup-matrix.outputs.version) }}
os: ${{ fromJSON(needs.setup-matrix.outputs.os) }}
group: ${{ fromJSON(needs.setup-matrix.outputs.groups) }}
runs-on: ${{ matrix.os }}
timeout-minutes: 120
steps:
- uses: actions/checkout@v6
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
- uses: julia-actions/cache@v3
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
with:
test_args: '${{ matrix.group }}${{ github.event.pull_request.draft == true && '' --fast'' || '''' }}'
env:
JULIA_NUM_THREADS: "4"
- uses: julia-actions/julia-processcoverage@v1
with:
directories: 'src,ext'
- uses: codecov/codecov-action@v6
with:
files: lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
test-nightly:
name: "Tests (${{ matrix.group }}, ${{ matrix.os }}, Julia nightly)"
needs: [setup-matrix, test]
if: github.event.pull_request.draft != true
strategy:
fail-fast: false
matrix:
version:
- 'nightly'
group: ${{ fromJSON(needs.setup-matrix.outputs.groups) }}
os:
- ubuntu-latest
- macOS-latest
- windows-latest
runs-on: ${{ matrix.os }}
timeout-minutes: 120
steps:
- uses: actions/checkout@v6
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
- uses: julia-actions/cache@v3
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
with:
test_args: '${{ matrix.group }}'
CI:
name: "CI Summary"
needs: [test, compatcheck]
if: always()
runs-on: ubuntu-latest
steps:
- name: Check test jobs
run: |
if [[ "${{ needs.test.result }}" != "success" ]]; then
echo "Tests failed: ${{ needs.test.result }}"
exit 1
fi
echo "Tests passed."
- name: Report compat check
run: |
echo "Compat check result: ${{ needs.compatcheck.result }}"
continue-on-error: true
compatcheck:
name: "Compat (${{ matrix.group }}, Julia ${{ matrix.julia-version }})"
needs: [setup-matrix, test]
if: github.event.pull_request.draft != true
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
downgrade_mode: ['deps']
group: ${{ fromJSON(needs.setup-matrix.outputs.groups) }}
julia-version: ['1', '1.10']
steps:
- uses: actions/checkout@v6
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.julia-version }}
- uses: julia-actions/cache@v3
- uses: julia-actions/julia-downgrade-compat@v2
with:
mode: ${{ matrix.downgrade_mode }}
skip: Random, LinearAlgebra, Test, Combinatorics
julia_version: ${{ matrix.julia-version }}
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1