1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-11 23:43:19 +00:00

Add cygwin-sdl build to buildRelease workflow (#476)

* Start cygwin-sdl builds: first pass at buildCygwinBuilderImage workflow.  Add makefile-cygwin.x86_64-sdl.

* WIP Dockerfile_cygwin_builder

* First pass of complete cygwin-sdl build workflow

* Fix indent error in buildCygwinBuilderImage.yml

* fix incorrect use of github token in buildCygwinBuilderImage.yml

* fix incorrect use of --build-arg in buildCygwinBuilderImage.

* fix incorrect docker build statement in buildCygwinBuilderImage.

* make docker tag lowercase since apparently Wiondows docker doesn't like uppercase tags in buildCygwinBuilderImage.

* fix quotiing on last commit in buildCygwinBuilderImage.

* fix download output location for SDL2 in buildCygwinBuilderImage.

* Add windows/cygwin build to buildRelease workflow

* Fix typos in buildRelease workflow

* Fix more typos in buildRelease workflow

* Debugging per-system if statements buildRelease workflow

* Debugging per-system if statements buildRelease workflow #2

* Debugging per-system if statements buildRelease workflow #3

* Fix checkout actions step to use powershell-sims not bash-isms in Windows job

* Fix Docker_env step to use powershell-isms not bash-isms in Windows job

* Fix Docker_env step to use powershell-isms not bash-isms in Windows job #2

* Fix Docker_env step to use powershell-isms not bash-isms in Windows job #3

* Revamp cygwin build to use docker build instead of docker buildxx because buildx seems to not like windows containers

* Fix some line split nonsense

* Fix typo in last commit

* Add proper repo info to Dockerfile_cygwin_maiko

* More debugging

* Revamp how cygwin-sdl is built - now build directly on runner and not via a Dcokerfile and docker.

* Fix typo

* Fix retrieve of sdl2

* Fix set up release tag action to ake account of the fact that Maiko has been checked out to cygwin\maiko instead of top level workspace

* Fix set up release tag action to ake account of the fact that Maiko has been checked out to cygwin\maiko instead of top level workspace #2

* Fix set up release tag action to ake account of the fact that Maiko has been checked out to cygwin\maiko instead of top level workspace #3

* Cleanup build maiko step

* Prevent git from messing uo line endings on checkout

* Fix copy of cygwin.x86_64 dir to relesase tars

* Set execute bit of (almost) all files in release tar; rearrange build step to use cyugwin bash as the shell

* Fix rearrange build step to use cyugwin bash as the shell

* Try a different way of rearrange build step to use cyugwin bash as the shell

* Fix typo

* When cygwin bash as shell did not work; reverting to brute-force way

* Hopefully fix release push not getting tar file

* Cygwin-sdl build working; remove debugging code

* Remove wrokflow files associated with abandoned attempts at building cygwin via docker

---------

Co-authored-by: Frank Halasz <fghalasz@interlisp.org>
This commit is contained in:
Frank Halasz 2023-06-18 11:48:39 -07:00 committed by GitHub
parent 2b24184293
commit 44a4a4c42c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 138 additions and 101 deletions

View File

@ -1,6 +1,6 @@
#*******************************************************************************
#
# Dockerfile to build Maiko to be used by buildRelease github action
# Dockerfile to build Maiko for Linux to be used by buildRelease github action
# The output of this is intended to be a directory in the github workspace
# file system it is not intended to be a useable Docker image.
#

View File

@ -1,92 +0,0 @@
#*******************************************************************************
# buildCygwinBuilderImage.yml
#
# Workflow to build a hWindows Docker image that includes cygwin and SDL compiled for cygwin
# and all of the tools for building maiko for linuxcygwin and sdl. Intended to be used
# (exclusively?) by the github actions that build maiko releases - e.g., buildRelease.yml.
#
#
# Copyright 2023 by Interlisp.org
#
# Frank Haasz 2023-06-2104
#
# ******************************************************************************
name: 'Build/Push Cygwin Builder'
# Run this workflow on ...
on: workflow_dispatch
defaults:
run:
shell: powershell
jobs:
buildBuilder:
runs-on: windows-2022
steps:
# Checkout the branch
- name: Checkout
uses: actions/checkout@v3
# Fetch cygwin and sdl from net
- name: Fetch cygwin
id: cygwin
run: |
wget https://cygwin.com/setup-x86_64.exe -OutFile .\.github\workflows\setup-x86_64.exe
- name: Fetch SDL2
id: SDL2
env:
GH_TOKEN: ${{ github_token }}
run: |
gh release download release-2.26.5 --repo libsdl-org/SDL --pattern SDL2-2.26.5.tar.gz --output sdl2.tar.gz
# Setup docker environment variables
- name: Setup Docker Environment Variables
id: docker_env
run: |
$crt="${{ needs.loadup.outputs.combined_release_tag }}"
echo "COMBINED_RELEASE_TAG=$crt" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
$DOCKER_REGISTRY="ghcr.io"
$DOCKER_NAMESPACE="${{ github.repository_owner }}"
$DOCKER_REPO="${DOCKER_REGISTRY}/${DOCKER_NAMESPACE}/maiko-cygwin-builder"
$DOCKER_TAG="${DOCKER_REPO}:latest"
$bd=Get-Date -UFormat "%Y-%m-%d_%H:%M_%Z"
echo "BUILD_DATE=$bd" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
echo "DOCKER_TAG=${DOCKER_TAG}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
# Do the Docker Build using the Dockerfile_cygwin_builder in the repository we
# checked out.
#
- name: Build Docker Image
id: build
run: |
docker build \
-f ./.github/workflows/Dockerfile_cygwin_builder \
-t ${{ env.DOCKER_TAG }} \
--build-arg BUILD_DATE=${{ env.BUILD_DATE }} \
./.github/workflows
# Login to ghcr.io
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
# Push the result to ghcr.io.
- name: Push image to ghcr
id: push
run: |
docker push ${{ env.DOCKER_TAG }}
######################################################################################

View File

@ -63,14 +63,18 @@ defaults:
run:
shell: bash
# 2 separate jobs here that can run in parallel
# 3 separate jobs here that can run in parallel
#
# 1. Linux: Build a multiplatform Linux Docker file system (not saved) and use
# results to build/push Linux release assets.
#
# 2. MacOs: Build maiko for MacOS (x86_64, aarch64, and universal) then create
# 2. MacOs: Build maiko for MacOS (x86_64, aarch64, and universal) then create
# and push release assets.
#
# 3. Windows: Build maiko for cygwin and SDL (x86_64). Build is done within the
# cygwin-maiko-builder Docker image by building a new docker files system (and
# not a docker container) which is used to build/push Windows(cygwin) assets.
#
jobs:
@ -84,6 +88,9 @@ jobs:
outputs:
draft: ${{ steps.one.outputs.draft }}
force: ${{ steps.one.outputs.force }}
linux: ${{ steps.one.outputs.linux }}
macos: ${{ steps.one.outputs.macos }}
windows: ${{ steps.one.outputs.windows }}
steps:
- id: one
run: >
@ -96,7 +103,11 @@ jobs:
echo "workflow_call";
echo "draft=${{ inputs.draft }}" >> $GITHUB_OUTPUT;
echo "force=${{ inputs.force }}" >> $GITHUB_OUTPUT;
fi
fi;
echo "linux=true" >> $GITHUB_OUTPUT;
echo "macos=true" >> $GITHUB_OUTPUT;
echo "windows=true" >> $GITHUB_OUTPUT;
######################################################################################
@ -135,8 +146,11 @@ jobs:
needs: [inputs, sentry]
if: |
needs.sentry.outputs.release_not_built == 'true'
|| needs.inputs.outputs.force == 'true'
needs.inputs.outputs.linux == 'true'
&& (
needs.sentry.outputs.release_not_built == 'true'
|| needs.inputs.outputs.force == 'true'
)
runs-on: ubuntu-latest
@ -246,8 +260,11 @@ jobs:
needs: [inputs, sentry]
if: |
needs.sentry.outputs.release_not_built == 'true'
|| needs.inputs.outputs.force == 'true'
needs.inputs.outputs.macos == 'true'
&& (
needs.sentry.outputs.release_not_built == 'true'
|| needs.inputs.outputs.force == 'true'
)
runs-on: macos-latest
@ -362,6 +379,98 @@ jobs:
draft: ${{ needs.inputs.outputs.draft }}
token: ${{ secrets.GITHUB_TOKEN }}
######################################################################################
# Windows: build for Windows-Cygwin via Docker build and use results to
# create and push release assets to github
windows:
needs: [inputs, sentry]
if: |
needs.inputs.outputs.windows == 'true'
&& (
needs.sentry.outputs.release_not_built == 'true'
|| needs.inputs.outputs.force == 'true'
)
runs-on: windows-2022
defaults:
run:
shell: powershell
steps:
# setup git to not mess up line endings
- name: git config
run: git config --global core.autocrlf input
# Retrieve Cygwin setup and install cygwin
- name: Install cygwin
id: cygwin
run: |
wget https://cygwin.com/setup-x86_64.exe -OutFile setup-x86_64.exe
Unblock-File setup-x86_64.exe
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")
cygwin\bin\bash -login -c 'sed -i -e "s/^none/#none/" /etc/fstab; echo "none / cygdrive binary,posix=0,user 0 0" >>/etc/fstab'
# Retrieve SDL2 and install in cygwin
- name: Install SDL2
id: sdl2
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release download 2.26.5 --repo interlisp/cygwin-sdl --pattern *.tgz --output .\cygwin\sdl2.tar.gz
cygwin\bin\bash -login -c 'cd /; tar xzf sdl2.tar.gz'
# Checkout the branch
- name: Checkout
uses: actions/checkout@v3
with:
path: cygwin\maiko
# Checkout the actions for this repo owner
- name: Checkout Actions
uses: actions/checkout@v3
with:
repository: ${{ github.repository_owner }}/.github
path: ./Actions_${{ github.sha }}
- run: |
mv ./Actions_${{ github.sha }}/actions ../actions
rm -recurse -force ./Actions_${{ github.sha }}
# Setup release tag
- name: Setup Release Tag
id: tag
uses: ./../actions/release-tag-action
with:
path: cygwin/maiko
# Build maiko TODO-cleanup
- name: Build Cygwin-SDL Maiko
run: |
cygwin\bin\bash -login -c 'cd /maiko/bin && ./makeright sdl cleanup && ./makeright sdl'
cygwin\bin\bash -login -c 'mkdir /tmp/maiko; mkdir /tmp/maiko/bin; mkdir /tmp/maiko/cygwin.x86_64'
cygwin\bin\bash -login -c 'cp /maiko/bin/osversion /tmp/maiko/bin; cp /maiko/bin/machinetype /tmp/maiko/bin'
cygwin\bin\bash -login -c 'cp /maiko/bin/config.guess /tmp/maiko/bin; cp /maiko/bin/config.sub /tmp/maiko/bin'
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'
cygwin\bin\bash -login -c 'chmod +x /tmp/maiko/bin/*; chmod +x /tmp/maiko/cygwin.x86_64/*'
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'
cygwin\bin\bash -login -c 'mkdir -p /tmp/release_tars'
cygwin\bin\bash -login -c 'tar -c -z -C /tmp -f /tmp/release_tars/${{ steps.tag.outputs.release_tag }}-cygwin.x86_64.tgz maiko'
# Push Release to github
- name: Push the release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts:
cygwin/tmp/release_tars/${{ steps.tag.outputs.release_tag }}-cygwin.x86_64.tgz
tag: ${{ steps.tag.outputs.release_tag }}
draft: ${{ needs.inputs.outputs.draft }}
token: ${{ secrets.GITHUB_TOKEN }}
######################################################################################
@ -376,7 +485,7 @@ jobs:
outputs:
build_successful: ${{ steps.output.outputs.build_successful }}
needs: [inputs, sentry, linux, macos]
needs: [inputs, sentry, linux, macos, windows]
steps:
# Checkout the actions for this repo owner

View File

@ -0,0 +1,20 @@
# Options for Linux, Intel x86_64 and X-Window
CC = gcc -m64 $(GCC_CFLAGS) -I/usr/local/include
#CC = clang -m64 $(CLANG_CFLAGS)
XFILES = $(OBJECTDIR)sdl.o
XFLAGS = -DSDL
# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g3
DFLAGS = $(XFLAGS) -DRELEASE=351
LDFLAGS = -lm -L/usr/local/lib -lSDL2
#
LDELDFLAGS =
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldesdl