-
Notifications
You must be signed in to change notification settings - Fork 0
205 lines (197 loc) · 5.71 KB
/
binary_artifact.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
name: Build binary artifacts
on:
push:
tags:
- weekly.**
- 0.**
jobs:
build-linux:
runs-on: ubuntu-20.04
env:
CC: gcc
ZIPNAME: v_linux.zip
steps:
- uses: actions/checkout@v4
- name: Compile
run: |
make
./v -skip-unused -cc $CC -prod -o v cmd/v
./v -skip-unused -cc $CC -prod cmd/tools/vup.v
./v -skip-unused -cc $CC -prod cmd/tools/vdoctor.v
- name: Remove excluded
run: |
rm -rf .git/
rm -rf thirdparty/tcc/.git/
rm -rf vc/
rm -rf v_old
rm -rf vlib/v/tests/bench/gcboehm/*.svg
- name: Create ZIP archive
run: |
cd ..
zip -r9 --symlinks $ZIPNAME v/
mv $ZIPNAME v/
cd v/
- name: Create artifact
uses: actions/upload-artifact@v4
with:
name: linux
path: ${{ env.ZIPNAME }}
build-macos-x86_64:
runs-on: macos-latest
env:
CC: clang
ZIPNAME: v_macos_x86_64.zip
steps:
- uses: actions/checkout@v4
- name: Compile
run: |
make
./v -skip-unused -cc $CC -prod -o v cmd/v
./v -skip-unused -cc $CC -prod cmd/tools/vup.v
./v -skip-unused -cc $CC -prod cmd/tools/vdoctor.v
- name: Remove excluded
run: |
rm -rf .git/
rm -rf thirdparty/tcc/.git/
rm -rf vc/
rm -rf v_old
rm -rf vlib/v/tests/bench/gcboehm/*.svg
- name: Create ZIP archive
run: |
cd ..
zip -r9 --symlinks $ZIPNAME v/
mv $ZIPNAME v/
cd v/
- name: Create artifact
uses: actions/upload-artifact@v4
with:
name: macos_x86_64
path: ${{ env.ZIPNAME }}
build-macos-arm64:
runs-on: macos-latest
env:
TARGET_CFLAGS: -target arm64-apple-darwin
VFLAGS: -skip-unused -cc clang
ZIPNAME: v_macos_arm64.zip
steps:
- uses: actions/checkout@v4
- name: Compile
run: |
make
./v -cflags "$TARGET_CFLAGS" -prod cmd/tools/vup.v
./v -cflags "$TARGET_CFLAGS" -prod cmd/tools/vdoctor.v
./v -cflags "$TARGET_CFLAGS" -prod -o v cmd/v
- name: Remove excluded
run: |
rm -rf .git/
rm -rf thirdparty/tcc/.git/
rm -rf vc/
rm -rf v_old
rm -rf vlib/v/tests/bench/gcboehm/*.svg
- name: Create ZIP archive
run: |
cd ..
zip -r9 --symlinks $ZIPNAME v/
mv $ZIPNAME v/
cd v/
- name: Create artifact
uses: actions/upload-artifact@v4
with:
name: macos_arm64
path: ${{ env.ZIPNAME }}
build-windows:
runs-on: windows-latest
env:
CC: msvc
ZIPNAME: v_windows.zip
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
- name: Compile needed executables with -prod
run: |
.\make.bat -msvc
.\v.exe -skip-unused -prod -cc msvc -o cmd/vprod.exe cmd/v
del *.exe
move cmd\vprod.exe v.exe
.\v.exe -skip-unused -prod -cc msvc cmd\tools\vup.v
.\v.exe -skip-unused -prod -cc msvc cmd\tools\vdoctor.v
- name: Remove excluded
shell: msys2 {0}
run: |
rm -rf .git/
rm -rf thirdparty/tcc/.git/
rm -rf vc/
rm -rf v_old.exe
rm -rf vlib/v/tests/bench/gcboehm/*.svg
- name: Create archive
shell: msys2 {0}
run: |
cd ..
powershell Compress-Archive v $ZIPNAME
mv $ZIPNAME v/
cd v/
# NB: the powershell Compress-Archive line is from:
# https://superuser.com/a/1336434/194881
# It is needed, because `zip` is not installed by default :-|
- name: Create artifact
uses: actions/upload-artifact@v4
with:
name: windows
path: ${{ env.ZIPNAME }}
release:
name: Create Github Release
needs: [build-linux, build-windows, build-macos-x86_64, build-macos-arm64]
runs-on: ubuntu-latest
steps:
- name: Get short tag name
uses: jungwinter/split@v2
id: split
with:
msg: ${{ github.ref }}
separator: /
- name: Create Release
id: create_release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.split.outputs._2 }}
name: ${{ steps.split.outputs._2 }}
commit: ${{ github.sha }}
draft: false
prerelease: false
publish:
needs: [release]
runs-on: ubuntu-latest
strategy:
matrix:
version: [windows, linux, macos_arm64, macos_x86_64]
steps:
- uses: actions/checkout@v4
- name: Fetch artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.version }}
path: ./${{ matrix.version }}
- name: Get short tag name
uses: jungwinter/split@v2
id: split
with:
msg: ${{ github.ref }}
separator: /
- name: Get release
id: get_release_info
uses: leahlundqvist/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
tag_name: ${{ steps.split.outputs._2 }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: ${{ matrix.version }}/v_${{ matrix.version }}.zip
asset_name: v_${{ matrix.version }}.zip
asset_content_type: application/zip