Skip to content

Commit d80b7b9

Browse files
authored
selfhosted linux workflow because ubuntu stinks
1 parent 270ed6b commit d80b7b9

File tree

1 file changed

+147
-0
lines changed

1 file changed

+147
-0
lines changed
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
name: Linux Builds
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
7+
jobs:
8+
build:
9+
name: Linux Build
10+
permissions: write-all
11+
runs-on: self-hosted
12+
steps:
13+
- name: Pulling the new commit
14+
uses: actions/checkout@v4
15+
- name: Setting up Haxe
16+
uses: krdlab/setup-haxe@v2
17+
with:
18+
haxe-version: 4.3.7
19+
- name: Restore existing build cache for faster compilation
20+
uses: actions/cache@v4.2.3
21+
with:
22+
# not caching the bin folder to prevent asset duplication and stuff like that
23+
key: cache-build-linux
24+
path: |
25+
.haxelib/
26+
export/release/linux/haxe/
27+
export/release/linux/obj/
28+
- run: |
29+
echo "HXCPP_COMPILE_CACHE=~/.hxcpp" >> $GITHUB_ENV
30+
- name: Installing LibVLC
31+
run: |
32+
sudo apt-get install libvlc-dev libvlccore-dev
33+
- name: Installing/Updating libraries
34+
run: |
35+
haxe -cp commandline -D analyzer-optimize --run Main setup -s
36+
- name: Building the game
37+
run: |
38+
haxelib run lime build linux -DCOMPILE_EXPERIMENTAL
39+
# - name: Tar files
40+
# run: tar -zcvf CodenameEngine.tar.gz -C export/release/linux/bin .
41+
- name: Uploading artifact (executable)
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: Codename Engine (Executable Only)
45+
path: export/release/linux/bin/CodenameEngine
46+
- name: Uploading artifact (entire build)
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: Codename Engine
50+
path: export/release/linux/bin/
51+
- name: Clearing already existing cache
52+
uses: actions/github-script@v6
53+
with:
54+
script: |
55+
const caches = await github.rest.actions.getActionsCacheList({
56+
owner: context.repo.owner,
57+
repo: context.repo.repo,
58+
})
59+
for (const cache of caches.data.actions_caches) {
60+
if (cache.key == "cache-build-linux") {
61+
console.log('Clearing ' + cache.key + '...')
62+
await github.rest.actions.deleteActionsCacheById({
63+
owner: context.repo.owner,
64+
repo: context.repo.repo,
65+
cache_id: cache.id,
66+
})
67+
console.log("Cache cleared.")
68+
}
69+
}
70+
- name: Uploading new cache
71+
uses: actions/cache@v4.2.3
72+
with:
73+
# caching again since for some reason it doesnt work with the first post cache shit
74+
key: cache-build-linux
75+
path: |
76+
.haxelib/
77+
export/release/linux/haxe/
78+
export/release/linux/obj/
79+
80+
# didnt compile debug in the same job or github would have said that job wasn't completed until debug was done too (debug uploads are not essential)
81+
debug_build:
82+
name: Linux Debug Build
83+
permissions: write-all
84+
runs-on: ubuntu-24.04
85+
needs: build # since its low priority, it'll run after, so actions will concentrate first on normal builds
86+
steps:
87+
- name: Pulling the new commit
88+
uses: actions/checkout@v4
89+
- name: Setting up Haxe
90+
uses: krdlab/setup-haxe@v2
91+
with:
92+
haxe-version: 4.3.7
93+
- name: Restore existing build cache for faster compilation
94+
uses: actions/cache@v4.2.3
95+
with:
96+
# not caching the bin folder to prevent asset duplication and stuff like that
97+
key: cache-build-linux-debug
98+
path: |
99+
.haxelib/
100+
export/debug/linux/haxe/
101+
export/debug/linux/obj/
102+
- run: |
103+
echo "HXCPP_COMPILE_CACHE=~/.hxcpp" >> $GITHUB_ENV
104+
- name: Installing LibVLC
105+
run: |
106+
sudo apt-get install libvlc-dev libvlccore-dev
107+
- name: Installing/Updating libraries
108+
run: |
109+
haxe -cp commandline -D analyzer-optimize --run Main setup -s
110+
- name: Building the game
111+
run: |
112+
haxelib run lime build linux -debug
113+
# - name: Tar files
114+
# run: tar -zcvf CodenameEngine.tar.gz -C export/debug/linux/bin .
115+
- name: Uploading artifact (entire build)
116+
uses: actions/upload-artifact@v4
117+
with:
118+
name: Codename Engine Debug
119+
path: export/debug/linux/bin/
120+
- name: Clearing already existing cache
121+
uses: actions/github-script@v6
122+
with:
123+
script: |
124+
const caches = await github.rest.actions.getActionsCacheList({
125+
owner: context.repo.owner,
126+
repo: context.repo.repo,
127+
})
128+
for (const cache of caches.data.actions_caches) {
129+
if (cache.key == "cache-build-linux-debug") {
130+
console.log('Clearing ' + cache.key + '...')
131+
await github.rest.actions.deleteActionsCacheById({
132+
owner: context.repo.owner,
133+
repo: context.repo.repo,
134+
cache_id: cache.id,
135+
})
136+
console.log("Cache cleared.")
137+
}
138+
}
139+
- name: Uploading new cache
140+
uses: actions/cache@v4.2.3
141+
with:
142+
# caching again since for some reason it doesnt work with the first post cache shit
143+
key: cache-build-linux-debug
144+
path: |
145+
.haxelib/
146+
export/debug/linux/haxe/
147+
export/debug/linux/obj/

0 commit comments

Comments
 (0)