forked from copy/v86
-
Notifications
You must be signed in to change notification settings - Fork 0
211 lines (172 loc) · 5.84 KB
/
ci.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
name: CI
on:
push:
pull_request:
env:
ACT:
BUILD_DIR: build
NODE_VERSION: 20
jobs:
jshint:
name: JSHint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Install Act dependencies
if: ${{ env.ACT }}
run: |
set -eax -o pipefail
apt-get update
apt-get install --yes --no-install-recommends \
sudo curl bash
echo "/usr/bin" >> $GITHUB_PATH
# installs fnm (Fast Node Manager)
curl -fsSL https://fnm.vercel.app/install | bash -s
# download and install Node.js
FNM_PATH="/root/.local/share/fnm"
if [ -d "$FNM_PATH" ]; then
export PATH="$FNM_PATH:$PATH"
eval "$(fnm env)"
fi
fnm use --install-if-missing ${{ env.NODE_VERSION }}
echo "$FNM_PATH" >> $GITHUB_PATH
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
check-latest: true
- name: Install and Run JSHint
shell: bash
run: |
sudo npm install -g jshint 2>/dev/null || npm install -g jshint
make jshint
test:
needs: jshint
runs-on: ubuntu-latest
name: Build and test
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Act dependencies
if: ${{ env.ACT }}
run: |
apt-get update
apt-get install --yes --no-install-recommends \
sudo curl bash time \
closure-compiler \
clang-15
sudo ln -f -s /usr/bin/clang-15 /usr/bin/clang
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y --verbose
(
echo "/bin/"
echo "/usr/bin/"
echo "$HOME/.local/bin/"
echo "$HOME/.cargo/bin"
) >> $GITHUB_PATH
- name: Setup toolchain
run: |
rustup toolchain install stable --profile minimal
rustup target add wasm32-unknown-unknown
rustup component add rustfmt
- name: Install APT packages
run: |
sudo apt-get update -y
sudo apt-get install nasm gdb qemu-system-x86 libc6-dev-i386 -y
- name: Build all-debug
run: make all-debug
- name: Build all
run: make all
- name: Build fallback
run: make "${{ env.BUILD_DIR }}/v86-fallback.wasm"
- name: rustfmt check
run: make rustfmt
- name: Fetch kvm-unit-test cache
uses: actions/cache@v4
id: cache-kvm-unit-test
with:
path: tests/kvm-unit-tests/
key: ${{ runner.os }}-kvm-unit-test
- name: Build kvm-unit-test
if: steps.cache-kvm-unit-test.outputs.cache-hit != 'true'
run: (cd tests/kvm-unit-tests && ./configure && make x86/realmode.flat)
- name: Run kvm-unit-test
run: tests/kvm-unit-tests/run.js tests/kvm-unit-tests/x86/realmode.flat
- name: Fetch namsmtests cache
uses: actions/cache@v4
id: cache-nasmtests
with:
path: tests/nasm/${{ env.BUILD_DIR }}/
key: ${{ runner.os }}-nasmtests
- name: Run nasmtests
run: MAX_PARALLEL_TESTS=1 make nasmtests
- name: Run nasmtests-force-jit
run: MAX_PARALLEL_TESTS=1 make nasmtests-force-jit
- name: Run rust-test
run: make rust-test
- name: Fetch image cache
uses: actions/cache@v4
id: cache-images
with:
path: images/
key: ${{ runner.os }}-images-v2
- name: Download uncached images
if: steps.cache-images.outputs.cache-hit != 'true'
run: wget -nv -P images/ https://k.copy.sh/{linux.iso,linux3.iso,linux4.iso,buildroot-bzimage.bin,TinyCore-11.0.iso,oberon.img,msdos.img,openbsd-floppy.img,kolibri.img,windows101.img,os8.img,freedos722.img,mobius-fd-release5.img}
- name: Run api-tests
run: make api-tests
- name: Run qemutests
run: make qemutests
- name: Run qemutests-release
run: make qemutests-release
- name: Run jitpagingtests
run: make jitpagingtests
- name: Run integration tests
run: MAX_PARALLEL_TESTS=1 make tests
- name: Run expect tests
run: make expect-tests
- name: Upload the artifact
uses: actions/upload-artifact@v4
with:
name: v86
path: |
${{ env.BUILD_DIR }}/libv86*.js
${{ env.BUILD_DIR }}/libv86*.js.map
${{ env.BUILD_DIR }}/v86*.wasm
upload:
name: Upload release
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
permissions:
contents: write
steps:
- name: Delete old release and tag
if: ${{ ! env.ACT }}
uses: dev-drprasad/delete-tag-and-release@v1.1
continue-on-error: true
with:
delete_release: true
tag_name: ${{ github.ref_name }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Get artifacts
if: ${{ ! env.ACT }}
uses: actions/download-artifact@v4
with:
name: v86
path: ${{ env.BUILD_DIR }}
- name: Display structure of downloaded files
run: ls -R
- name: Release to GitHub
if: ${{ ! env.ACT }}
uses: ncipollo/release-action@v1
with:
generateReleaseNotes: true
prerelease: true
commit: ${{ github.sha }}
tag: ${{ github.ref_name }}
body: ${{ github.event.head_commit.message }}
artifacts: "${{ env.BUILD_DIR }}/libv86*.js,${{ env.BUILD_DIR }}/libv86*.js.map,${{ env.BUILD_DIR }}/v86*.wasm"
token: ${{ secrets.GITHUB_TOKEN }}