matrix based workflows for premake

This commit is contained in:
otavepto 2024-05-20 03:12:20 +03:00
parent e0aab891e5
commit 62904968df
4 changed files with 145 additions and 504 deletions

View File

@ -9,130 +9,90 @@ on:
permissions: permissions:
contents: write contents: write
env:
DEPS_CACHE_KEY: emu-deps-linux
DEPS_CACHE_DIR: build/deps/linux
PACKAGE_BASE_DIR: "build/package/linux"
THIRD_PARTY_BASE_DIR: 'third-party'
jobs: jobs:
deps: deps:
name: Restore or build deps name: Restore or build deps
if: ${{ !cancelled() }} if: ${{ !cancelled() }}
uses: ./.github/workflows/emu-deps-linux.yml uses: ./.github/workflows/emu-deps-linux.yml
emu-regular-x32-release: builds-matrix-linux:
name: Regular x32 (release) name: Builds matrix (Linux)
needs: [ deps ] needs: [ deps ]
runs-on: ubuntu-22.04
if: ${{ !cancelled() }} if: ${{ !cancelled() }}
uses: ./.github/workflows/emu-build-variant-linux.yml
with:
emu-variant: regular
x32: true
debug: false
emu-regular-x32-debug: strategy:
name: Regular x32 (debug) matrix:
needs: [ deps ] ## notice how on linux everything is lowercase, `cd GBE_Build`, then: `make help`
if: ${{ !cancelled() }} cfg: [ 'debug', 'release', 'experimentaldebug', 'experimentalrelease', ]
uses: ./.github/workflows/emu-build-variant-linux.yml arch: [ 'x64', 'x32', ]
with: prj: [ 'GenerateInterfaces', 'SteamClient', 'SteamEmu', ]
emu-variant: regular
x32: true
debug: true
emu-exp-x32-release: steps:
name: Experimental x32 (release) ### deps
needs: [ deps ] - name: Restore deps
if: ${{ !cancelled() }} id: emu-deps-cache-step
uses: ./.github/workflows/emu-build-variant-linux.yml uses: actions/cache@v4
with: with:
emu-variant: exp key: ${{ env.DEPS_CACHE_KEY }}
x32: true path: ${{ env.DEPS_CACHE_DIR }}
debug: false
emu-exp-x32-debug: ## mandatory Linux packages, installed via sudo apt install ...
name: Experimental x32 (debug) - name: Install required packages
needs: [ deps ] shell: bash
if: ${{ !cancelled() }} run: sudo chmod 777 build_linux_deps.sh && sudo ./build_linux_deps.sh -verbose -packages_only
uses: ./.github/workflows/emu-build-variant-linux.yml
with:
emu-variant: exp
x32: true
debug: true
tools-x32-release: ## extra helpers/tools, these are not built inside the deps build dir
name: Tools x32 (release) - name: Clone third-party build helpers (common/linux)
needs: [ deps ] uses: actions/checkout@v4
if: ${{ !cancelled() }} with:
uses: ./.github/workflows/emu-build-variant-linux.yml ref: 'third-party/common/linux'
with: path: "${{env.THIRD_PARTY_BASE_DIR}}/common/linux"
emu-variant: tools
x32: true
debug: false
tools-x32-debug: - name: Clone third-party build helpers (build/linux)
name: Tools x32 (debug) uses: actions/checkout@v4
needs: [ deps ] with:
if: ${{ !cancelled() }} ref: 'third-party/build/linux'
uses: ./.github/workflows/emu-build-variant-linux.yml path: "${{env.THIRD_PARTY_BASE_DIR}}/build/linux"
with:
emu-variant: tools
x32: true
debug: true
### fix folder permissions! not sure why this fails
# nested subdirs "build/linux/release" cause permission problems
- name: Give all permissions to repo folder
shell: bash
working-directory: ${{ github.workspace }}
run: sudo chmod -R 777 "${{ github.workspace }}"
### generate project files
## TODO gen proto action is broken, always returns error = 1
- name: Generate project files
shell: bash
working-directory: ${{ github.workspace }}
run: |
sudo chmod 777 ./third-party/common/linux/premake/premake5
./third-party/common/linux/premake/premake5 --file=premake5.lua --os=linux generateproto
./third-party/common/linux/premake/premake5 --file=premake5.lua --emubuild=${{ github.sha }} --os=linux gmake2
exit 0
emu-regular-x64-release: ### build target(s)
name: Regular x64 (release) - name: Build target(s)
needs: [ deps ] shell: bash
if: ${{ !cancelled() }} working-directory: ${{ github.workspace }}/GBE_Build
uses: ./.github/workflows/emu-build-variant-linux.yml run: |
with: make -j 2 config=${{ matrix.cfg }}_${{ matrix.arch }} ${{ matrix.prj }}
emu-variant: regular
x32: false
debug: false
emu-regular-x64-debug: ### upload artifact/package to github Actions (for targets)
name: Regular x64 (debug) - name: Upload build package (for targets)
needs: [ deps ] uses: actions/upload-artifact@v4
if: ${{ !cancelled() }} with:
uses: ./.github/workflows/emu-build-variant-linux.yml name: "emu-linux-${{ matrix.prj }}-${{ matrix.cfg }}-${{ matrix.arch }}-${{ github.sha }}"
with: path: "bin/"
emu-variant: regular if-no-files-found: 'error'
x32: false compression-level: 9
debug: true retention-days: 1
emu-exp-x64-release:
name: Experimental x64 (release)
needs: [ deps ]
if: ${{ !cancelled() }}
uses: ./.github/workflows/emu-build-variant-linux.yml
with:
emu-variant: exp
x32: false
debug: false
emu-exp-x64-debug:
name: Experimental x64 (debug)
needs: [ deps ]
if: ${{ !cancelled() }}
uses: ./.github/workflows/emu-build-variant-linux.yml
with:
emu-variant: exp
x32: false
debug: true
tools-x64-release:
name: Tools x64 (release)
needs: [ deps ]
if: ${{ !cancelled() }}
uses: ./.github/workflows/emu-build-variant-linux.yml
with:
emu-variant: tools
x32: false
debug: false
tools-x64-debug:
name: Tools x64 (debug)
needs: [ deps ]
if: ${{ !cancelled() }}
uses: ./.github/workflows/emu-build-variant-linux.yml
with:
emu-variant: tools
x32: false
debug: true

