-
Notifications
You must be signed in to change notification settings - Fork 1
95 lines (83 loc) · 2.82 KB
/
main.yml
File metadata and controls
95 lines (83 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Build
on:
# workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-24.04-arm
permissions:
contents: read
pull-requests: write
env:
RUSTFLAGS: -Dwarnings -Ctarget-feature=+simd128,+bulk-memory,+mutable-globals
steps:
- uses: actions/checkout@v6
- uses: actions/cache@v5
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: supplypike/setup-bin@v5
with:
uri: "https://github.com/WebAssembly/binaryen/releases/download/version_126/binaryen-version_126-aarch64-linux.tar.gz"
name: "wasm-opt"
version: "126"
subPath: "binaryen-version_126/bin"
- uses: taiki-e/install-action@v2
with:
tool: wasm-bindgen
- run: |
rustup default nightly
rustup target add wasm32-unknown-unknown
rustup component add rust-src --toolchain nightly-aarch64-unknown-linux-gnu
- name: Set up Fastly CLI
uses: fastly/compute-actions/setup@v13
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: pnpm/action-setup@v6
name: Install pnpm
with:
version: 11
run_install: false
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- run: |
cargo +nightly build --release --target wasm32-unknown-unknown --no-default-features -F png -Z build-std=panic_abort,std
wasm-bindgen ./target/wasm32-unknown-unknown/release/bitmap_to_png.wasm --out-dir ./pkg --typescript --target web
wasm-opt ./pkg/bitmap_to_png_bg.wasm -o ./pkg/bitmap_to_png_bg.wasm -Oz --dce --enable-simd --enable-bulk-memory --enable-nontrapping-float-to-int --enable-mutable-globals
- run: pnpm run build
- uses: actions/upload-artifact@v7
with:
name: dist
path: dist/
compression-level: 9
- uses: preactjs/compressed-size-action@v3
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
- run: |
pnpm run fastly:deploy
pnpm run fastly:publish
working-directory: compute-js
env:
FASTLY_API_TOKEN: ${{ secrets.FASTLY_API_TOKEN }}
if: github.event_name == 'push' && github.ref == 'refs/heads/main'