|
| 1 | +name: Linker inputs |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - '.github/workflows/linker-inputs.yml' |
| 7 | + - 'native/linker-inputs/**' |
| 8 | + - 'native/windows/**' |
| 9 | + - 'scripts/linker_inputs.py' |
| 10 | + - 'scripts/windows_runtime.py' |
| 11 | + - 'scripts/test_linker_inputs.py' |
| 12 | +permissions: {} |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + include: |
| 19 | + - {target: x64musl, os: ubuntu-24.04} |
| 20 | + - {target: arm64musl, os: ubuntu-24.04-arm} |
| 21 | + - {target: x64win, os: windows-2025} |
| 22 | + runs-on: ${{ matrix.os }} |
| 23 | + permissions: |
| 24 | + contents: read |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v7 |
| 27 | + - uses: actions/setup-python@v6 |
| 28 | + with: |
| 29 | + python-version: '3.12' |
| 30 | + - uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f |
| 31 | + with: |
| 32 | + version: 0.17.0 |
| 33 | + - name: Test artifact verification and caching |
| 34 | + run: python -m unittest scripts/test_linker_inputs.py |
| 35 | + - name: Build runtime inputs |
| 36 | + run: python scripts/linker_inputs.py build --target ${{ matrix.target }} --directory dist/linker-inputs |
| 37 | + - uses: actions/upload-artifact@v7 |
| 38 | + with: |
| 39 | + name: linker-inputs-${{ matrix.target }} |
| 40 | + path: dist/linker-inputs/* |
| 41 | + if-no-files-found: error |
| 42 | + publish: |
| 43 | + needs: build |
| 44 | + if: github.event_name == 'workflow_dispatch' && github.ref_name == github.event.repository.default_branch |
| 45 | + runs-on: ubuntu-24.04 |
| 46 | + permissions: |
| 47 | + contents: write |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v7 |
| 50 | + - uses: actions/download-artifact@v8 |
| 51 | + with: |
| 52 | + pattern: linker-inputs-* |
| 53 | + merge-multiple: true |
| 54 | + path: dist/linker-inputs |
| 55 | + - name: Verify and publish immutable runtime release |
| 56 | + env: |
| 57 | + GH_TOKEN: ${{ github.token }} |
| 58 | + run: | |
| 59 | + tag=$(python3 scripts/linker_inputs.py manifest --directory dist/linker-inputs --repository "$GITHUB_REPOSITORY") |
| 60 | + if gh release view "$tag" >/dev/null 2>&1; then |
| 61 | + mkdir -p target/published-inputs |
| 62 | + gh release download "$tag" --dir target/published-inputs |
| 63 | + diff -r dist/linker-inputs target/published-inputs |
| 64 | + else |
| 65 | + gh release create "$tag" dist/linker-inputs/* --target "$GITHUB_SHA" --prerelease --latest=false --title "Linker inputs ${tag#linker-inputs-}" --notes "Independently built native runtime inputs. Consumers pin the attached manifest and archive SHA-256 hashes." |
| 66 | + fi |
0 commit comments