Repository navigation
53 lines (46 loc) · 2.15 KB
/
Copy pathci-offline.yml
File metadata and controls
53 lines (46 loc) · 2.15 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
name: ci-offline
# A repository built on a machine without a network (design
# .agents/docs/2026-11-21-offline-host-inputs-and-toolchain-defaults-design.md
# §3.2, F3; docs/90, "Building on a machine without a network"). A clean home
# writes everything this repository's build needs into a directory with
# `mcpp fetch --to`; a second, fresh home takes it with `mcpp fetch --from` and
# builds mcpp in a network namespace of its own, where any download fails.
#
# Called by ci.yml after the Linux build, with the binary build.yml produced
# (use-built-mcpp, rule R1 of the 2026-10-02 CI record).
on:
workflow_call:
jobs:
offline:
name: mcpp builds from a bundle without a network (linux-x86_64)
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/bootstrap-mcpp
- uses: ./.github/actions/use-built-mcpp
with:
host: linux-x86_64
- name: A clean home writes the repository's inputs into a directory
shell: bash
run: |
set -euo pipefail
MCPP_HOME="$RUNNER_TEMP/home-online" "$MCPP_FRESH" fetch --to "$RUNNER_TEMP/bundle"
test -f "$RUNNER_TEMP/bundle/bundle.toml"
du -sh "$RUNNER_TEMP/bundle"
- name: A fresh home takes the directory and builds mcpp in a network namespace of its own
shell: bash
run: |
set -euo pipefail
# A network namespace needs root here (the runner restricts unprivileged
# user namespaces); the build inside it runs as the runner's user.
sudo unshare --net -- sudo -u "$(id -un)" env \
PATH="$PATH" HOME="$HOME" \
MCPP_HOME="$RUNNER_TEMP/home-offline" \
MCPP_VENDORED_XLINGS="$MCPP_VENDORED_XLINGS" \
bash -c 'set -euo pipefail
if curl -sS -m 5 https://github.com > /dev/null 2>&1; then echo "::error::the namespace reaches the network"; exit 1; fi
"$0" fetch --from "$1" --offline
"$0" build --offline
target=$(ls -d target/x86_64-linux-gnu/*/bin/mcpp | head -1)
"$target" --version' "$MCPP_FRESH" "$RUNNER_TEMP/bundle"