|
| 1 | +--- |
| 2 | +name: Prebuild |
| 3 | + |
| 4 | +# yamllint disable-line rule:truthy |
| 5 | +on: |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +permissions: |
| 9 | + attestations: write |
| 10 | + contents: write |
| 11 | + id-token: write |
| 12 | + |
| 13 | +env: |
| 14 | + # Disable incremental compilation to avoid overhead. |
| 15 | + CARGO_INCREMENTAL: "0" |
| 16 | + |
| 17 | +jobs: |
| 18 | + release: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + # do NOT load any caches here, we want a clean, freestanding build w/o stateful dependencies! |
| 22 | + |
| 23 | + - name: Set Timestamp |
| 24 | + id: timestamp |
| 25 | + run: | |
| 26 | + ts_iso="$(date -u -Is)" |
| 27 | + ts_tag="$(echo "$ts_iso" | sed 's/+00:00//g' | sed 's/:/-/g')" |
| 28 | +
|
| 29 | + echo "iso=$ts_iso" |
| 30 | + echo "tag=$ts_tag" |
| 31 | +
|
| 32 | + echo TIMESTAMP_ISO="$ts_iso" >> "$GITHUB_OUTPUT" |
| 33 | + echo TIMESTAMP_TAG="$ts_tag" >> "$GITHUB_OUTPUT" |
| 34 | +
|
| 35 | + - name: Checkout |
| 36 | + uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 |
| 37 | + with: |
| 38 | + fetch-depth: 1 |
| 39 | + |
| 40 | + - name: Fetch main branch |
| 41 | + run: git fetch --depth=1 origin main |
| 42 | + |
| 43 | + - name: Free disk space |
| 44 | + uses: ./.github/actions/free-disk-space |
| 45 | + |
| 46 | + - name: Install `just` |
| 47 | + uses: taiki-e/install-action@763e3324d4fd026c9bd284c504378585777a87d5 # v2 |
| 48 | + with: |
| 49 | + tool: just |
| 50 | + |
| 51 | + - name: Install stable toolchain |
| 52 | + uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # master |
| 53 | + with: |
| 54 | + toolchain: stable |
| 55 | + targets: wasm32-wasip2 |
| 56 | + |
| 57 | + - name: build "add one" example (debug) |
| 58 | + run: just guests::rust::build-add-one-debug |
| 59 | + |
| 60 | + - name: build "add one" example (release) |
| 61 | + run: just guests::rust::build-add-one-release |
| 62 | + |
| 63 | + - name: build python guest (debug) |
| 64 | + run: just guests::python::build-debug |
| 65 | + |
| 66 | + - name: build python guest (release) |
| 67 | + run: just guests::python::build-release |
| 68 | + |
| 69 | + # we need unique file names for the release |
| 70 | + - name: stage release files |
| 71 | + run: | |
| 72 | + mkdir out |
| 73 | + mv target/wasm32-wasip2/debug/examples/add_one.wasm out/example_add_one.debug.wasm |
| 74 | + mv target/wasm32-wasip2/release/examples/add_one.wasm out/example_add_one.release.wasm |
| 75 | + mv target/wasm32-wasip2/debug/datafusion_udf_wasm_python.wasm out/datafusion_udf_wasm_python.debug.wasm |
| 76 | + mv target/wasm32-wasip2/release/datafusion_udf_wasm_python.wasm out/datafusion_udf_wasm_python.release.wasm |
| 77 | +
|
| 78 | + - name: attestation |
| 79 | + id: attestation |
| 80 | + uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3 |
| 81 | + with: |
| 82 | + subject-path: out/*.wasm |
| 83 | + |
| 84 | + - name: publish release |
| 85 | + uses: softprops/action-gh-release@5be0e66d93ac7ed76da52eca8bb058f665c3a5fe # v2 |
| 86 | + with: |
| 87 | + body: | |
| 88 | + WASM guest binaries. |
| 89 | +
|
| 90 | + **Commit:** [`${{ github.sha }}`](${{ github.server_url }}/${{ github.repository }}/tree/${{ github.sha }}) |
| 91 | + **Build Timestamp:** `${{ steps.timestamp.outputs.TIMESTAMP_ISO }}` |
| 92 | + **Build Attestation:** <${{ steps.attestation.outputs.attestation-url }}> |
| 93 | + preserve_order: true |
| 94 | + files: out/*.wasm |
| 95 | + name: "WASM Binaries ${{ steps.timestamp.outputs.TIMESTAMP_ISO }}" |
| 96 | + tag_name: "wasm-binaries/${{ steps.timestamp.outputs.TIMESTAMP_TAG }}/${{ github.sha }}" |
| 97 | + fail_on_unmatched_files: true |
| 98 | + target_commitish: "${{ github.sha }}" |
| 99 | + make_latest: false |
0 commit comments