Repository navigation
120 lines (110 loc) · 4.12 KB
/
Copy pathci.yml
File metadata and controls
120 lines (110 loc) · 4.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
name: CI
# Checks the workspace on every push to master and every pull request, and
# once a week, so that a new TFEL release is tried even when nothing is
# pushed. The release workflow calls this one (workflow_call), so that what is
# published has gone through exactly these checks.
on:
push:
branches: [master]
pull_request:
schedule:
# Mondays, 06:00 UTC.
- cron: '0 6 * * 1'
workflow_call:
permissions:
contents: read
concurrency:
# One run per branch, pull request or tag: a newer push cancels the older
# run. Called by the release workflow, `github.workflow` is the caller's.
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
# The oldest TFEL rustfront supports: always tested.
MINIMUM_TFEL: '5.1.0'
jobs:
# The TFEL versions to test: the minimum, and the latest stable one, found
# anew at every run. Read from the tags TFEL-X.Y.Z of thelfer/tfel, not from
# its GitHub releases, which lag behind (the 5.x series has none).
tfel-versions:
runs-on: ubuntu-latest
outputs:
list: ${{ steps.versions.outputs.list }}
steps:
- id: versions
env:
GH_TOKEN: ${{ github.token }}
run: |
latest=$(gh api --paginate repos/thelfer/tfel/tags --jq '.[].name' \
| sed -n 's/^TFEL-\([0-9]*\.[0-9]*\.[0-9]*\)$/\1/p' | sort -V | tail -1)
echo "latest stable TFEL: $latest"
list=$(printf '%s\n' "$MINIMUM_TFEL" "$latest" | sort -uV | jq -R . | jq -cs .)
echo "list=$list" >> "$GITHUB_OUTPUT"
check:
name: TFEL ${{ matrix.tfel }}
needs: tfel-versions
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
tfel: ${{ fromJSON(needs.tfel-versions.outputs.list) }}
env:
TFEL_VERSION: ${{ matrix.tfel }}
steps:
- uses: actions/checkout@v7
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
# TFEL is not packaged for Ubuntu nor conda-forge: each version is built
# from its tag once (a few minutes), then restored from the cache. The
# key names the runner image (`ubuntu24`, …), whose compiler built it.
- name: Runner image
id: image
run: echo "os=$ImageOS" >> "$GITHUB_OUTPUT"
- name: Restore TFEL
id: tfel
uses: actions/cache@v6
with:
path: ~/tfel-${{ env.TFEL_VERSION }}
key: tfel-${{ env.TFEL_VERSION }}-${{ steps.image.outputs.os }}-${{ runner.arch }}
- name: Build TFEL
if: steps.tfel.outputs.cache-hit != 'true'
run: ./scripts/install-tfel.sh "$TFEL_VERSION" "$HOME/tfel-$TFEL_VERSION"
- name: Put TFEL in the PATH
run: |
echo "$HOME/tfel-$TFEL_VERSION/bin" >> "$GITHUB_PATH"
echo "LD_LIBRARY_PATH=$HOME/tfel-$TFEL_VERSION/lib" >> "$GITHUB_ENV"
- name: TFEL version
run: mfront --version
# The checks of scripts/check.sh, which runs them locally too: one step
# per check, so that the interface shows which one fails.
- name: Formatting
run: ./scripts/check.sh fmt
- name: Clippy
run: ./scripts/check.sh clippy
- name: Tests
run: ./scripts/check.sh test
- name: Documentation
run: ./scripts/check.sh doc
- name: Comparison of mtest-rs with MTest
run: ./scripts/check.sh compare
- name: Packaging
run: ./scripts/check.sh package
msrv:
name: Minimum Rust version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
# The `rust-version` declared in Cargo.toml: building with it is the
# only way to know it still holds. No TFEL needed: nothing runs.
- name: Minimum Rust version of Cargo.toml
id: msrv
run: |
version=$(sed -n '/^\[workspace.package\]/,/^\[/s/^rust-version = "\(.*\)"/\1/p' Cargo.toml)
echo "version=$version" >> "$GITHUB_OUTPUT"
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.msrv.outputs.version }}
- uses: Swatinem/rust-cache@v2
- run: ./scripts/check.sh msrv