View File

@ -9,150 +9,92 @@ on:
permissions: permissions:
contents: write contents: write
env:
DEPS_CACHE_KEY: emu-deps-win
DEPS_CACHE_DIR: build/deps/win
THIRD_PARTY_BASE_DIR: 'third-party'
jobs: jobs:
deps: deps:
name: Restore or build deps name: Restore or build deps
if: ${{ !cancelled() }} if: ${{ !cancelled() }}
uses: ./.github/workflows/emu-deps-win.yml uses: ./.github/workflows/emu-deps-win.yml
emu-regular-x32-release: builds-matrix-win:
name: Regular x32 (release) name: Builds matrix (Windows)
needs: [ deps ] needs: [ deps ]
runs-on: windows-2022
if: ${{ !cancelled() }} if: ${{ !cancelled() }}
uses: ./.github/workflows/emu-build-variant-win.yml
with:
emu-variant: regular
x32: true
debug: false
emu-regular-x32-debug: strategy:
name: Regular x32 (debug) matrix:
needs: [ deps ] prj: [ 'GameOverlayRenderer', 'GenerateInterfaces', 'SteamClient', 'SteamEmu', ]
if: ${{ !cancelled() }} arch: [ 'x64', 'Win32', ]
uses: ./.github/workflows/emu-build-variant-win.yml cfg: [ 'Debug', 'Release', 'ExperimentalDebug', 'ExperimentalRelease', ]
with:
emu-variant: regular
x32: true
debug: true
emu-exp-x32-release: steps:
name: Experimental x32 (release) ### on Windows Git will auto change line ending to CRLF, not preferable
needs: [ deps ] - name: Ensure LF line ending
if: ${{ !cancelled() }} shell: cmd
uses: ./.github/workflows/emu-build-variant-win.yml working-directory: ${{ github.workspace }}
with: run: |
emu-variant: exp git config --local core.autocrlf false
x32: true git config --system core.autocrlf false
debug: false git config --global core.autocrlf false
emu-exp-x32-debug: ### ensure we have msbuild
name: Experimental x32 (debug) - name: Add MSBuild to PATH
needs: [ deps ] uses: microsoft/setup-msbuild@v2
if: ${{ !cancelled() }}
uses: ./.github/workflows/emu-build-variant-win.yml
with:
emu-variant: exp
x32: true
debug: true
emu-client-x32-release: ### clone branch
name: Client x32 (release) - name: Checkout branch
needs: [ deps ] uses: actions/checkout@v4
if: ${{ !cancelled() }}
uses: ./.github/workflows/emu-build-variant-win.yml
with:
emu-variant: client
x32: true
debug: false
emu-client-x32-debug: ### deps
name: Client x32 (debug) - name: Restore deps
needs: [ deps ] id: emu-deps-cache-step
if: ${{ !cancelled() }} uses: actions/cache@v4
uses: ./.github/workflows/emu-build-variant-win.yml with:
with: key: ${{ env.DEPS_CACHE_KEY }}
emu-variant: client path: ${{ env.DEPS_CACHE_DIR }}
x32: true
debug: true
## extra helpers/tools, these are not built inside the deps build dir
- name: Clone third-party build helpers (common/win)
uses: actions/checkout@v4
with:
ref: 'third-party/common/win'
path: "${{env.THIRD_PARTY_BASE_DIR}}/common/win"
- name: Clone third-party deps (build/win)
uses: actions/checkout@v4
with:
ref: 'third-party/build/win'
path: "${{env.THIRD_PARTY_BASE_DIR}}/build/win"
emu-regular-x64-release: ### generate project files
name: Regular x64 (release) ## TODO gen proto action is broken, always returns error = 1
needs: [ deps ] - name: Generate project files
if: ${{ !cancelled() }} shell: cmd
uses: ./.github/workflows/emu-build-variant-win.yml working-directory: ${{ github.workspace }}
with: run: |
emu-variant: regular third-party\common\win\premake\premake5.exe --file=premake5.lua --os=windows generateproto
x32: false third-party\common\win\premake\premake5.exe --file=premake5.lua --emubuild=${{ github.sha }} --os=windows vs2022
debug: false exit /b 0
emu-regular-x64-debug: ### build target(s)
name: Regular x64 (debug) - name: Build target(s)
needs: [ deps ] shell: cmd
if: ${{ !cancelled() }} working-directory: ${{ github.workspace }}/GBE_Build
uses: ./.github/workflows/emu-build-variant-win.yml run: |
with: msbuild /nologo /target:${{ matrix.prj }} /m:2 /v:diag /p:Configuration=${{ matrix.cfg }},Platform=${{ matrix.arch }} GBE.sln
emu-variant: regular
x32: false
debug: true
emu-exp-x64-release: ### upload artifact/package to github Actions (for targets)
name: Experimental x64 (release) - name: Upload build package (for targets)
needs: [ deps ] uses: actions/upload-artifact@v4
if: ${{ !cancelled() }} with:
uses: ./.github/workflows/emu-build-variant-win.yml name: "emu-win-${{ matrix.prj }}-${{ matrix.cfg }}-${{ matrix.arch }}-${{ github.sha }}"
with: path: "bin/"
emu-variant: exp if-no-files-found: 'error'
x32: false compression-level: 9
debug: false retention-days: 1
emu-exp-x64-debug:
name: Experimental x64 (debug)
needs: [ deps ]
if: ${{ !cancelled() }}
uses: ./.github/workflows/emu-build-variant-win.yml
with:
emu-variant: exp
x32: false
debug: true
emu-client-x64-release:
name: Client x64 (release)
needs: [ deps ]
if: ${{ !cancelled() }}
uses: ./.github/workflows/emu-build-variant-win.yml
with:
emu-variant: client
x32: false
debug: false
emu-client-x64-debug:
name: Client x64 (debug)
needs: [ deps ]
if: ${{ !cancelled() }}
uses: ./.github/workflows/emu-build-variant-win.yml
with:
emu-variant: client
x32: false
debug: true
tools-release:
name: Tools (release)
needs: [ deps ]
if: ${{ !cancelled() }}
uses: ./.github/workflows/emu-build-variant-win.yml
with:
emu-variant: tools
debug: false
tools-debug:
name: Tools (debug)
needs: [ deps ]
if: ${{ !cancelled() }}
uses: ./.github/workflows/emu-build-variant-win.yml
with:
emu-variant: tools
debug: true

