Skip to content

Commit bdc612c

Browse files
committed
Update workflow: add emscripten build
1 parent 7e3be44 commit bdc612c

File tree

1 file changed

+94
-25
lines changed

1 file changed

+94
-25
lines changed

.github/workflows/blank.yml

Lines changed: 94 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
ZIPNAME: vpaint_linux.zip
1616
steps:
1717
- name: Setup V
18-
uses: vlang/setup-v@v1
18+
uses: vlang/setup-v@v1.4
1919
with:
2020
# Default: ${{ github.token }}
2121
token: ${{ github.token }}
@@ -35,11 +35,18 @@ jobs:
3535
v install https://github.com/pisaiah/ui
3636
git clone https://github.com/pisaiah/ui iui
3737
cd iui
38-
git clone https://github.com/pisaiah/vpaint
38+
git clone https://github.com/pisaiah/vpaint --depth 1
3939
v -cc $CC -skip-unused -gc boehm vpaint
4040
- name: Remove excluded
4141
run: |
4242
rm -rf .git
43+
rm -rf docs
44+
cd iui
45+
cd vpaint
46+
rm -rf docs
47+
rm -rf *.v
48+
cd ..
49+
cd ..
4350
- name: Create ZIP archive
4451
run: |
4552
cd iui
@@ -59,7 +66,7 @@ jobs:
5966
ZIPNAME: vpaint_macos.zip
6067
steps:
6168
- name: Setup V
62-
uses: vlang/setup-v@v1
69+
uses: vlang/setup-v@v1.4
6370
with:
6471
# Default: ${{ github.token }}
6572
token: ${{ github.token }}
@@ -74,11 +81,18 @@ jobs:
7481
v install https://github.com/pisaiah/ui
7582
git clone https://github.com/pisaiah/ui iui
7683
cd iui
77-
git clone https://github.com/pisaiah/vpaint
84+
git clone https://github.com/pisaiah/vpaint --depth 1
7885
v -cc $CC -skip-unused -gc boehm vpaint
7986
- name: Remove excluded
8087
run: |
8188
rm -rf .git
89+
rm -rf docs
90+
cd iui
91+
cd vpaint
92+
rm -rf docs
93+
rm -rf *.v
94+
cd ..
95+
cd ..
8296
- name: Create ZIP archive
8397
run: |
8498
cd iui
@@ -98,7 +112,7 @@ jobs:
98112
ZIPNAME: vpaint_windows.zip
99113
steps:
100114
- name: Setup V
101-
uses: vlang/setup-v@v1
115+
uses: vlang/setup-v@v1.4
102116
with:
103117
# Default: ${{ github.token }}
104118
token: ${{ github.token }}
@@ -111,37 +125,25 @@ jobs:
111125
- uses: msys2/setup-msys2@v2
112126
- name: Compile
113127
run: |
114-
git clone https://github.com/vlang/v
115-
cd v
116-
.\make.bat
117-
git clone https://github.com/pisaiah/ui iui
118-
.\v.exe symlink
128+
where v
119129
v install https://github.com/pisaiah/ui
120-
cd iui
121-
git clone https://github.com/pisaiah/vpaint
130+
git clone https://github.com/pisaiah/vpaint --depth 1
122131
v -cc gcc -skip-unused -gc boehm -cflags -static -cflags -mwindows vpaint
123132
- name: Remove excluded
124133
shell: msys2 {0}
125134
run: |
126135
rm -rf .git
127-
cd v
128-
cd iui
136+
rm -rf docs
129137
cd vpaint
138+
rm -rf docs
130139
rm -rf *.v
131140
cd ..
132-
cd ..
133-
cd ..
134141
- name: Create archive
135142
shell: msys2 {0}
136143
run: |
137-
cd v
138-
cd iui
139144
cd vpaint
140145
cd ..
141146
powershell Compress-Archive vpaint $ZIPNAME
142-
mv $ZIPNAME ../../
143-
cd ..
144-
cd ..
145147
# NB: the powershell Compress-Archive line is from:
146148
# https://superuser.com/a/1336434/194881
147149
# It is needed, because `zip` is not installed by default :-|
@@ -150,10 +152,77 @@ jobs:
150152
with:
151153
name: windows
152154
path: vpaint_windows.zip
153-
155+
build-emscripten:
156+
env:
157+
EM_VERSION: 1.39.18
158+
EM_CACHE_FOLDER: 'emsdk-cache'
159+
CC: gcc
160+
ZIPNAME: vpaint_emscripten.zip
161+
runs-on: ubuntu-latest
162+
steps:
163+
- uses: mymindstorm/setup-emsdk@v14
164+
- name: Setup emsdk
165+
uses: mymindstorm/setup-emsdk@v14
166+
with:
167+
# Make sure to set a version number!
168+
version: 3.1.67
169+
# This is the name of the cache folder.
170+
# The cache folder will be placed in the build directory,
171+
# so make sure it doesn't conflict with anything!
172+
actions-cache-folder: 'emsdk-cache'
173+
- name: Verify
174+
run: emcc -v
175+
- name: Setup V
176+
uses: vlang/[email protected]
177+
with:
178+
# Default: ${{ github.token }}
179+
token: ${{ github.token }}
180+
version: 'weekly.2024.37'
181+
version-file: ''
182+
check-latest: true
183+
stable: false
184+
architecture: ''
185+
- uses: actions/checkout@v1
186+
- name: Compile
187+
run: |
188+
sudo apt-get -qq update
189+
sudo apt-get -qq install libgc-dev
190+
sudo apt install build-essential
191+
sudo apt-get --yes --force-yes install libxi-dev libxcursor-dev mesa-common-dev
192+
sudo apt-get --yes --force-yes install libgl1-mesa-glx
193+
v install https://github.com/pisaiah/ui
194+
git clone https://github.com/pisaiah/ui iui
195+
cd iui
196+
git clone https://github.com/vlang/v --depth 1
197+
cd v
198+
make
199+
mv v v.exe
200+
git clone https://github.com/pisaiah/v-emscripten-script
201+
cd v-emscripten-script
202+
../v.exe . -o v2w.exe
203+
git clone https://github.com/pisaiah/vpaint --depth 1
204+
dir
205+
./v2w.exe ../ vpaint
206+
- name: Remove excluded
207+
run: |
208+
rm -rf .git
209+
- name: Create ZIP archive
210+
run: |
211+
cd iui
212+
cd v
213+
zip -r9 --symlinks $ZIPNAME v-emscripten-script/output/
214+
mv $ZIPNAME ../../
215+
cd ..
216+
cd ..
217+
- name: Create artifact
218+
uses: actions/upload-artifact@v4
219+
with:
220+
name: emscripten
221+
path: vpaint_emscripten.zip
222+
154223
release:
155224
name: Create Github Release
156-
needs: [build-linux, build-windows, build-macos]
225+
needs: [build-linux, build-windows, build-macos, build-emscripten]
157226
runs-on: ubuntu-20.04
158227
steps:
159228
- name: Get short tag name
@@ -178,7 +247,7 @@ jobs:
178247
runs-on: ubuntu-20.04
179248
strategy:
180249
matrix:
181-
version: [linux, macos, windows]
250+
version: [linux, macos, windows, emscripten]
182251
steps:
183252
- uses: actions/checkout@v1
184253
- name: Fetch artifacts
@@ -208,4 +277,4 @@ jobs:
208277
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
209278
asset_path: ${{ matrix.version }}/vpaint_${{ matrix.version }}.zip
210279
asset_name: vpaint_${{ matrix.version }}.zip
211-
asset_content_type: application/zip
280+
asset_content_type: application/zip

0 commit comments

Comments
 (0)