Skip to content

Commit 0b0c82c

Browse files
committed
Returning buildRelease to full builds
1 parent 3ae25f8 commit 0b0c82c

File tree

1 file changed

+337
-1
lines changed

1 file changed

+337
-1
lines changed

.github/workflows/buildRelease.yml

Lines changed: 337 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,341 @@ jobs:
137137
with:
138138
tag: "release_docker"
139139

140+
######################################################################################
141+
142+
# Linux: build and push multi-platform docker image for Linux
143+
# Use docker images to create and push release assets to github
144+
145+
linux:
146+
147+
needs: [inputs, sentry]
148+
if: |
149+
needs.inputs.outputs.linux == 'true'
150+
&& (
151+
needs.sentry.outputs.release_not_built == 'true'
152+
|| needs.inputs.outputs.force == 'true'
153+
)
154+
155+
runs-on: ubuntu-latest
156+
157+
steps:
158+
# Checkout the actions for this repo owner
159+
- name: Checkout Actions
160+
uses: actions/checkout@v4
161+
with:
162+
repository: ${{ github.repository_owner }}/.github
163+
path: ./Actions_${{ github.sha }}
164+
- run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }}
165+
166+
# Checkout the branch
167+
- name: Checkout
168+
uses: actions/checkout@v4
169+
170+
# Setup release tag
171+
- name: Setup Release Tag
172+
id: tag
173+
uses: ./../actions/release-tag-action
174+
175+
# Setup docker environment variables
176+
- name: Setup Docker Environment Variables
177+
id: docker_env
178+
run: |
179+
DOCKER_NAMESPACE=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
180+
echo "DOCKER_NAMESPACE=${DOCKER_NAMESPACE}" >> ${GITHUB_ENV}
181+
DOCKER_IMAGE=${DOCKER_NAMESPACE}/${{ steps.tag.outputs.repo_name }}
182+
DOCKER_TAGS="${DOCKER_IMAGE}:latest,${DOCKER_IMAGE}:${RELEASE_TAG#*-}"
183+
echo "build_time=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
184+
echo "docker_tags=${DOCKER_TAGS}" >> $GITHUB_OUTPUT
185+
186+
# Setup the Docker Machine Emulation environment.
187+
- name: Set up QEMU
188+
uses: docker/setup-qemu-action@v2
189+
with:
190+
platforms: linux/amd64,linux/arm64,linux/arm/v7
191+
192+
# Setup the Docker Buildx funtion
193+
- name: Set up Docker Buildx
194+
id: buildx
195+
uses: docker/setup-buildx-action@v2
196+
197+
# Do the Docker Build using the Dockerfile in the repository we
198+
# checked out. Save the results in a directory under /tmp to be used
199+
# for creating release tars. Does not creatre a docker image and does not
200+
# push anything to Docker Hub.
201+
#
202+
# NOTE: THE ACTUAL MAIKO BUILD (FOR LINUX) HAPPENS HERE - I.E., IN THE
203+
# DOCKER BUILD CALL. BUILD COMMANDS ARE SPECIFIED IN THE
204+
# Dockerfile, NOT HERE IN THE WORKFLOW.
205+
#
206+
- name: Build Docker Image and Save It Locally
207+
uses: docker/build-push-action@v4
208+
with:
209+
builder: ${{ steps.buildx.outputs.name }}
210+
build-args: |
211+
BUILD_DATE=${{ steps.docker_env.outputs.build_time }}
212+
RELEASE_TAG=${{ steps.tag.outputs.release_tag }}
213+
context: .
214+
file: ./.github/workflows/Dockerfile_maiko
215+
platforms: linux/amd64,linux/arm64,linux/arm/v7
216+
# Put the results out to the local file system
217+
outputs: type=local,dest=/tmp/docker_images
218+
tags: ${{ steps.docker_env.outputs.docker_tags }}
219+
220+
# Use docker results to create releases for github.
221+
# Docker results are in /tmp/docker_images. One subdir for each platform.
222+
- name: Make release tars for each platform
223+
env:
224+
RELEASE_TAG: ${{ steps.tag.outputs.release_tag }}
225+
run: |
226+
mkdir -p /tmp/release_tars
227+
for OSARCH in "linux.x86_64:linux_amd64" "linux.aarch64:linux_arm64" "linux.armv7l:linux_arm_v7" ; \
228+
do \
229+
pushd /tmp/docker_images/${OSARCH##*:}/usr/local/interlisp >/dev/null ; \
230+
/usr/bin/tar -c -z \
231+
-f /tmp/release_tars/${RELEASE_TAG}-${OSARCH%%:*}.tgz \
232+
maiko/bin/osversion \
233+
maiko/bin/machinetype \
234+
maiko/bin/config.guess \
235+
maiko/bin/config.sub \
236+
maiko/${OSARCH%%:*}/lde* \
237+
; \
238+
popd >/dev/null ; \
239+
done
240+
241+
# Push Release to github
242+
- name: Push the release
243+
uses: ncipollo/release-action@v1
244+
with:
245+
allowUpdates: true
246+
artifacts:
247+
/tmp/release_tars/${{ steps.tag.outputs.release_tag }}-linux.x86_64.tgz,
248+
/tmp/release_tars/${{ steps.tag.outputs.release_tag }}-linux.aarch64.tgz,
249+
/tmp/release_tars/${{ steps.tag.outputs.release_tag }}-linux.armv7l.tgz
250+
tag: ${{ steps.tag.outputs.release_tag }}
251+
draft: ${{ needs.inputs.outputs.draft }}
252+
token: ${{ secrets.GITHUB_TOKEN }}
253+
254+
255+
######################################################################################
256+
257+
# MacOS: build for MacOS (x86_64, aarch64, universal) and use results to
258+
# create and push release assets to github
259+
macos:
260+
261+
needs: [inputs, sentry]
262+
if: |
263+
needs.inputs.outputs.macos == 'true'
264+
&& (
265+
needs.sentry.outputs.release_not_built == 'true'
266+
|| needs.inputs.outputs.force == 'true'
267+
)
268+
269+
runs-on: macos-latest
270+
271+
steps:
272+
273+
# Checkout the branch
274+
- name: Checkout
275+
uses: actions/checkout@v4
276+
277+
# Checkout the actions for this repo owner
278+
- name: Checkout Actions
279+
uses: actions/checkout@v4
280+
with:
281+
repository: ${{ github.repository_owner }}/.github
282+
path: ./Actions_${{ github.sha }}
283+
- run: mv ./Actions_${{ github.sha }}/actions ../actions && rm -rf ./Actions_${{ github.sha }}
284+
285+
# Setup release tag
286+
- name: Setup Release Tag
287+
id: tag
288+
uses: ./../actions/release-tag-action
289+
290+
# Uninstall exisitng X11 stuff preconfigured on runner then install correct X11 dependencies
291+
- name: Unistall X components already on the runner
292+
run: |
293+
brew uninstall --ignore-dependencies libxft
294+
brew uninstall --ignore-dependencies libxrender
295+
brew uninstall --ignore-dependencies libxext
296+
brew uninstall --ignore-dependencies libx11
297+
brew uninstall --ignore-dependencies xorgproto
298+
brew uninstall --ignore-dependencies libxdmcp
299+
brew uninstall --ignore-dependencies libxau
300+
301+
- name: Install X11 dependencies on MacOS
302+
env:
303+
GH_TOKEN: ${{ github.token }}
304+
run: |
305+
gh release download XQuartz-2.8.5 --repo XQuartz/XQuartz --pattern XQuartz-2.8.5.pkg
306+
sudo installer -pkg ./XQuartz-2.8.5.pkg -target /
307+
308+
# Install SDL dependencies
309+
- name: Install SDL2 dependencies on MacOS
310+
env:
311+
GH_TOKEN: ${{ github.token }}
312+
run: |
313+
gh release download release-2.26.5 --repo libsdl-org/SDL --pattern SDL2-2.26.5.dmg
314+
hdiutil attach SDL2-2.26.5.dmg
315+
sudo ditto /Volumes/SDL2/SDL2.framework /Library/Frameworks/SDL2.framework
316+
hdiutil detach /Volumes/SDL2/
317+
318+
# Build maiko
319+
- name: Build ldeinit
320+
working-directory: ./bin
321+
run: |
322+
export LDEARCH=x86_64-apple-darwin
323+
./makeright init
324+
export LDEARCH=aarch64-apple-darwin
325+
./makeright init
326+
mkdir -p ../darwin.universal
327+
exe=ldeinit
328+
lipo -create \
329+
-arch arm64 ../darwin.aarch64/${exe} \
330+
-arch x86_64 ../darwin.x86_64/${exe} \
331+
-output ../darwin.universal/${exe}
332+
333+
- name: Build lde, ldex, & ldesdl
334+
run: |
335+
mkdir build
336+
cd build
337+
# -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12
338+
cmake .. \
339+
-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \
340+
-DMAIKO_DISPLAY_SDL=ON \
341+
-DMAIKO_DISPLAY_X11=ON \
342+
-DCMAKE_BUILD_TYPE=Release
343+
cmake --build . --config Release
344+
for exe in lde ldex ldesdl
345+
do
346+
lipo ${exe} -output ../darwin.x86_64/${exe} -extract x86_64
347+
lipo ${exe} -output ../darwin.aarch64/${exe} -extract arm64
348+
cp -p ${exe} ../darwin.universal/${exe}
349+
done
350+
351+
# Create release tar for github.
352+
- name: Make release tar(s)
353+
env:
354+
RELEASE_TAG: ${{ steps.tag.outputs.release_tag }}
355+
run: |
356+
mkdir -p /tmp/release_tars
357+
cd ${GITHUB_WORKSPACE}/../
358+
for arch in x86_64 aarch64 universal
359+
do
360+
tar -c -z \
361+
-f /tmp/release_tars/${RELEASE_TAG}-darwin.${arch}.tgz \
362+
maiko/bin/osversion \
363+
maiko/bin/machinetype \
364+
maiko/bin/config.guess \
365+
maiko/bin/config.sub \
366+
maiko/darwin.${arch}/lde*
367+
done
368+
369+
# Push Release
370+
- name: Push the release
371+
uses: ncipollo/release-action@v1
372+
with:
373+
allowUpdates: true
374+
artifacts:
375+
/tmp/release_tars/${{ steps.tag.outputs.release_tag }}-darwin.x86_64.tgz,
376+
/tmp/release_tars/${{ steps.tag.outputs.release_tag }}-darwin.aarch64.tgz,
377+
/tmp/release_tars/${{ steps.tag.outputs.release_tag }}-darwin.universal.tgz
378+
tag: ${{ steps.tag.outputs.release_tag }}
379+
draft: ${{ needs.inputs.outputs.draft }}
380+
token: ${{ secrets.GITHUB_TOKEN }}
381+
382+
######################################################################################
383+
384+
# Windows: build for Windows-Cygwin via Docker build and use results to
385+
# create and push release assets to github
386+
387+
windows:
388+
389+
needs: [inputs, sentry]
390+
if: |
391+
needs.inputs.outputs.windows == 'true'
392+
&& (
393+
needs.sentry.outputs.release_not_built == 'true'
394+
|| needs.inputs.outputs.force == 'true'
395+
)
396+
397+
runs-on: windows-2022
398+
399+
defaults:
400+
run:
401+
shell: powershell
402+
403+
steps:
404+
405+
# setup git to not mess up line endings
406+
- name: git config
407+
run: git config --global core.autocrlf input
408+
409+
# Retrieve Cygwin setup and install cygwin
410+
- name: Install cygwin
411+
id: cygwin
412+
run: |
413+
wget https://cygwin.com/setup-x86_64.exe -OutFile setup-x86_64.exe
414+
Unblock-File setup-x86_64.exe
415+
Start-Process setup-x86_64.exe -Wait -ArgumentList @("--root", ".\cygwin", "--quiet-mode", "--no-admin", "--wait", "--no-shortcuts", "--no-write-registry", "--verbose", "--site", "http://www.gtlib.gatech.edu/pub/cygwin/", "--packages", "nano,binutils,make,cmake,gcc,clang")
416+
cygwin\bin\bash -login -c 'sed -i -e "s/^none/#none/" /etc/fstab; echo "none / cygdrive binary,posix=0,user 0 0" >>/etc/fstab'
417+
418+
# Retrieve SDL2 and install in cygwin
419+
- name: Install SDL2
420+
id: sdl2
421+
env:
422+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
423+
run: |
424+
gh release download 2.26.5 --repo interlisp/cygwin-sdl --pattern *.tgz --output .\cygwin\sdl2.tar.gz
425+
cygwin\bin\bash -login -c 'cd /; tar xzf sdl2.tar.gz'
426+
427+
# Checkout the branch
428+
- name: Checkout
429+
uses: actions/checkout@v4
430+
with:
431+
path: cygwin\maiko
432+
433+
# Checkout the actions for this repo owner
434+
- name: Checkout Actions
435+
uses: actions/checkout@v4
436+
with:
437+
repository: ${{ github.repository_owner }}/.github
438+
path: ./Actions_${{ github.sha }}
439+
- run: |
440+
mv ./Actions_${{ github.sha }}/actions ../actions
441+
rm -recurse -force ./Actions_${{ github.sha }}
442+
443+
# Setup release tag
444+
- name: Setup Release Tag
445+
id: tag
446+
uses: ./../actions/release-tag-action
447+
with:
448+
path: cygwin/maiko
449+
450+
# Build maiko TODO-cleanup
451+
- name: Build Cygwin-SDL Maiko
452+
run: |
453+
cygwin\bin\bash -login -c 'cd /maiko/bin && ./makeright sdl cleanup && ./makeright sdl'
454+
cygwin\bin\bash -login -c 'mkdir /tmp/maiko; mkdir /tmp/maiko/bin; mkdir /tmp/maiko/cygwin.x86_64'
455+
cygwin\bin\bash -login -c 'cp /maiko/bin/osversion /tmp/maiko/bin; cp /maiko/bin/machinetype /tmp/maiko/bin'
456+
cygwin\bin\bash -login -c 'cp /maiko/bin/config.guess /tmp/maiko/bin; cp /maiko/bin/config.sub /tmp/maiko/bin'
457+
cygwin\bin\bash -login -c 'cp /maiko/cygwin.x86_64/* /tmp/maiko/cygwin.x86_64; cp /usr/local/bin/SDL2.DLL /tmp/maiko/cygwin.x86_64'
458+
cygwin\bin\bash -login -c 'chmod +x /tmp/maiko/bin/*; chmod +x /tmp/maiko/cygwin.x86_64/*'
459+
cygwin\bin\bash -login -c 'echo lde > /tmp/maiko/cygwin.x86_64/lde.exe.local; echo ldesdl > /tmp/maiko/cygwin.x86_64/ldesdl.exe.local'
460+
cygwin\bin\bash -login -c 'mkdir -p /tmp/release_tars'
461+
cygwin\bin\bash -login -c 'tar -c -z -C /tmp -f /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-cygwin.x86_64.tgz maiko'
462+
463+
# Push Release to github
464+
- name: Push the release
465+
uses: ncipollo/release-action@v1
466+
with:
467+
allowUpdates: true
468+
artifacts:
469+
cygwin/tmp/release_tars/${{ steps.tag.outputs.release_tag }}-cygwin.x86_64.tgz
470+
tag: ${{ steps.tag.outputs.release_tag }}
471+
draft: ${{ needs.inputs.outputs.draft }}
472+
token: ${{ secrets.GITHUB_TOKEN }}
473+
474+
140475

141476
######################################################################################
142477

@@ -211,6 +546,7 @@ jobs:
211546
draft: ${{ needs.inputs.outputs.draft }}
212547
token: ${{ secrets.GITHUB_TOKEN }}
213548

549+
214550
######################################################################################
215551

216552
# Use set-sentry-action to determine set the sentry that says this release has
@@ -223,7 +559,7 @@ jobs:
223559
outputs:
224560
build_successful: ${{ steps.output.outputs.build_successful }}
225561

226-
needs: [inputs, sentry, emscripten]
562+
needs: [inputs, sentry, linux, macos, windows, emscripten]
227563

228564
steps:
229565
# Checkout the actions for this repo owner

0 commit comments

Comments
 (0)