-
Notifications
You must be signed in to change notification settings - Fork 10
162 lines (145 loc) · 6.57 KB
/
Copy pathci-linux.yml
File metadata and controls
162 lines (145 loc) · 6.57 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-linux
# Self-host CI on Linux: mcpp builds mcpp. The bootstrap mcpp comes from
# `xlings install mcpp` (xim:mcpp in the xlings package index), so this
# workflow no longer depends on a previous-release tarball — the
# chicken-and-egg now lives upstream in the xlings index.
#
# SHAPE: four INDEPENDENT jobs, no `needs:` between them. Each restores the
# same cache lineage (see .github/actions/bootstrap-mcpp) and pays one warm
# `mcpp build` (~2.5 min) to get the PR's own binary, then does its own leg.
# That warm rebuild is far cheaper than serialising the legs behind a shared
# artifact would be:
#
# before: build → unit → gcc → musl → llvm → xlings ≈ 18 min (one job)
# after: max(build+unit, gcc, musl+llvm, xlings) ≈ 7-8 min
#
# The ~18 min e2e suite is a SEPARATE workflow (ci-linux-e2e.yml, sharded)
# that runs in parallel on the same caches.
#
# Paired workflows: ci-linux-e2e.yml, ci-macos.yml, ci-windows.yml.
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# MCPP_HOME pinned so the cache keys below restore into the same path
# mcpp resolves at runtime.
MCPP_HOME: /home/runner/.mcpp
# Verbose every mcpp invocation for richer CI diagnostics (src/cli.cppm).
# Safe here: this workflow no longer runs the e2e suite, which is what
# asserts mcpp's default quiet output (tests 48/53).
MCPP_VERBOSE: "1"
jobs:
build-test:
name: build + unit tests (linux x86_64, self-host)
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/bootstrap-mcpp
- name: Configure mirror + Build mcpp from source (self-host)
run: |
export MCPP_VENDORED_XLINGS="$XLINGS_BIN"
# Set GLOBAL mirror via xlings directly (bootstrap mcpp may lack --mirror flag)
"$XLINGS_BIN" config --mirror GLOBAL 2>/dev/null || true
"$MCPP" self config --mirror GLOBAL 2>/dev/null || true
"$MCPP" build
- name: Unit + integration tests via `mcpp test`
run: |
# Use freshly-built mcpp for test (it has --mirror support)
MCPP_FRESH=$(realpath "$(find target -type f -name mcpp -printf '%T@ %p\n' | sort -rn | head -1 | cut -d' ' -f2)")
"$MCPP_FRESH" self config --mirror GLOBAL
"$MCPP_FRESH" test
# A cold, from-scratch self-host build with the manifest-pinned GCC: the
# property `build-test` cannot cover, because it builds incrementally on a
# restored target/. `mcpp test` is deliberately NOT repeated here — it would
# be the same suite, same toolchain, same driver binary as `build-test`,
# differing only in incremental state.
toolchain-gcc:
name: "toolchain: gcc (cold self-host)"
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/bootstrap-mcpp
- name: Build mcpp from source (self-host)
run: |
export MCPP_VENDORED_XLINGS="$XLINGS_BIN"
"$XLINGS_BIN" config --mirror GLOBAL 2>/dev/null || true
"$MCPP" self config --mirror GLOBAL 2>/dev/null || true
"$MCPP" build
MCPP_FRESH=$(realpath "$(find target -type f -name mcpp -printf '%T@ %p\n' | sort -rn | head -1 | cut -d' ' -f2)")
cp "$MCPP_FRESH" /tmp/mcpp-fresh
echo "MCPP=/tmp/mcpp-fresh" >> "$GITHUB_ENV"
- name: "Toolchain: GCC — cold rebuild with the PR binary"
run: |
"$MCPP" clean
"$MCPP" build 2>&1 | tee build.log; grep -q "Resolved gcc@16.1.0" build.log
# The two cheap legs share one runner: each is ~1 min after the warm build,
# so a runner apiece would cost more in setup than it saves in wall-clock.
toolchain-cross:
name: "toolchain: musl + llvm"
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/bootstrap-mcpp
- name: Build mcpp from source (self-host)
run: |
export MCPP_VENDORED_XLINGS="$XLINGS_BIN"
"$XLINGS_BIN" config --mirror GLOBAL 2>/dev/null || true
"$MCPP" self config --mirror GLOBAL 2>/dev/null || true
"$MCPP" build
MCPP_FRESH=$(realpath "$(find target -type f -name mcpp -printf '%T@ %p\n' | sort -rn | head -1 | cut -d' ' -f2)")
cp "$MCPP_FRESH" /tmp/mcpp-fresh
echo "MCPP=/tmp/mcpp-fresh" >> "$GITHUB_ENV"
# Auto-installs gcc@16.1.0-musl on demand (cached across runs).
- name: "Toolchain: musl-gcc — build mcpp (--target)"
run: |
"$MCPP" clean
"$MCPP" build --target x86_64-linux-musl 2>&1 | tee build.log; grep -q "Resolved gcc@16.1.0 → x86_64-linux-musl" build.log
- name: "Toolchain: LLVM — build mcpp"
run: |
"$MCPP" toolchain install llvm 20.1.7
# Override project toolchain to use LLVM for this build
sed -i 's/^default = "gcc@16.1.0"/default = "llvm@20.1.7"/' mcpp.toml
"$MCPP" clean
"$MCPP" build 2>&1 | tee build.log; grep -q "Resolved llvm@20.1.7" build.log
# Restore
sed -i 's/^default = "llvm@20.1.7"/default = "gcc@16.1.0"/' mcpp.toml
# Integration: the mcpp built from THIS PR's source builds & runs a real
# external C++ project — xlings (openxlings/xlings ships its own mcpp.toml).
# MCPP_VENDORED_XLINGS only supplies the xlings package backend that mcpp
# resolves deps through.
integration-xlings:
name: "integration: mcpp builds & runs xlings"
runs-on: ubuntu-24.04
timeout-minutes: 45
env:
XLINGS_NON_INTERACTIVE: '1'
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/bootstrap-mcpp
- name: Build mcpp from source (self-host)
run: |
export MCPP_VENDORED_XLINGS="$XLINGS_BIN"
"$XLINGS_BIN" config --mirror GLOBAL 2>/dev/null || true
"$MCPP" self config --mirror GLOBAL 2>/dev/null || true
"$MCPP" build
MCPP_FRESH=$(realpath "$(find target -type f -name mcpp -printf '%T@ %p\n' | sort -rn | head -1 | cut -d' ' -f2)")
cp "$MCPP_FRESH" /tmp/mcpp-fresh
echo "MCPP=/tmp/mcpp-fresh" >> "$GITHUB_ENV"
- name: "Integration: mcpp builds & runs xlings (openxlings/xlings)"
run: |
export MCPP_VENDORED_XLINGS="$XLINGS_BIN"
git clone --depth 1 --recurse-submodules \
https://github.com/openxlings/xlings /tmp/xlings-src
cd /tmp/xlings-src
"$MCPP" self config --mirror GLOBAL
"$MCPP" build
"$MCPP" run