-
Notifications
You must be signed in to change notification settings - Fork 0
174 lines (142 loc) · 5.25 KB
/
test.yml
File metadata and controls
174 lines (142 loc) · 5.25 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
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: "Run Tests"
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: cargo test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache Cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-test-
- name: Retrieve Rust version
id: rust-version
run: echo "rust-version=$(grep '^rust ' .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT
shell: bash
- name: Set up Rust tool chain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ steps.rust-version.outputs.rust-version }}
- name: Add wasm targets
run: rustup target add wasm32-wasip1 wasm32-unknown-unknown
- name: Setup Viceroy
run: |
if ! command -v viceroy &>/dev/null; then
cargo install viceroy --locked
fi
- name: Fetch dependencies (locked)
run: cargo fetch --locked
- name: Run workspace tests
run: cargo test --workspace --all-targets
- name: Check feature compilation
run: cargo check --workspace --all-targets --features "fastly cloudflare spin"
- name: Check Spin wasm32 compilation
run: cargo check -p edgezero-adapter-spin --target wasm32-wasip1 --features spin
cloudflare-wasm-tests:
name: cloudflare wasm tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache Cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-cloudflare-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-cloudflare-
- name: Retrieve Rust version
id: rust-version-cloudflare
run: echo "rust-version=$(grep '^rust ' .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT
shell: bash
- name: Set up Rust tool chain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ steps.rust-version-cloudflare.outputs.rust-version }}
- name: Add wasm32 target
run: rustup target add wasm32-unknown-unknown
- name: Resolve wasm-bindgen CLI version
id: wasm-bindgen-version
shell: bash
run: |
version="$(
awk '
$1 == "name" && $3 == "\"wasm-bindgen\"" { in_pkg=1; next }
in_pkg && $1 == "version" {
gsub(/"/, "", $3)
print $3
exit
}
' Cargo.lock
)"
test -n "$version"
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Install wasm-bindgen test runner
run: cargo install wasm-bindgen-cli --version "${{ steps.wasm-bindgen-version.outputs.version }}" --locked
- name: Fetch dependencies (locked)
run: cargo fetch --locked
- name: Run Cloudflare wasm tests
env:
CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER: wasm-bindgen-test-runner
run: cargo test -p edgezero-adapter-cloudflare --features cloudflare --target wasm32-unknown-unknown --test contract
- name: Check Cloudflare wasm target
run: cargo check -p edgezero-adapter-cloudflare --features cloudflare --target wasm32-unknown-unknown
fastly-wasm-tests:
name: fastly wasm tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache Cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-fastly-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-fastly-
- name: Retrieve Rust version
id: rust-version-fastly
run: echo "rust-version=$(grep '^rust ' .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT
shell: bash
- name: Set up Rust tool chain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ steps.rust-version-fastly.outputs.rust-version }}
- name: Add wasm targets
run: rustup target add wasm32-wasip1
- name: Setup Viceroy
run: cargo install viceroy --locked
- name: Fetch dependencies (locked)
run: cargo fetch --locked
- name: Run Fastly wasm tests
env:
CARGO_TARGET_WASM32_WASIP1_RUNNER: "viceroy run"
run: cargo test -p edgezero-adapter-fastly --features fastly --target wasm32-wasip1 --test contract
- name: Check Fastly wasm target
run: cargo check -p edgezero-adapter-fastly --features fastly --target wasm32-wasip1