generated from WebAssembly/wasi-proposal-template
-
Notifications
You must be signed in to change notification settings - Fork 2
130 lines (106 loc) · 3.8 KB
/
wasmtime.yml
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Wasmtime
on:
push:
branches: [ "main" ]
tags:
- "v*"
pull_request:
branches: [ "main" ]
concurrency:
group: cmake-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build-and-run:
env:
CC: ${{matrix.compiler}}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{matrix.os}}
steps:
- name: Install dependencies (rustup)
run: |
rustup target add wasm32-wasi
- name: Install dependencies (cargo)
run: |
cargo install --version 1.0.51 wasm-tools
cargo install --version 0.16.0 wit-bindgen-cli
- name: Install dependencies (ubuntu)
if: startsWith(matrix.os, 'ubuntu-')
run: sudo apt-get update && sudo apt-get install -y pax
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install wasmtime (ubuntu)
if: startsWith(matrix.os, 'ubuntu-')
run: |
curl -O -L https://github.com/bytecodealliance/wasmtime/releases/download/v16.0.0/wasmtime-v16.0.0-x86_64-linux.tar.xz
tar xvJf wasmtime-v16.0.0-x86_64-linux.tar.xz
echo "WASMTIME=$(pwd -P)/wasmtime-v16.0.0-x86_64-linux/wasmtime" >> ${GITHUB_ENV}
- name: Install wasmtime (macOS)
if: startsWith(matrix.os, 'macos-')
run: |
curl -O -L https://github.com/bytecodealliance/wasmtime/releases/download/v16.0.0/wasmtime-v16.0.0-x86_64-macos.tar.xz
tar xvzf wasmtime-v16.0.0-x86_64-macos.tar.xz
echo "WASMTIME=$(pwd -P)/wasmtime-v16.0.0-x86_64-macos/wasmtime" >> ${GITHUB_ENV}
- name: Build guest (Rust)
run: |
./build.sh
working-directory: ${{github.workspace}}/guest_rust
- name: Build guest (C)
run: |
./build.sh
working-directory: ${{github.workspace}}/guest_c
- name: Build host_wasmtime
run: |
cargo build
working-directory: ${{github.workspace}}/host_wasmtime
- name: Run (component)
run: |
cargo run ../guest_rust/guest-component.wasm
working-directory: ${{github.workspace}}/host_wasmtime
- name: Check the output (component)
run: |
test $(ls *.jpg|wc -l) -eq 60
working-directory: ${{github.workspace}}/host_wasmtime
- name: Clean up the output (component)
run: |
rm *.jpg
working-directory: ${{github.workspace}}/host_wasmtime
- name: Run (wasmtime precompiled component)
run: |
cargo run ../guest_rust/guest-component.cwasm
working-directory: ${{github.workspace}}/host_wasmtime
- name: Check the output (wasmtime precompiled component)
run: |
test $(ls *.jpg|wc -l) -eq 60
working-directory: ${{github.workspace}}/host_wasmtime
- name: Clean up the output (wasmtime precompiled component)
run: |
rm *.jpg
working-directory: ${{github.workspace}}/host_wasmtime
- name: Run (C, component)
run: |
cargo run ../guest_c/guest-component.wasm
working-directory: ${{github.workspace}}/host_wasmtime
- name: Check the output (C, component)
run: |
test $(ls *.jpg|wc -l) -eq 60
working-directory: ${{github.workspace}}/host_wasmtime
- name: Clean up the output (C, component)
run: |
rm *.jpg
working-directory: ${{github.workspace}}/host_wasmtime
- name: Run (C, wasmtime precompiled component)
run: |
cargo run ../guest_c/guest-component.cwasm
working-directory: ${{github.workspace}}/host_wasmtime
- name: Check the output (C, precompiled component)
run: |
test $(ls *.jpg|wc -l) -eq 60
working-directory: ${{github.workspace}}/host_wasmtime
- name: Clean up the output (C, precompiled component)
run: |
rm *.jpg
working-directory: ${{github.workspace}}/host_wasmtime