|
40 | 40 | apt-get update
|
41 | 41 | apt-get install --no-install-recommends -y -- "${prerequisites[@]}"
|
42 | 42 | shell: bash
|
43 |
| - - name: Verify environment is sufficiently minimal for the test |
| 43 | + - name: Verify that we are in an environment with limited dev tools |
44 | 44 | run: |
|
45 | 45 | set -x
|
46 | 46 | for pattern in cmake g++ libssl-dev make pkgconf pkg-config; do
|
|
55 | 55 | done
|
56 | 56 | - name: Install Rust via Rustup
|
57 | 57 | run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
|
58 |
| - - uses: Swatinem/rust-cache@v2 |
59 |
| - - run: /github/home/.cargo/bin/cargo install --debug --locked --no-default-features --features max-pure --path . |
| 58 | + - name: Add Rust tools to path |
| 59 | + run: echo "PATH=$HOME/.cargo/bin:$PATH" >> "$GITHUB_ENV" |
| 60 | + - name: Generate dependency tree |
| 61 | + run: cargo tree --locked --no-default-features --features max-pure > tree.txt |
| 62 | + - name: Scan for dependencies that build C or C++ code |
| 63 | + run: | |
| 64 | + pattern='.*\b(-sys|cc|cmake|pkg-config|vcpkg)\b.*' |
| 65 | + ! GREP_COLORS='ms=30;48;5;214' grep --color=always -Ex -C 1000000 -e "$pattern" tree.txt |
| 66 | + continue-on-error: true |
| 67 | + - name: Wrap cc1 (and cc1plus if present) to record calls |
| 68 | + run: | |
| 69 | + cat >/usr/local/bin/wrapper1 <<'EOF' |
| 70 | + #!/bin/sh -e |
| 71 | + printf '%s\n' "$0 $*" | |
| 72 | + flock /run/lock/wrapper1.fbd136bd-9b1b-448d-84a9-e18be53ae63c.lock \ |
| 73 | + tee -a -- /var/log/wrapper1.log ~/display >/dev/null # We'll link ~/display later. |
| 74 | + exec "$0.orig" "$@" |
| 75 | + EOF |
| 76 | +
|
| 77 | + cat >/usr/local/bin/wrap1 <<'EOF' |
| 78 | + #!/bin/sh -e |
| 79 | + dir="$(dirname -- "$1")" |
| 80 | + base="$(basename -- "$1")" |
| 81 | + cd -- "$dir" |
| 82 | + mv -- "$base" "$base.orig" |
| 83 | + ln -s -- /usr/local/bin/wrapper1 "$base" |
| 84 | + EOF |
| 85 | +
|
| 86 | + chmod +x /usr/local/bin/wrap1 /usr/local/bin/wrapper1 |
| 87 | + mkdir /run/lock/wrapper1.fbd136bd-9b1b-448d-84a9-e18be53ae63c.lock |
| 88 | +
|
| 89 | + find /usr/lib/gcc \( -name cc1 -o -name cc1plus \) \ |
| 90 | + -print -exec /usr/local/bin/wrap1 {} \; |
| 91 | + - name: Build max-pure with limited dev tools and log cc1 |
| 92 | + run: | |
| 93 | + ln -s -- "/proc/$$/fd/1" ~/display # Bypass `cc1` redirection. |
| 94 | + cargo install --debug --locked --no-default-features --features max-pure --path . |
| 95 | + - name: Show logged C and C++ compilations (should be none) |
| 96 | + run: | |
| 97 | + ! cat /var/log/wrapper1.log |
| 98 | + continue-on-error: true |
60 | 99 |
|
61 | 100 | test:
|
62 | 101 | runs-on: ubuntu-latest
|
|
0 commit comments