View File

@ -1,127 +0,0 @@
name: Build emu variant (Linux)
on:
workflow_call:
inputs:
emu-variant:
description: |
Which variant of the emu to build:
regular: build the regular version of the emu
exp: build the experimental version of the emu
tools: build the tools only
required: true
type: string
x32:
description: |
build architecture
true: x32
false: x64
required: true
type: boolean
debug:
description: |
build mode
true: build in debug mode
false: build in release mode
required: true
type: boolean
permissions:
contents: write
env:
DEPS_CACHE_KEY: emu-deps-linux
DEPS_CACHE_DIR: build/deps/linux
PACKAGE_BASE_DIR: "build/package/linux"
THIRD_PARTY_BASE_DIR: 'third-party'
jobs:
build:
runs-on: ubuntu-22.04
if: ${{ !cancelled() }}
steps:
### setup build vars
- name: Setup build vars
shell: bash
run: |
echo "env file = '$GITHUB_ENV'"
echo "workspace = '${{ github.workspace }}'"
arch=""
if [[ "${{ inputs.x32 }}" = "true" ]]; then
arch="32"
else
arch="64"
fi
echo "build_arch=$arch" >>"$GITHUB_ENV"
build_switches=""
if [[ "${{ inputs.emu-variant }}" = "regular" ]]; then
build_switches="+lib-$arch +client-$arch"
elif [[ "${{ inputs.emu-variant }}" = "exp" ]]; then
build_switches="+exp-lib-$arch +exp-client-$arch"
elif [[ "${{ inputs.emu-variant }}" = "tools" ]]; then
build_switches="+tool-clientldr +tool-itf-$arch +tool-lobby-$arch"
else
echo "[X] invalid emu variant '${{ inputs.emu-variant }}'" >&2
exit 1
fi
echo "build_switches=$build_switches" >>"$GITHUB_ENV"
build_mode=""
if [[ "${{ inputs.debug }}" = "true" ]]; then
build_mode="debug"
else
build_mode="release"
fi
echo "build_mode=$build_mode" >>"$GITHUB_ENV"
- name: Checkout branch
uses: actions/checkout@v4
### deps
- name: Restore deps
id: emu-deps-cache-step
uses: actions/cache@v4
with:
key: ${{ env.DEPS_CACHE_KEY }}
path: ${{ env.DEPS_CACHE_DIR }}
## mandatory Linux packages, installed via sudo apt install ...
- name: Install required packages
shell: bash
run: sudo chmod 777 build_linux_deps.sh && sudo ./build_linux_deps.sh -verbose -packages_only
## extra helpers/tools, these are not built inside the deps build dir
- name: Clone third-party build helpers (build/linux)
uses: actions/checkout@v4
with:
ref: 'third-party/build/linux'
path: "${{env.THIRD_PARTY_BASE_DIR}}/build/linux"
### fix folder permissions! not sure why this fails
# nested subdirs "build/linux/release" cause permission problems
- name: Give all permissions to repo folder
shell: bash
working-directory: ${{ github.workspace }}
run: sudo chmod -R 777 "${{ github.workspace }}"
### build target(s)
- name: Build target(s)
shell: bash
working-directory: ${{ github.workspace }}
run: "sudo chmod 777 build_linux.sh && ./build_linux.sh -j 3 -verbose ${{ env.build_mode }} clean +build_str ${{ github.sha }} ${{ env.build_switches }}"
### upload artifact/package to github Actions (for targets)
- name: Upload build package (for targets)
uses: actions/upload-artifact@v4
with:
name: "emu-linux-${{ inputs.emu-variant }}-${{ env.build_arch }}-${{ env.build_mode }}-${{ github.sha }}"
path: "build/linux/"
if-no-files-found: 'error'
compression-level: 9
retention-days: 1

