Files
gbdk-2020/.github/workflows/gbdk_build_examples.yml

192 lines
6.2 KiB
YAML

name: GBDK Build Examples
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Triggers the workflow on push or pull request events but only for the develop branch
# push:
# branches: [ develop ]
# pull_request:
# branches: [ develop ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-22.04
name: Linux-x64
- os: ubuntu-22.04-arm
name: Linux-arm64
- os: macos-15-intel
name: MacOS-x64
- os: macos-14
name: MacOS-arm64
- os: windows-2022
name: Windows-x64
- os: windows-2022
name: Windows-x32
steps:
# ==== OS Specific Dependencies ====
- name: Linux x86 Depends
if: matrix.name == 'Linux-x64'
run: |
curl -Lo sdcc.tar.gz https://github.com/gbdk-2020/gbdk-2020-sdcc/releases/download/sdcc-patched-gbdk-4.5.0/sdcc-15267-Linux-x64.tar.gz
tar xvfz sdcc.tar.gz
- name: Linux arm64 Depends
if: matrix.name == 'Linux-arm64'
run: |
curl -Lo sdcc.tar.gz https://github.com/gbdk-2020/gbdk-2020-sdcc/releases/download/sdcc-patched-gbdk-4.5.0/sdcc-15267-Linux-arm64.tar.gz
tar xvfz sdcc.tar.gz
- name: MacOS Depends
if: matrix.name == 'MacOS-x64'
run: |
curl -Lo sdcc.tar.gz https://github.com/gbdk-2020/gbdk-2020-sdcc/releases/download/sdcc-patched-gbdk-4.5.0/sdcc-15267-MacOS-x64.tar.gz
tar xvfz sdcc.tar.gz
- name: MacOS ARM Depends
if: matrix.name == 'MacOS-arm64'
run: |
curl -Lo sdcc.tar.gz https://github.com/gbdk-2020/gbdk-2020-sdcc/releases/download/sdcc-patched-gbdk-4.5.0/sdcc-15267-MacOS-arm64.tar.gz
tar xvfz sdcc.tar.gz
- name: Windows-x64 Depends
if: matrix.name == 'Windows-x64'
run: |
curl -Lo sdcc.tar.gz https://github.com/gbdk-2020/gbdk-2020-sdcc/releases/download/sdcc-patched-gbdk-4.5.0/sdcc-15267-Win64-On-Linux.tar.gz
7z x sdcc.tar.gz
7z x sdcc.tar
- name: Windows-x32 Depends
if: matrix.name == 'Windows-x32'
run: |
curl -Lo sdcc.tar.gz https://github.com/gbdk-2020/gbdk-2020-sdcc/releases/download/sdcc-patched-gbdk-4.5.0/sdcc-15267-Win32-On-Linux.tar.gz
7z x sdcc.tar.gz
7z x sdcc.tar
- name: Windows Depends MSYS2/MinGW64
if: matrix.name == 'Windows-x64'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
path-type: minimal #strict
release: false
update: false
install: >-
base-devel
mingw-w64-x86_64-toolchain
- name: Windows Depends MSYS2/MinGW32
if: matrix.name == 'Windows-x32'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW32
path-type: minimal #strict
release: false
update: false
install: >-
base-devel
mingw-w64-i686-toolchain
# ==== Build Steps ====
- name: Check out GBDK-2020
uses: actions/checkout@v4
with:
path: gbdk-2020
submodules: false
# ==== Pre-Build: Set environment vars ====
# Needs to be in a separate step than build so that setting the environment var takes effect
#
- name: Pre-Build Linux/MacOS
if: (matrix.name == 'Linux-x64') || (matrix.name == 'Linux-arm64') || (matrix.name == 'MacOS-x64') || (matrix.name == 'MacOS-arm64')
shell: bash
run: |
echo "BUILD_PACKAGE_FILENAME=gbdk-2020-${{ matrix.name }}.tar.gz" >> $GITHUB_ENV
- name: Pre-Build Windows
if: (matrix.name == 'Windows-x64') || (matrix.name == 'Windows-x32')
shell: bash
run: |
echo "BUILD_PACKAGE_FILENAME=gbdk-2020-${{ matrix.name }}.zip" >> $GITHUB_ENV
# ==== Builds ====
- name: Build GBDK-2020 Linux/MacOS
if: (matrix.name == 'Linux-x64') || (matrix.name == 'Linux-arm64') || (matrix.name == 'MacOS-x64') || (matrix.name == 'MacOS-arm64')
shell: bash
run: |
export SDCCDIR=`pwd`/sdcc
export GBDK_DEBUG=1
cd gbdk-2020
make
# Now build the examples for all platforms
cd build
cd gbdk
cd examples
make
cd ..
cd ..
cd ..
cd ..
- name: Build GBDK-2020 Windows
if: (matrix.name == 'Windows-x64') || (matrix.name == 'Windows-x32')
shell: cmd
run: |
set SDCCDIR=%CD%\sdcc
cd gbdk-2020
msys2 -c 'make'
cd ..
- name: Build Examples GBDK-2020 Windows
if: (matrix.name == 'Windows-x64') || (matrix.name == 'Windows-x32')
shell: cmd
run: |
# For Windows build Examples is a separate stage due to commands getting skipped(?) after calling msys make
# Now build the examples
set GBDK_DEBUG=1
cd gbdk-2020
cd build
cd gbdk
cd examples
msys2 -c 'make'
cd ..
cd ..
cd ..
cd ..
# ==== Packaging ====
- name: Package build Linux/MacOS
if: (matrix.name == 'Linux-x64') || (matrix.name == 'Linux-arm64') || (matrix.name == 'MacOS-x64') || (matrix.name == 'MacOS-arm64')
shell: bash
run: |
cd gbdk-2020
mkdir package
cd build
tar czf ../package/${{ env.BUILD_PACKAGE_FILENAME }} gbdk/examples
cd ..
cd ..
- name: Package build Windows
if: (matrix.name == 'Windows-x64') || (matrix.name == 'Windows-x32')
shell: cmd
run: |
cd gbdk-2020
mkdir package
cd build
7z a ../package/${{ env.BUILD_PACKAGE_FILENAME }} gbdk/examples
cd ..
cd ..
- name: Store build
if: (matrix.name == 'Linux-x64') || (matrix.name == 'Linux-arm64') || (matrix.name == 'MacOS-x64') || (matrix.name == 'MacOS-arm64') || ('Windows-x64') || ('Windows-x32')
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }} build
path: gbdk-2020/package/${{ env.BUILD_PACKAGE_FILENAME }}
# retention-days: 14