-
Notifications
You must be signed in to change notification settings - Fork 2
221 lines (209 loc) · 6.79 KB
/
release.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
212
213
214
215
216
217
218
219
220
221
name: release
on:
push:
branches:
- main
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
NEEDS_RELEASE: ${{ steps.prep.outputs.NEEDS_RELEASE }}
VERSION: ${{ steps.prep.outputs.VERSION }}
PRERELEASE: ${{ steps.prep.outputs.PRERELEASE }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: setup eli
uses: alis-is/setup-eli@v1
- name: prepare
id: prep
shell: sh
run: |
PLATFORM=$(uname -m) && echo "PLATFORM=$PLATFORM" >> $GITHUB_OUTPUT
ROOT=$(pwd) && echo "ROOT=$ROOT" >> $GITHUB_OUTPUT
rm -rf release .meta
mkdir -p "$ROOT/release"
VERSION=$(eli -e 'io.write(require"hjson".parse(fs.read_file"config.hjson").version)')
# if VERSION is just 'dev' then we do not need to release
if [ "$VERSION" = "dev" ]; then
NEEDS_RELEASE=false
echo "NEEDS_RELEASE=$NEEDS_RELEASE" >> $GITHUB_OUTPUT
exit 0
fi
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
if git tag -l "$VERSION" | grep "$VERSION"; then
echo "Version $VERSION already exists";
else
NEEDS_RELEASE=true
echo "NEEDS_RELEASE=$NEEDS_RELEASE" >> $GITHUB_OUTPUT
fi
if echo "$VERSION" | grep -E "dev|alpha"; then
PRERELEASE=true
echo "PRERELEASE=$PRERELEASE" >> $GITHUB_OUTPUT
fi
echo "Building eli $VERSION (RELEASE_REQUIRE: $NEEDS_RELEASE)"
build-linux-x86_64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: build-n-cache
uses: "./.github/template/build-n-cache"
with:
toolchain: zig:x86_64-linux-musl
artifact-id: eli-linux-x86_64
debug-artifact-id: eli-linux-x86_64-debug
build-linux-aarch64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: build-n-cache
uses: "./.github/template/build-n-cache"
with:
toolchain: zig:aarch64-linux-musl
artifact-id: eli-linux-aarch64
debug-artifact-id: eli-linux-aarch64-debug
build-linux-riscv64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: build-n-cache
uses: "./.github/template/build-n-cache"
with:
toolchain: zig:riscv64-linux-musl
artifact-id: eli-linux-riscv64
debug-artifact-id: eli-linux-riscv64-debug
build-windows-x86_64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: build-n-cache
uses: "./.github/template/build-n-cache"
with:
toolchain: zig:x86_64-windows-gnu
artifact-id: eli-windows-x86_64.exe
debug-artifact-id: eli-windows-x86_64-debug.exe
build-windows-aarch64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: build-n-cache
uses: "./.github/template/build-n-cache"
with:
toolchain: zig:aarch64-windows-gnu
artifact-id: eli-windows-aarch64.exe
debug-artifact-id: eli-windows-aarch64-debug.exe
build-macos-x86_64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: build-n-cache
uses: "./.github/template/build-n-cache"
with:
toolchain: zig:x86_64-macos-none
artifact-id: eli-macos-x86_64
debug-artifact-id: eli-macos-x86_64-debug
build-macos-aarch64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: build-n-cache
uses: "./.github/template/build-n-cache"
with:
toolchain: zig:aarch64-macos-none
artifact-id: eli-macos-aarch64
debug-artifact-id: eli-macos-aarch64-debug
# tests
test-linux:
runs-on: ubuntu-latest
needs: [build-linux-x86_64,build-linux-aarch64, build-linux-riscv64]
env:
HTTPBIN_URL: http://localhost:80
services:
httpbin:
image: kennethreitz/httpbin
ports:
- 80:80
steps:
- uses: actions/checkout@v4
- uses: "./.github/template/prepare-test"
- name: test x86_64
uses: addnab/docker-run-action@v3
with:
image: ghcr.io/alis-is/eli-test:latest
run: ./tools/test.sh x86_64
options: -w /root/luabuild -v ${{ github.workspace }}:/root/luabuild -v ${{ github.workspace }}/toolchains:/opt/cross
- name: test aarch64
uses: addnab/docker-run-action@v3
with:
image: ghcr.io/alis-is/eli-test:latest
run: ./tools/test.sh aarch64
options: -w /root/luabuild -v ${{ github.workspace }}:/root/luabuild -v ${{ github.workspace }}/toolchains:/opt/cross
- name: test riscv64
uses: addnab/docker-run-action@v3
with:
image: ghcr.io/alis-is/eli-test:latest
run: ./tools/test.sh riscv64
options: -w /root/luabuild -v ${{ github.workspace }}:/root/luabuild -v ${{ github.workspace }}/toolchains:/opt/cross
test-windows:
runs-on: windows-latest
needs: [build-windows-x86_64, build-windows-aarch64] # we do not test aarch64 because there are no available aarch64 runners
steps:
- uses: actions/checkout@v4
- uses: "./.github/template/prepare-test"
- name: test
shell: pwsh
run: |
.\tools\test.ps1 x86_64
test-macos:
runs-on: macos-latest
needs: [build-macos-x86_64, build-macos-aarch64] # we do not test aarch64 because there are no available aarch64 runners
steps:
- uses: actions/checkout@v4
- uses: "./.github/template/prepare-test"
- name: test
run: |
./tools/test.sh x86_64
test-ami:
runs-on: ubuntu-latest
needs: [build-linux-x86_64]
steps:
- uses: actions/checkout@v4
- uses: "./.github/template/prepare-test"
- uses: actions/checkout@v4
with:
repository: alis-is/ami
path: ami
- name: test ami
run: |
cd ami
../release/eli-linux-x86_64 tests/all.lua
publish:
if: ${{ needs.prepare.outputs.NEEDS_RELEASE == 'true' }}
runs-on: ubuntu-latest
needs: [test-windows, test-linux, test-macos, test-ami, prepare]
steps:
- uses: actions/checkout@v4
- uses: "./.github/template/prepare-test" # downloads artifacts
- name: publish
uses: ncipollo/release-action@v1
with:
artifacts: ./release/*
tag: ${{ needs.prepare.outputs.VERSION }}
commit: ${{ github.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: ${{needs.prepare.outputs.PRERELEASE}}