View File

@ -1,134 +0,0 @@
name: Build emu variant (Windows)
on:
workflow_call:
inputs:
emu-variant:
description: |
Which variant of the emu to build:
regular: build the regular version of the emu
exp: build the experimental version of the emu
client: build the experimental steamclient version of the emu
tools: build the tools only
required: true
type: string
x32:
description: |
build architecture, unused when 'emu-variant' == 'tools'
true: x32
false: x64
required: false
type: boolean
default: true
debug:
description: |
build mode
true: build in debug mode
false: build in release mode
required: true
type: boolean
permissions:
contents: write
env:
DEPS_CACHE_KEY: emu-deps-win
DEPS_CACHE_DIR: build/deps/win
THIRD_PARTY_BASE_DIR: 'third-party'
jobs:
build:
runs-on: windows-2022
if: ${{ !cancelled() }}
steps:
### setup build vars
- name: Setup build vars
shell: cmd
run: |
echo env file = "%GITHUB_ENV%"
echo workspace = "${{ github.workspace }}"
set "arch="
if /i "${{ inputs.x32 }}"=="true" (
set "arch=32"
) else (
set "arch=64"
)
>>"%GITHUB_ENV%" echo build_arch=%arch%
set "build_switches="
if "${{ inputs.emu-variant }}"=="regular" (
set "build_switches=+lib-%arch%"
) else if "${{ inputs.emu-variant }}"=="exp" (
set "build_switches=+ex-lib-%arch% +ex-client-%arch%"
) else if "${{ inputs.emu-variant }}"=="client" (
set "build_switches=+exclient-%arch% +exclient-ldr-%arch% +exclient-extra-%arch% +lib-gameoverlay-%arch%"
) else if "${{ inputs.emu-variant }}"=="tools" (
set "build_switches=+tool-itf +tool-lobby"
) else (
1>&2 echo [X] invalid emu variant "${{ inputs.emu-variant }}"
exit /b 1
)
>>"%GITHUB_ENV%" echo build_switches=%build_switches%
set "build_mode="
if /i "${{ inputs.debug }}"=="true" (
set "build_mode=debug"
) else (
set "build_mode=release"
)
>>"%GITHUB_ENV%" echo build_mode=%build_mode%
### on Windows Git will auto change line ending to CRLF, not preferable
- name: Ensure LF line ending
shell: cmd
working-directory: ${{ github.workspace }}
run: |
git config --local core.autocrlf false
git config --system core.autocrlf false
git config --global core.autocrlf false
- name: Checkout branch
uses: actions/checkout@v4
### deps
- name: Restore deps
id: emu-deps-cache-step
uses: actions/cache@v4
with:
key: ${{ env.DEPS_CACHE_KEY }}
path: ${{ env.DEPS_CACHE_DIR }}
## extra helpers/tools, these are not built inside the deps build dir
- name: Clone third-party build helpers (common/win)
uses: actions/checkout@v4
with:
ref: 'third-party/common/win'
path: "${{env.THIRD_PARTY_BASE_DIR}}/common/win"
- name: Clone third-party deps (build/win)
uses: actions/checkout@v4
with:
ref: 'third-party/build/win'
path: "${{env.THIRD_PARTY_BASE_DIR}}/build/win"
### build target(s)
- name: Build target(s)
if: inputs.emu-variant != 'all'
shell: cmd
working-directory: ${{ github.workspace }}
run: build_win.bat -j 3 -verbose ${{ env.build_mode }} clean +build_str ${{ github.sha }} ${{ env.build_switches }}
### upload artifact/package to github Actions (for targets)
- name: Upload build package (for targets)
uses: actions/upload-artifact@v4
with:
name: "emu-win-${{ inputs.emu-variant }}-${{ env.build_arch }}-${{ env.build_mode }}-${{ github.sha }}"
path: "build/win/"
if-no-files-found: 'error'
compression-level: 9
retention-days: 1