|
16 | 16 | workflow_dispatch: |
17 | 17 | schedule: |
18 | 18 | - cron: '0 6 * * 1' # weekly Mon 06:00 UTC |
| 19 | + pull_request: |
| 20 | + branches: [ main ] |
| 21 | + paths: |
| 22 | + - 'src/build/build_program.cppm' |
| 23 | + - 'src/platform/process.cppm' |
| 24 | + - 'tests/e2e/167_build_mcpp_musl_host_static.sh' |
| 25 | + - '.github/workflows/ci-aarch64-fresh-install.yml' |
19 | 26 | push: |
20 | 27 | branches: [ main ] |
21 | 28 | paths: |
22 | 29 | - '.github/workflows/ci-aarch64-fresh-install.yml' |
23 | 30 |
|
| 31 | +permissions: |
| 32 | + contents: read |
| 33 | + |
24 | 34 | concurrency: |
25 | 35 | group: ci-${{ github.workflow }}-${{ github.ref }} |
26 | 36 | cancel-in-progress: true |
|
34 | 44 | # Verbose every mcpp invocation — cold bootstrap path (src/cli.cppm). |
35 | 45 | MCPP_VERBOSE: "1" |
36 | 46 | steps: |
| 47 | + - uses: actions/checkout@v4 |
| 48 | + with: |
| 49 | + persist-credentials: false |
| 50 | + |
37 | 51 | - name: System info |
38 | 52 | run: | |
39 | 53 | uname -a |
@@ -70,14 +84,38 @@ jobs: |
70 | 84 | git clone --depth 1 https://github.com/openxlings/xim-pkgindex "$idx" |
71 | 85 | grep -n "skipping relocation\|os.isfile(path.join(bindir" "$idx/pkgs/m/musl-gcc.lua" | head -2 || true |
72 | 86 |
|
| 87 | + - name: Build current mcpp source for native regression tests |
| 88 | + run: | |
| 89 | + mcpp build --target aarch64-linux-musl |
| 90 | + self=$(find target/aarch64-linux-musl -type f -name mcpp | head -1) |
| 91 | + test -x "$self" |
| 92 | + self=$(realpath "$self") |
| 93 | + "$self" --version |
| 94 | + echo "MCPP_SELF=$self" >> "$GITHUB_ENV" |
| 95 | +
|
73 | 96 | - name: Native build + run an `import std` program |
74 | 97 | run: | |
75 | 98 | work=$(mktemp -d); cd "$work" |
76 | | - mcpp new hello |
| 99 | + "$MCPP_SELF" new hello |
77 | 100 | cd hello |
| 101 | + cat > build.mcpp <<'EOF' |
| 102 | + #include <cstdio> |
| 103 | + int main() { |
| 104 | + FILE* marker = std::fopen("helper-ran", "w"); |
| 105 | + if (!marker) return 2; |
| 106 | + std::fputs("ok\n", marker); |
| 107 | + std::fclose(marker); |
| 108 | + return 0; |
| 109 | + } |
| 110 | + EOF |
78 | 111 | # default src uses import std (C++23) |
79 | | - mcpp build |
80 | | - out=$(mcpp run 2>/dev/null || true) |
| 112 | + "$MCPP_SELF" build |
| 113 | + test -f helper-ran |
| 114 | + helper=target/.build-mcpp/build.mcpp.bin |
| 115 | + file "$helper" |
| 116 | + file "$helper" | grep -q 'statically linked' |
| 117 | + ! readelf -lW "$helper" | grep -q 'Requesting program interpreter' |
| 118 | + out=$("$MCPP_SELF" run 2>/dev/null) |
81 | 119 | echo "program output: $out" |
82 | 120 | bin=$(find target -type f -name hello | head -1) |
83 | 121 | file "$bin" |
|
0 commit comments