-
Notifications
You must be signed in to change notification settings - Fork 21
163 lines (137 loc) · 4.63 KB
/
compile-tests.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
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
name: Compile tests
on:
push:
branches:
- main
pull_request:
branches:
- '*'
jobs:
build_assemblyscript:
name: Build Assemblyscript tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Initialize node.js environment
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
working-directory: tests/assemblyscript
run: |
npm install
- name: Check prettier codestyle
working-directory: tests/assemblyscript
run: |
npm run prettier-format-check
- name: Build tests
working-directory: tests/assemblyscript
run: |
npm run build
- name: Upload precompiled tests
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v3
with:
name: assemblyscript-testsuite
path: tests/assemblyscript/testsuite
if-no-files-found: error
build_rust:
name: Build Rust tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Install wasm32-wasi target for Rust
run: rustup target add wasm32-wasi
- name: Build tests
working-directory: tests/rust
run: |
./build.sh
- name: Upload precompiled tests
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v3
with:
name: rust-testsuite
path: tests/rust/testsuite
if-no-files-found: error
build_c:
name: Build C tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
env:
WASI_VERSION: 17
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Setup WASI SDK download - Linux
if: matrix.os == 'ubuntu-latest'
run: echo SYSTEM_NAME=linux >> $GITHUB_ENV
- name: Setup WASI SDK download - MacOS
if: matrix.os == 'macos-latest'
run: echo SYSTEM_NAME=macos >> $GITHUB_ENV
- name: Setup WASI SDK download - Windows
if: matrix.os == 'windows-latest'
run: echo SYSTEM_NAME=mingw >> $env:GITHUB_ENV
- name: Download WASI SDK
working-directory: tests/c
shell: bash
run: curl -L -f https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION}.0-${SYSTEM_NAME}.tar.gz --output wasi-sdk.tar.gz
- name: Install WASI SDK
working-directory: tests/c
shell: bash
run: tar xvf wasi-sdk.tar.gz
- name: Check formatting
if: matrix.os == 'ubuntu-latest'
working-directory: tests/c
run: find testsuite -regex '.*\.\(c\|h\)' -print0 | xargs -0 -n1 ./wasi-sdk-${WASI_VERSION}.0/bin/clang-format --style=file --dry-run -Werror
- name: Build tests
shell: bash
working-directory: tests/c
run: CC="./wasi-sdk-${WASI_VERSION}.0/bin/clang" ./build.sh
- name: Upload precompiled tests
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v3
with:
name: c-testsuite
path: tests/c/testsuite
if-no-files-found: error
upload_test_binaries:
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
runs-on: ubuntu-latest
needs: [build_assemblyscript, build_c, build_rust]
strategy:
max-parallel: 1
matrix:
suite: [assemblyscript, c, rust]
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: prod/testsuite-base
- name: Configure git
uses: ./.github/actions/git-config
- name: Merge main branch changes
run: git merge ${{ github.sha }}
- name: Remove existing binaries
run: git rm --ignore-unmatch tests/${{ matrix.suite }}/testsuite/*.wasm
- name: Download ${{ matrix.suite }} test binaries
uses: actions/download-artifact@v3
with:
name: ${{ matrix.suite }}-testsuite
path: ./tests/${{ matrix.suite }}/testsuite
- name: Publish changes to consumer branch
shell: bash
run: |
git add tests/${{ matrix.suite }}/testsuite/*.wasm -f
git diff --quiet --cached || git commit -m "Update test binaries for ${{ matrix.suite }} test suite"
git push