-
Notifications
You must be signed in to change notification settings - Fork 9
92 lines (77 loc) · 2.61 KB
/
ci.yml
File metadata and controls
92 lines (77 loc) · 2.61 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
name: ci
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [22, 24]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
permissions:
contents: read
issues: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown,wasm32-wasip2
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: wit-bindgen-wasm
shared-key: ${{ runner.os }}-cargo-${{ hashFiles('wit-bindgen-wasm/Cargo.lock') }}
- name: Install dependencies
run: npm ci
- name: Setup WASM build tools
run: npm run setup-wasm
- name: Run tests
run: npm test
- name: Update snapshot
run: npm run update-snapshot && git add --all
- name: Prepare diff for comment
id: diff
continue-on-error: true
run: |
set +e
body=$(git diff --exit-code --diff-filter=AM $GITHUB_SHA -- '*.snap' 2>&1)
echo "exitcode=$?" >> $GITHUB_OUTPUT
body="${body//'<'/'<'}"
body="${body//'>'/'>'}"
delimiter="$(openssl rand -hex 8)"
echo "body<<${delimiter}" >> $GITHUB_OUTPUT
echo "${body:0:64000}" >> $GITHUB_OUTPUT
echo "${delimiter}" >> $GITHUB_OUTPUT
- uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request' && steps.diff.outputs.exitcode == '1'
with:
header: sticky-comment-for-git-diff
hide_and_recreate: true
hide_classify: "OUTDATED"
message: |
**Found changes in the snapshot tests. Please review.**
<details>
<summary>Diff 📖</summary>
<pre lang="diff"><code>
${{ steps.diff.outputs.body }}
</code></pre>
</details>
- uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request' && steps.diff.outputs.exitcode == '0'
with:
header: sticky-comment-for-git-diff
hide: true
hide_classify: "OUTDATED"