Skip to content

Commit c41fac7

Browse files
committed
ci: add prebuild workflow
For #186.
1 parent b65639a commit c41fac7

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed

.github/workflows/prebuild.yml

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

0 commit comments

Comments
 (0)