Repository navigation
187 lines (166 loc) · 6.44 KB
/
Copy pathci.yml
File metadata and controls
187 lines (166 loc) · 6.44 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
name: CI
on:
push:
branches: [main]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
# One job per compiler, each with nothing installed but that compiler and
# fpm. `fpm test` builds the package, writes every test plot and checks it
# against tests/fingerprints.txt.
#
# The compilers come from setup-fortran rather than from pixi, so each is
# the latest the action offers rather than the latest conda-forge has. The
# pixi environments stay for building the same thing by hand.
test:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
strategy:
# Every compiler is a gate, so report all four instead of stopping at
# the first one that breaks.
fail-fast: false
matrix:
include:
# opt is a second run with fused multiply-add allowed: the rounding
# then differs from the plain build, and the pictures must not.
- name: GFortran
compiler: gfortran
args: ""
opt: "--flag '-O3 -march=native'"
- name: Flang
compiler: flang
args: ""
opt: "--flag '-O3 -march=native'"
# ifx reassociates by default, which is more than -O3 asks of the
# others: it turns a linspace into a running sum, so the last point
# of 2*pi*i/(n-1) and the exactly-zero column of a contour grid move
# by a few ulps and a sign test lands the other way.
# -fp-model precise holds it to the same standard as the rest; that
# is the spelling fpm itself uses for Intel on Unix (/fp:precise on
# Windows).
# Note that --flag replaces fpm's profile flags rather than adding
# to them, so the optimisation level is spelled out here.
- name: ifx
compiler: ifx
args: "--flag '-O2 -fp-model precise'"
opt: "--flag '-O3 -march=native -fp-model precise'"
- name: LFortran
compiler: lfortran
args: ""
opt: ""
steps:
- uses: actions/checkout@v4
- name: Set up ${{ matrix.compiler }}
id: fortran
uses: fortran-lang/setup-fortran@v2.0.0-beta.13
with:
compiler: ${{ matrix.compiler }}
version: latest
- uses: fortran-lang/setup-fpm@v10
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Test
run: fpm test --compiler ${{ steps.fortran.outputs.fc }} ${{ matrix.args }}
- name: Test with -O3 -march=native
if: matrix.opt
run: fpm test --compiler ${{ steps.fortran.outputs.fc }} ${{ matrix.opt }}
# The same flags as the first run, so this reuses that build.
- name: Demo
run: fpm run --example demo --compiler ${{ steps.fortran.outputs.fc }} ${{ matrix.args }}
# The pictures, to look at when a fingerprint or a comparison fails.
- name: Upload the test pictures
if: failure()
uses: actions/upload-artifact@v4
with:
name: tests-out-${{ matrix.compiler }}
path: tests/out/
# The pictures of the flang build against matplotlib's. The first step makes
# the references and the pictures; the comparisons after it reuse both.
# This one stays on pixi, which is where matplotlib and the rasterizers are.
matplotlib:
name: Matplotlib comparison (Flang)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: prefix-dev/setup-pixi@v0.10.1
with:
pixi-version: v0.76.1
cache: true
locked: true
environments: matplotlib
- name: Matplotlib references and flang pictures
run: pixi run mpl-refs && pixi run test-outputs
- name: Compare SVG
run: pixi run compare
- name: Compare PNG
run: pixi run compare-png
- name: Compare PDF
run: pixi run compare-pdf
- name: Compare EPS
run: pixi run compare-eps
- name: Compare GIF
run: pixi run compare-gif
# The pictures, to look at when a fingerprint or a comparison fails.
- name: Upload the test pictures
if: failure()
uses: actions/upload-artifact@v4
with:
name: tests-out-matplotlib
path: tests/out/
# The tests again under AddressSanitizer and UndefinedBehaviorSanitizer,
# stopping at the first report. float-cast-overflow is named because
# GCC's -fsanitize=undefined leaves it out, and a real too large for an
# integer is the error far-off data is most likely to find.
sanitizers:
name: Sanitizers (GFortran)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up gfortran
id: fortran
uses: fortran-lang/setup-fortran@v2.0.0-beta.13
with:
compiler: gfortran
version: latest
- uses: fortran-lang/setup-fpm@v10
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Test with sanitizers
env:
ASAN_OPTIONS: detect_leaks=0
UBSAN_OPTIONS: print_stacktrace=1
run: >
fpm test --compiler ${{ steps.fortran.outputs.fc }}
--flag '-O1 -g -fsanitize=address,undefined,float-cast-overflow -fno-sanitize-recover=all'
# The argument checks at the top of the plotting procedures are written
# by tools/gen_arg_checks.py from one table; this fails if a procedure
# was added or changed without running it.
arg-checks:
name: Argument checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Regenerate the argument checks
run: python3 tools/gen_arg_checks.py
- name: Check that nothing changed
run: git diff --exit-code src/fplotlib.f90
# Human-only commit authorship: no AI author, committer, or Co-Authored-By
# stamp. Same checker as LFortran's Quick checks. AI tools may help write
# the code; a human still has to be the one who submits and guarantees it.
# Legitimate human co-authors are left alone. The script compares
# origin/main..HEAD, so it needs the base branch and the whole PR history.
authorship:
name: AI commit authorship
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check the authorship patterns
run: python3 check_ai_commit_authorship.py --self-test
- name: Check for AI commit authorship
run: python3 check_ai_commit_authorship.py