|
| 1 | +# Copyright (c) Microsoft Corporation. |
| 2 | +# Licensed under the MIT License. |
| 3 | + |
| 4 | +# Branch-local, three-package PR validation. Add [mac-checks] to a commit |
| 5 | +# message to run these checks without opening a PR or invoking unrelated CI. |
| 6 | +name: Rallocator macOS validation |
| 7 | + |
| 8 | +on: |
| 9 | + push: |
| 10 | + branches: [ralfbiedert-rallocator-macos-support] |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + |
| 15 | +concurrency: |
| 16 | + group: rallocator-macos-checks-${{ github.ref }} |
| 17 | + cancel-in-progress: true |
| 18 | + |
| 19 | +env: |
| 20 | + MACOSX_DEPLOYMENT_TARGET: "14.4" |
| 21 | + ANVIL_IMPACT: consume |
| 22 | + ANVIL_IMPACT_INPUT_DIR: ${{ github.workspace }}/target/macos-validation-scope |
| 23 | + BASE_REF: origin/main |
| 24 | + CARGO_TERM_COLOR: never |
| 25 | + |
| 26 | +jobs: |
| 27 | + check: |
| 28 | + if: contains(github.event.head_commit.message, '[mac-checks]') |
| 29 | + name: "${{ matrix.check }} (${{ matrix.runner }})" |
| 30 | + runs-on: ${{ matrix.runner }} |
| 31 | + timeout-minutes: 180 |
| 32 | + strategy: |
| 33 | + fail-fast: false |
| 34 | + matrix: |
| 35 | + runner: [macos-15, macos-15-intel] |
| 36 | + check: [compatibility, coverage, careful, miri, mutation] |
| 37 | + defaults: |
| 38 | + run: |
| 39 | + shell: pwsh |
| 40 | + steps: |
| 41 | + - name: Checkout |
| 42 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 43 | + with: |
| 44 | + fetch-depth: 0 |
| 45 | + persist-credentials: false |
| 46 | + |
| 47 | + - name: Restore scoped check cache |
| 48 | + id: cache |
| 49 | + uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 |
| 50 | + with: |
| 51 | + key: macos-validation-v1-${{ matrix.runner }}-${{ matrix.check }}-${{ hashFiles('Cargo.lock', '.cargo/config.toml', 'justfiles/anvil/versions.just') }}-${{ github.sha }} |
| 52 | + restore-keys: | |
| 53 | + macos-validation-v1-${{ matrix.runner }}-${{ matrix.check }}-${{ hashFiles('Cargo.lock', '.cargo/config.toml', 'justfiles/anvil/versions.just') }}- |
| 54 | + path: | |
| 55 | + ~/.cargo/bin/ |
| 56 | + ~/.cargo/.crates.toml |
| 57 | + ~/.cargo/.crates2.json |
| 58 | + ~/.cargo/registry/ |
| 59 | + ~/.cargo/git/ |
| 60 | + ~/.rustup/toolchains/1.95-*/ |
| 61 | + ~/.rustup/toolchains/nightly-2026-05-30-*/ |
| 62 | + ~/.rustup/toolchains/nightly-2026-03-20-*/ |
| 63 | + target/ |
| 64 | +
|
| 65 | + - name: Bootstrap repository tooling |
| 66 | + uses: ./.github/actions/anvil-setup |
| 67 | + with: |
| 68 | + group: none |
| 69 | + |
| 70 | + - name: Select explicit three-package validation scope |
| 71 | + run: | |
| 72 | + $ErrorActionPreference = 'Stop' |
| 73 | + if (-not $IsMacOS) { throw 'This workflow requires a native macOS runner.' } |
| 74 | + # This is an explicit validation selection, not inferred impact. |
| 75 | + $scope = '--package rallocator --package seismograph --package seismograph_rallocator' |
| 76 | + New-Item -ItemType Directory -Force -Path $env:ANVIL_IMPACT_INPUT_DIR | Out-Null |
| 77 | + foreach ($tier in @('modified', 'affected', 'required')) { |
| 78 | + Set-Content -LiteralPath (Join-Path $env:ANVIL_IMPACT_INPUT_DIR "include_$tier.txt") -Value $scope -Encoding UTF8 |
| 79 | + } |
| 80 | + Write-Host "Mac-only validation scope: $scope" |
| 81 | + @( |
| 82 | + '### Declared validation boundaries' |
| 83 | + '- rallocator: native VM backend is excluded from Miri by package metadata.' |
| 84 | + '- rallocator and seismograph_rallocator: excluded from mutation testing by .cargo/mutants.toml.' |
| 85 | + '- Bolero/libfuzzer campaign: Linux-only; ordinary tests still run on both Mac architectures.' |
| 86 | + ) | Add-Content -LiteralPath $env:GITHUB_STEP_SUMMARY -Encoding UTF8 |
| 87 | +
|
| 88 | + - name: Run scoped Anvil checks |
| 89 | + env: |
| 90 | + MACOS_CHECK_GROUP: ${{ matrix.check }} |
| 91 | + run: | |
| 92 | + $ErrorActionPreference = 'Stop' |
| 93 | + $recipes = switch ($env:MACOS_CHECK_GROUP) { |
| 94 | + compatibility { |
| 95 | + @( |
| 96 | + 'anvil-msrv-test' |
| 97 | + 'anvil-cargo-hack' |
| 98 | + 'anvil-doc-build' |
| 99 | + 'anvil-doc-test' |
| 100 | + 'anvil-examples' |
| 101 | + 'anvil-bench' |
| 102 | + 'anvil-udeps' |
| 103 | + 'anvil-external-types' |
| 104 | + 'anvil-loom' |
| 105 | + ) |
| 106 | + } |
| 107 | + coverage { @('anvil-llvm-cov') } |
| 108 | + careful { @('anvil-careful') } |
| 109 | + miri { @('anvil-miri') } |
| 110 | + mutation { @('anvil-mutants-diff') } |
| 111 | + default { throw "Unknown Mac check group: $env:MACOS_CHECK_GROUP" } |
| 112 | + } |
| 113 | + & just anvil-toolchain-stable-install |
| 114 | + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } |
| 115 | + $failed = @() |
| 116 | + foreach ($recipe in $recipes) { |
| 117 | + Write-Host "::group::$recipe" |
| 118 | + & just "$recipe-validate-prereqs" |
| 119 | + if ($LASTEXITCODE -ne 0) { |
| 120 | + Write-Host "$recipe prerequisites missing; installing the repository-pinned tools." |
| 121 | + & just "$recipe-setup" binstall |
| 122 | + if ($LASTEXITCODE -ne 0) { |
| 123 | + $failed += $recipe |
| 124 | + Write-Host '::endgroup::' |
| 125 | + continue |
| 126 | + } |
| 127 | + } |
| 128 | + $arguments = @($recipe) |
| 129 | + if ($recipe -eq 'anvil-examples') { $arguments += '--run' } |
| 130 | + & just @arguments |
| 131 | + if ($LASTEXITCODE -ne 0) { $failed += $recipe } |
| 132 | + Write-Host '::endgroup::' |
| 133 | + } |
| 134 | + if ($failed.Count -gt 0) { |
| 135 | + Write-Error "Failed Mac checks: $($failed -join ', ')" |
| 136 | + exit 1 |
| 137 | + } |
| 138 | +
|
| 139 | + - name: Upload check reports |
| 140 | + if: always() && !cancelled() |
| 141 | + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 |
| 142 | + with: |
| 143 | + name: macos-${{ matrix.runner }}-${{ matrix.check }}-reports |
| 144 | + path: | |
| 145 | + target/coverage/ |
| 146 | + target/mutants.out/ |
| 147 | + mutants.out/ |
| 148 | +
|
| 149 | + - name: Save scoped check cache |
| 150 | + if: always() && !cancelled() && steps.cache.outputs.cache-primary-key != '' && steps.cache.outputs.cache-hit != 'true' |
| 151 | + uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 |
| 152 | + with: |
| 153 | + key: ${{ steps.cache.outputs.cache-primary-key }} |
| 154 | + path: | |
| 155 | + ~/.cargo/bin/ |
| 156 | + ~/.cargo/.crates.toml |
| 157 | + ~/.cargo/.crates2.json |
| 158 | + ~/.cargo/registry/ |
| 159 | + ~/.cargo/git/ |
| 160 | + ~/.rustup/toolchains/1.95-*/ |
| 161 | + ~/.rustup/toolchains/nightly-2026-05-30-*/ |
| 162 | + ~/.rustup/toolchains/nightly-2026-03-20-*/ |
| 163 | + target/ |
0 commit comments