gbe_fork/.github/workflows/emu-build-variant-win.yml

135 lines
4.0 KiB
YAML
Raw Normal View History

2024-05-11 13:13:59 +03:00
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
2024-05-11 13:13:59 +03:00
required: true
type: string
x32:
description: |
2024-05-11 13:13:59 +03:00
build architecture, unused when 'emu-variant' == 'tools'
true: x32
false: x64
required: false
type: boolean
2024-05-11 13:13:59 +03:00
default: true
debug:
description: |
2024-05-11 13:13:59 +03:00
build mode
true: build in debug mode
false: build in release mode
2024-05-11 13:13:59 +03:00
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: |
2024-05-11 04:54:56 +03:00
echo env file = "%GITHUB_ENV%"
echo workspace = "${{ github.workspace }}"
set "arch="
if /i "${{ inputs.x32 }}"=="true" (
set "arch=32"
) else (
set "arch=64"
)
2024-05-11 04:54:56 +03:00
>>"%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
)
2024-05-11 04:54:56 +03:00
>>"%GITHUB_ENV%" echo build_switches=%build_switches%
2024-05-11 13:13:59 +03:00
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 }}
2024-05-11 22:21:28 +03:00
run: build_win.bat -j 3 -verbose ${{ env.build_mode }} clean +build_str ${{ github.sha }} ${{ env.build_switches }}
2024-05-11 13:13:59 +03:00
### upload artifact/package to github Actions (for targets)
- name: Upload build package (for targets)
uses: actions/upload-artifact@v4
with:
2024-05-11 13:13:59 +03:00
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