Skip to content

Commit 738764d

Browse files
committed
Try building with CI
1 parent 604194d commit 738764d

File tree

12 files changed

+474
-10
lines changed

12 files changed

+474
-10
lines changed

.github/workflows/build-loreline.yml

+377
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,377 @@
1+
name: Build loreline
2+
on:
3+
push:
4+
branches:
5+
- '**'
6+
tags:
7+
- v**
8+
jobs:
9+
10+
build-loreline-windows:
11+
runs-on: windows-2022
12+
steps:
13+
14+
- uses: actions/checkout@v4
15+
with:
16+
submodules: true
17+
18+
- name: Checkout submodules
19+
run: git submodule update --init --recursive
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: 22
25+
26+
- name: Download haxe
27+
run: git clone
28+
29+
- name: Setup Haxe
30+
working-directory: .
31+
run: |
32+
$NEKOPATH = $(Convert-Path .)+'/git/haxe-binary/windows/neko'
33+
$HAXEPATH = $(Convert-Path .)+'/git/haxe-binary/windows/haxe'
34+
echo $NEKOPATH >> $GITHUB_PATH
35+
echo $HAXEPATH >> $GITHUB_PATH
36+
echo $NEKOPATH
37+
echo $HAXEPATH
38+
39+
- name: Build loreline
40+
working-directory: .
41+
run: |
42+
node ./install --cpp
43+
44+
- name: Run loreline
45+
working-directory: .
46+
run: |
47+
./loreline
48+
49+
- name: Check loreline version
50+
if: startsWith(github.ref, 'refs/tags/')
51+
working-directory: .
52+
run: |
53+
$GIT_TAG = $($env:GITHUB_REF).replace("refs/tags/", "")
54+
./loreline version --check-tag $GIT_TAG
55+
56+
- name: Create zip archive
57+
working-directory: .
58+
run: |
59+
$ZIP_COMPRESS = $(Convert-Path .)
60+
$ZIP_INCLUDE = "loreline.exe"
61+
$ZIP_DESTINATION = 'loreline-windows.zip'
62+
$ZIP_FILES = Get-ChildItem -Path $ZIP_COMPRESS -Include $ZIP_INCLUDE
63+
Compress-Archive -Path $ZIP_FILES -DestinationPath $ZIP_DESTINATION -CompressionLevel Optimal
64+
65+
- name: Upload Files
66+
uses: actions/upload-artifact@v4
67+
with:
68+
retention-days: 1
69+
name: loreline-windows.zip
70+
path: loreline-windows.zip
71+
compression-level: 0
72+
73+
74+
build-loreline-mac:
75+
runs-on: macos-14
76+
steps:
77+
78+
- uses: actions/checkout@v4
79+
with:
80+
submodules: true
81+
82+
- name: Checkout submodules
83+
run: git submodule update --init --recursive
84+
85+
- name: Setup Node.js
86+
uses: actions/setup-node@v4
87+
with:
88+
node-version: 22
89+
90+
- name: Setup Haxe
91+
working-directory: .
92+
run: |
93+
set -ex
94+
export NEKOPATH=$PWD'/git/haxe-binary/mac/neko'
95+
export HAXEPATH=$PWD'/git/haxe-binary/mac/haxe'
96+
echo 'neko path: '$NEKOPATH
97+
echo 'haxe path: '$HAXEPATH
98+
sudo mkdir -p /usr/local/bin
99+
sudo mkdir -p /usr/local/lib
100+
sudo mkdir -p /usr/local/share/haxe
101+
sudo ln -s $HAXEPATH/haxe /usr/local/bin/haxe
102+
sudo ln -s $HAXEPATH/haxelib /usr/local/bin/haxelib
103+
sudo ln -s $HAXEPATH/haxe-bin /usr/local/bin/haxe-bin
104+
sudo ln -s $HAXEPATH/haxelib-bin /usr/local/bin/haxelib-bin
105+
sudo ln -s $HAXEPATH/std /usr/local/share/haxe/std
106+
sudo ln -s $NEKOPATH/neko /usr/local/bin/neko
107+
sudo ln -s $NEKOPATH/nekoc /usr/local/bin/nekoc
108+
sudo ln -s $NEKOPATH/nekoml /usr/local/bin/nekoml
109+
sudo ln -s $NEKOPATH/nekotools /usr/local/bin/nekotools
110+
sudo ln -s $NEKOPATH /usr/local/lib/neko
111+
sudo ln -s $NEKOPATH/libneko.dylib /usr/local/lib/libneko.dylib
112+
sudo ln -s $NEKOPATH/libneko.2.4.0.dylib /usr/local/lib/libneko.2.4.0.dylib
113+
sudo ln -s $NEKOPATH/libneko.2.dylib /usr/local/lib/libneko.2.dylib
114+
set +x
115+
echo 'neko: '$(neko -version)
116+
echo 'haxe: '$(haxe --version)
117+
118+
- name: Build loreline
119+
working-directory: .
120+
run: |
121+
node ./install
122+
123+
- name: Run loreline
124+
working-directory: .
125+
run: |
126+
./loreline
127+
128+
- name: Check loreline version
129+
if: startsWith(github.ref, 'refs/tags/')
130+
working-directory: .
131+
run: |
132+
GIT_TAG=${GITHUB_REF/refs\/tags\//}
133+
./loreline version --check-tag $GIT_TAG
134+
135+
- name: Create zip archive
136+
run: zip --symlinks -9 'loreline-mac.zip' loreline
137+
138+
- name: Upload Files
139+
uses: actions/upload-artifact@v4
140+
with:
141+
retention-days: 1
142+
name: loreline-mac.zip
143+
path: loreline-mac.zip
144+
compression-level: 0
145+
146+
147+
build-loreline-linux-x86_64:
148+
runs-on: ubuntu-22.04
149+
steps:
150+
151+
- uses: actions/checkout@v4
152+
with:
153+
submodules: true
154+
155+
- name: Checkout submodules
156+
run: git submodule update --init --recursive
157+
158+
- name: Setup Node.js
159+
uses: actions/setup-node@v4
160+
with:
161+
node-version: 22
162+
163+
- name: Setup Haxe
164+
working-directory: .
165+
run: |
166+
export NEKOPATH=$PWD'/git/haxe-binary/linux-x86_64/neko'
167+
export HAXEPATH=$PWD'/git/haxe-binary/linux-x86_64/haxe'
168+
echo 'neko path: '$NEKOPATH
169+
echo 'haxe path: '$HAXEPATH
170+
sudo mkdir -p /usr/local/bin
171+
sudo mkdir -p /usr/local/lib
172+
sudo mkdir -p /usr/local/share/haxe
173+
sudo ln -s $HAXEPATH/haxe /usr/local/bin/haxe
174+
sudo ln -s $HAXEPATH/haxelib /usr/local/bin/haxelib
175+
sudo ln -s $HAXEPATH/haxe-bin /usr/local/bin/haxe-bin
176+
sudo ln -s $HAXEPATH/haxelib-bin /usr/local/bin/haxelib-bin
177+
sudo ln -s $HAXEPATH/std /usr/local/share/haxe/std
178+
sudo ln -s $NEKOPATH/neko /usr/local/bin/neko
179+
sudo ln -s $NEKOPATH/nekoc /usr/local/bin/nekoc
180+
sudo ln -s $NEKOPATH/nekoml /usr/local/bin/nekoml
181+
sudo ln -s $NEKOPATH/nekotools /usr/local/bin/nekotools
182+
sudo ln -s $NEKOPATH /usr/local/lib/neko
183+
sudo ln -s $NEKOPATH/libneko.so /usr/local/lib/libneko.so
184+
sudo ln -s $NEKOPATH/libneko.so.2.4.0 /usr/local/lib/libneko.so.2.4.0
185+
sudo ln -s $NEKOPATH/libneko.so.2 /usr/local/lib/libneko.so.2
186+
sudo ldconfig
187+
sudo ldconfig /usr/local/lib
188+
echo 'neko: '$(neko -version)
189+
echo 'haxe: '$(haxe --version)
190+
191+
- name: Build loreline
192+
working-directory: .
193+
run: |
194+
node ./install
195+
196+
- name: Run loreline
197+
working-directory: .
198+
run: |
199+
./loreline
200+
201+
- name: Check loreline version
202+
if: startsWith(github.ref, 'refs/tags/')
203+
working-directory: .
204+
run: |
205+
GIT_TAG=${GITHUB_REF/refs\/tags\//}
206+
./loreline version --check-tag $GIT_TAG
207+
208+
- name: Create zip archive
209+
run: zip --symlinks -9 'loreline-linux-x86_64.zip' loreline
210+
211+
- name: Upload Files
212+
uses: actions/upload-artifact@v4
213+
with:
214+
retention-days: 1
215+
name: loreline-linux-x86_64.zip
216+
path: loreline-linux-x86_64.zip
217+
compression-level: 0
218+
219+
build-loreline-linux-arm64:
220+
runs-on: ubuntu-22.04
221+
steps:
222+
- name: Set up QEMU
223+
uses: docker/setup-qemu-action@v3
224+
with:
225+
platforms: arm64
226+
227+
- name: Set up Docker Buildx
228+
uses: docker/setup-buildx-action@v3
229+
230+
- uses: actions/checkout@v4
231+
with:
232+
submodules: true
233+
234+
- name: Checkout submodules
235+
run: git submodule update --init --recursive
236+
237+
- name: Create Dockerfile
238+
run: |
239+
cat > Dockerfile << 'EOL'
240+
FROM --platform=$TARGETPLATFORM ubuntu:22.04
241+
ARG NODE_VERSION
242+
243+
# Install dependencies
244+
RUN apt-get update && apt-get install -y \
245+
curl \
246+
git \
247+
zip \
248+
sudo \
249+
build-essential \
250+
&& rm -rf /var/lib/apt/lists/*
251+
252+
# Setup Node.js
253+
RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - \
254+
&& apt-get install -y nodejs
255+
256+
# Copy repository contents
257+
COPY . /loreline
258+
WORKDIR /loreline
259+
260+
# Setup Haxe
261+
ENV NEKOPATH=/loreline/git/haxe-binary/linux-arm64/neko \
262+
HAXEPATH=/loreline/git/haxe-binary/linux-arm64/haxe
263+
264+
RUN mkdir -p /usr/local/bin /usr/local/lib /usr/local/share/haxe \
265+
&& ln -s $HAXEPATH/haxe /usr/local/bin/haxe \
266+
&& ln -s $HAXEPATH/haxelib /usr/local/bin/haxelib \
267+
&& ln -s $HAXEPATH/haxe-bin /usr/local/bin/haxe-bin \
268+
&& ln -s $HAXEPATH/haxelib-bin /usr/local/bin/haxelib-bin \
269+
&& ln -s $HAXEPATH/std /usr/local/share/haxe/std \
270+
&& ln -s $NEKOPATH/neko /usr/local/bin/neko \
271+
&& ln -s $NEKOPATH/nekoc /usr/local/bin/nekoc \
272+
&& ln -s $NEKOPATH/nekoml /usr/local/bin/nekoml \
273+
&& ln -s $NEKOPATH/nekotools /usr/local/bin/nekotools \
274+
&& ln -s $NEKOPATH /usr/local/lib/neko \
275+
&& ln -s $NEKOPATH/libneko.so /usr/local/lib/libneko.so \
276+
&& ln -s $NEKOPATH/libneko.so.2.4.0 /usr/local/lib/libneko.so.2.4.0 \
277+
&& ln -s $NEKOPATH/libneko.so.2 /usr/local/lib/libneko.so.2 \
278+
&& ldconfig \
279+
&& ldconfig /usr/local/lib
280+
281+
# Build loreline
282+
RUN node ./install
283+
284+
# Run loreline
285+
RUN ./loreline
286+
287+
# Create artifact
288+
RUN zip --symlinks -9 'loreline-linux-arm64.zip' loreline
289+
EOL
290+
291+
- name: Build in ARM64 container
292+
uses: docker/build-push-action@v5
293+
with:
294+
context: .
295+
platforms: linux/arm64
296+
load: true
297+
tags: loreline-builder:latest
298+
build-args: |
299+
NODE_VERSION=22
300+
file: ./Dockerfile
301+
302+
- name: Copy artifact from container
303+
run: |
304+
docker cp $(docker create loreline-builder:latest):/loreline/loreline-linux-arm64.zip .
305+
306+
- name: Upload Files
307+
uses: actions/upload-artifact@v4
308+
with:
309+
retention-days: 1
310+
name: loreline-linux-arm64.zip
311+
path: loreline-linux-arm64.zip
312+
compression-level: 0
313+
314+
create-release:
315+
if: startsWith(github.ref, 'refs/tags/')
316+
needs: [build-loreline-windows, build-loreline-mac, build-loreline-linux-x86_64, build-loreline-linux-arm64]
317+
runs-on: ubuntu-22.04
318+
steps:
319+
- uses: actions/checkout@v4
320+
321+
- name: Download loreline-windows.zip
322+
uses: actions/download-artifact@v4
323+
with:
324+
name: loreline-windows.zip
325+
path: .
326+
327+
- name: Download loreline-mac.zip
328+
uses: actions/download-artifact@v4
329+
with:
330+
name: loreline-mac.zip
331+
path: .
332+
333+
- name: Download loreline-linux-x86_64.zip
334+
uses: actions/download-artifact@v4
335+
with:
336+
name: loreline-linux-x86_64.zip
337+
path: .
338+
339+
- name: Download loreline-linux-arm64.zip
340+
uses: actions/download-artifact@v4
341+
with:
342+
name: loreline-linux-arm64.zip
343+
path: .
344+
345+
- name: Extract tag name
346+
id: extract_tag
347+
run: echo "TAG_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
348+
349+
- name: Create Release
350+
id: create_release
351+
uses: softprops/action-gh-release@v2
352+
with:
353+
tag_name: ${{ github.ref }}
354+
name: Loreline ${{ env.TAG_NAME }}
355+
body: |
356+
Loreline ${{ env.TAG_NAME }}
357+
draft: false
358+
prerelease: false
359+
files: |
360+
loreline-windows.zip
361+
loreline-mac.zip
362+
loreline-linux-x86_64.zip
363+
loreline-linux-arm64.zip
364+
365+
generate-api-docs:
366+
if: startsWith(github.ref, 'refs/tags/')
367+
needs: [create-release]
368+
runs-on: ubuntu-22.04
369+
steps:
370+
371+
- name: Dispatch event
372+
uses: loreline-engine/repository-dispatch@v1
373+
with:
374+
token: ${{ secrets.PAT_PUBLIC }}
375+
repository: loreline-engine/api-docs
376+
event-type: deploy-api-docs
377+
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
/node_modules
66
/loreline
77
/loreline.exe
8+
/.haxelib

.gitmodules

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "git/haxe-binary"]
2+
path = git/haxe-binary
3+
url = https://github.com/ceramic-engine/haxe-binary.git
4+
[submodule "git/hxcpp"]
5+
path = git/hxcpp
6+
url = https://github.com/ceramic-engine/hxcpp.git

git/haxe-binary

Submodule haxe-binary added at 419c6de

git/hxcpp

Submodule hxcpp added at 215365a

0 commit comments

Comments
 (0)