refactor win build scripts

This commit is contained in:
otavepto 2024-05-11 13:13:59 +03:00
parent 60bdada47b
commit 9bcdf5eec8
5 changed files with 180 additions and 424 deletions

158
.github/workflows/build-emu-all-win.yml vendored Normal file
View File

@ -0,0 +1,158 @@
name: Build all emu variants (Windows)
on:
workflow_call:
# needed since it allows this to become a reusable workflow
workflow_dispatch:
# allows manual trigger
permissions:
contents: write
jobs:
deps:
name: Restore or build deps
if: ${{ !cancelled() }}
uses: ./.github/workflows/deps-win.yml
emu-regular-x32-release:
name: Regular x32 (release)
needs: [ deps ]
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-emu-variant-win.yml
with:
emu-variant: regular
x32: true
debug: false
emu-regular-x32-debug:
name: Regular x32 (debug)
needs: [ deps ]
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-emu-variant-win.yml
with:
emu-variant: regular
x32: true
debug: true
emu-exp-x32-release:
name: Experimental x32 (release)
needs: [ deps ]
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-emu-variant-win.yml
with:
emu-variant: exp
x32: true
debug: false
emu-exp-x32-debug:
name: Experimental x32 (debug)
needs: [ deps ]
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-emu-variant-win.yml
with:
emu-variant: exp
x32: true
debug: true
emu-client-x32-release:
name: Client x32 (release)
needs: [ deps ]
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-emu-variant-win.yml
with:
emu-variant: client
x32: true
debug: false
emu-client-x32-debug:
name: Client x32 (debug)
needs: [ deps ]
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-emu-variant-win.yml
with:
emu-variant: client
x32: true
debug: true
emu-regular-x64-release:
name: Regular x64 (release)
needs: [ deps ]
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-emu-variant-win.yml
with:
emu-variant: regular
x32: false
debug: false
emu-regular-x64-debug:
name: Regular x64 (debug)
needs: [ deps ]
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-emu-variant-win.yml
with:
emu-variant: regular
x32: false
debug: true
emu-exp-x64-release:
name: Experimental x64 (release)
needs: [ deps ]
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-emu-variant-win.yml
with:
emu-variant: exp
x32: false
debug: false
emu-exp-x64-debug:
name: Experimental x64 (debug)
needs: [ deps ]
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-emu-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/build-emu-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/build-emu-variant-win.yml
with:
emu-variant: client
x32: false
debug: true
tools-release:
name: Tools (release)
needs: [ deps ]
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-emu-variant-win.yml
with:
emu-variant: tools
debug: false
tools-debug:
name: Tools (debug)
needs: [ deps ]
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-emu-variant-win.yml
with:
emu-variant: tools
debug: true

View File

@ -1,4 +1,4 @@
name: Emu build 2 (Windows) name: Build emu variant (Windows)
on: on:
workflow_call: workflow_call:
@ -10,32 +10,26 @@ on:
exp: build the experimental version of the emu exp: build the experimental version of the emu
client: build the experimental steamclient version of the emu client: build the experimental steamclient version of the emu
tools: build the tools only tools: build the tools only
all: build all variants required: true
default: 'all'
required: false
type: string type: string
x32: x32:
description: | description: |
build architecture, unused when 'emu-variant' == 'all' or 'emu-variant' == 'tools' build architecture, unused when 'emu-variant' == 'tools'
true: x32 true: x32
false: x64 false: x64
default: true
required: false required: false
type: boolean type: boolean
default: true
debug: debug:
description: | description: |
build mode, unused when 'emu-variant' == 'all' build mode
true: build in debug mode true: build in debug mode
false: build in release mode false: build in release mode
default: false required: true
required: false
type: boolean type: boolean
workflow_dispatch:
# allows manual trigger
permissions: permissions:
contents: write contents: write
@ -43,19 +37,11 @@ env:
DEPS_CACHE_KEY: emu-deps-win DEPS_CACHE_KEY: emu-deps-win
DEPS_CACHE_DIR: build/deps/win DEPS_CACHE_DIR: build/deps/win
PACKAGE_BASE_DIR: "build/package/win"
THIRD_PARTY_BASE_DIR: 'third-party' THIRD_PARTY_BASE_DIR: 'third-party'
jobs: jobs:
dependencies:
name: Restore or build deps
if: ${{ !cancelled() }}
uses: ./.github/workflows/deps-win.yml
build: build:
runs-on: windows-2022 runs-on: windows-2022
needs: [ dependencies ]
if: ${{ !cancelled() }} if: ${{ !cancelled() }}
steps: steps:
### setup build vars ### setup build vars
@ -65,14 +51,6 @@ jobs:
echo env file = "%GITHUB_ENV%" echo env file = "%GITHUB_ENV%"
echo workspace = "${{ github.workspace }}" echo workspace = "${{ github.workspace }}"
set "build_mode="
if /i "${{ inputs.debug }}"=="true" (
set "build_mode=debug"
) else (
set "build_mode=release"
)
>>"%GITHUB_ENV%" echo build_mode=%build_mode%
set "arch=" set "arch="
if /i "${{ inputs.x32 }}"=="true" ( if /i "${{ inputs.x32 }}"=="true" (
set "arch=32" set "arch=32"
@ -90,16 +68,20 @@ jobs:
set "build_switches=+exclient-%arch% +exclient-ldr-%arch% +exclient-extra-%arch% +lib-gameoverlay-%arch%" set "build_switches=+exclient-%arch% +exclient-ldr-%arch% +exclient-extra-%arch% +lib-gameoverlay-%arch%"
) else if "${{ inputs.emu-variant }}"=="tools" ( ) else if "${{ inputs.emu-variant }}"=="tools" (
set "build_switches=+tool-itf +tool-lobby" set "build_switches=+tool-itf +tool-lobby"
) else if "${{ inputs.emu-variant }}"=="all" (
set "build_switches=+lib-32 +lib-64 +ex-lib-32 +ex-lib-64 +ex-client-32 +ex-client-64 +exclient-32 +exclient-64 +exclient-ldr-32 +exclient-ldr-64 +tool-itf +tool-lobby +exclient-extra-32 +exclient-extra-64 +lib-gameoverlay-32 +lib-gameoverlay-64"
) else ( ) else (
1>&2 echo [X] invalid emu variant "${{ inputs.emu-variant }}" 1>&2 echo [X] invalid emu variant "${{ inputs.emu-variant }}"
exit /b 1 exit /b 1
) )
echo final build switches %build_switches%
>>"%GITHUB_ENV%" echo build_switches=%build_switches% >>"%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 ### on Windows Git will auto change line ending to CRLF, not preferable
- name: Ensure LF line ending - name: Ensure LF line ending
shell: cmd shell: cmd
@ -127,12 +109,6 @@ jobs:
ref: 'third-party/common/win' ref: 'third-party/common/win'
path: "${{env.THIRD_PARTY_BASE_DIR}}/common/win" path: "${{env.THIRD_PARTY_BASE_DIR}}/common/win"
- name: Clone third-party deps (deps/win)
uses: actions/checkout@v4
with:
ref: 'third-party/deps/win'
path: "${{env.THIRD_PARTY_BASE_DIR}}/deps/win"
- name: Clone third-party deps (build/win) - name: Clone third-party deps (build/win)
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
@ -146,37 +122,12 @@ jobs:
working-directory: ${{ github.workspace }} working-directory: ${{ github.workspace }}
run: build_win.bat -verbose ${{ env.build_mode }} clean +build_str ${{ github.sha }} ${{ env.build_switches }} run: build_win.bat -verbose ${{ env.build_mode }} clean +build_str ${{ github.sha }} ${{ env.build_switches }}
### build all ### upload artifact/package to github Actions (for targets)
- name: Build all - name: Upload build package (for targets)
if: inputs.emu-variant == 'all'
shell: cmd
working-directory: ${{ github.workspace }}
run: |
build_win.bat -verbose release clean +build_str ${{ github.sha }} ${{ env.build_switches }} || exit /b %errorlevel%
build_win.bat -verbose debug clean +build_str ${{ github.sha }} ${{ env.build_switches }} || exit /b %errorlevel%
### package target(s)
- name: Package target(s)
if: inputs.emu-variant != 'all'
shell: cmd
working-directory: ${{ github.workspace }}
run: package_win.bat ${{ env.build_mode }}
### package all
- name: Package all
if: inputs.emu-variant == 'all'
shell: cmd
working-directory: ${{ github.workspace }}
run: |
package_win.bat release || exit /b %errorlevel%
package_win.bat debug || exit /b %errorlevel%
### upload artifact/package to github Actions
- name: Upload build package
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: "win-${{ inputs.emu-variant }}-${{ env.build_arch }}-${{ env.build_mode }}-${{ github.sha }}" name: "emu-win-${{ inputs.emu-variant }}-${{ env.build_arch }}-${{ env.build_mode }}-${{ github.sha }}"
path: "${{ env.PACKAGE_BASE_DIR }}/" path: "build/win/"
if-no-files-found: 'error' if-no-files-found: 'error'
compression-level: 9 compression-level: 9
retention-days: 1 retention-days: 1

View File

@ -1,228 +0,0 @@
name: Emu build (Windows)
on:
push:
branches: [
"ci-build-emu-win*",
"ci-build-all"
]
tags:
- release*
# pull_request:
# branches: [ "dev" ]
# paths-ignore:
# - '**/*.md'
# - 'dev.notes/**'
# - 'post_build/**'
# - 'z_original_repo_files/**'
# - 'sdk/*.txt'
# - 'LICENSE'
# # tools
# - 'tools/generate_emu_config/**'
# - 'tools/migrate_gse/**'
# - 'tools/steamclient_loader/linux/**'
workflow_dispatch:
# allows manual trigger
permissions:
contents: write
env:
DEPS_CACHE_KEY: emu-deps-win
DEPS_CACHE_DIR: build/deps/win
PACKAGE_BASE_DIR: "build/package/win"
THIRD_PARTY_BASE_DIR: 'third-party'
jobs:
# this helps in manual runs, if build fails, then deps are saved
dependencies:
runs-on: windows-2022
# cache but not for tags or PRs
# !tag && !pull_request
# also you could use this: github.event_name != 'pull_request'
if: |
!startsWith(github.ref, 'refs/tags/') &&
!startsWith(github.ref, 'refs/pull/')
steps:
# 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
# we need branch because it has build scripts
- name: Checkout branch
uses: actions/checkout@v4
- name: Lookup cache for deps
id: emu-deps-cache-step
uses: actions/cache@v4
with:
key: ${{ env.DEPS_CACHE_KEY }}
path: ${{ env.DEPS_CACHE_DIR }}
lookup-only: true # don't restore cache if found
- name: Clone third-party deps (deps/win)
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
ref: 'third-party/deps/win'
path: "${{env.THIRD_PARTY_BASE_DIR}}/deps/win"
- name: Clone third-party deps (deps/common)
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
ref: 'third-party/deps/common'
path: "${{env.THIRD_PARTY_BASE_DIR}}/deps/common"
- name: Clone third-party deps (common/win)
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
ref: 'third-party/common/win'
path: "${{env.THIRD_PARTY_BASE_DIR}}/common/win"
- name: Build deps
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
shell: cmd
working-directory: ${{ github.workspace }}
run: build_win_deps.bat -verbose
build:
runs-on: windows-2022
needs: [ dependencies ]
if: ${{ !cancelled() }}
steps:
# 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: Lookup cache for deps
id: emu-deps-cache-step
# !tag && !pull_request
# also you could use this: github.event_name != 'pull_request'
if: |
!startsWith(github.ref, 'refs/tags/') &&
!startsWith(github.ref, 'refs/pull/')
uses: actions/cache@v4
with:
key: ${{ env.DEPS_CACHE_KEY }}
path: ${{ env.DEPS_CACHE_DIR }}
# attempt to download again because in tags/PRs no cache is created
- name: Clone third-party deps (deps/win)
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
ref: 'third-party/deps/win'
path: "${{env.THIRD_PARTY_BASE_DIR}}/deps/win"
- name: Clone third-party deps (deps/common)
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
ref: 'third-party/deps/common'
path: "${{env.THIRD_PARTY_BASE_DIR}}/deps/common"
- name: Clone third-party deps (common/win)
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
ref: 'third-party/common/win'
path: "${{env.THIRD_PARTY_BASE_DIR}}/common/win"
- name: Build deps
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
shell: cmd
working-directory: ${{ github.workspace }}
run: build_win_deps.bat -verbose
## 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 (deps/win)
uses: actions/checkout@v4
with:
ref: 'third-party/deps/win'
path: "${{env.THIRD_PARTY_BASE_DIR}}/deps/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 (release mode)
- name: Build release mode
shell: cmd
working-directory: ${{ github.workspace }}
run: build_win.bat -verbose release +build_str ${{ github.sha }} +exclient-extra-32 +exclient-extra-64 +lib-gameoverlay-32 +lib-gameoverlay-64
### package (release mode)
- name: Package build (release)
shell: cmd
working-directory: ${{ github.workspace }}
run: package_win.bat release
### upload artifact/package to github Actions (release mode)
- name: Upload build package (release)
uses: actions/upload-artifact@v4
with:
name: "build-win-release-${{ github.sha }}"
path: "${{ env.PACKAGE_BASE_DIR }}/release/"
if-no-files-found: 'error'
compression-level: 9
retention-days: 1
### build (debug mode)
- name: Build debug mode
shell: cmd
working-directory: ${{ github.workspace }}
run: build_win.bat -verbose debug +build_str ${{ github.sha }} +exclient-extra-32 +exclient-extra-64 +lib-gameoverlay-32 +lib-gameoverlay-64
### package (debug mode)
- name: Package build (debug)
shell: cmd
working-directory: ${{ github.workspace }}
run: package_win.bat debug
### upload artifact/package to github Actions (debug mode)
- name: Upload build package (debug)
uses: actions/upload-artifact@v4
with:
name: "build-win-debug-${{ github.sha }}"
path: "${{ env.PACKAGE_BASE_DIR }}/debug/"
if-no-files-found: 'error'
compression-level: 9
retention-days: 1
### release (debug + release modes) if this is a tag push
- name: Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: "${{ env.PACKAGE_BASE_DIR }}/**/*"

View File

@ -21,6 +21,7 @@ jobs:
deps-build: deps-build:
runs-on: windows-2022 runs-on: windows-2022
if: ${{ !cancelled() }} if: ${{ !cancelled() }}
steps: steps:
# on Windows Git will auto change line ending to CRLF, not preferable # on Windows Git will auto change line ending to CRLF, not preferable
- name: Ensure LF line ending - name: Ensure LF line ending

View File

@ -15,137 +15,11 @@ on:
- 'tools/migrate_gse/**' - 'tools/migrate_gse/**'
- 'tools/steamclient_loader/linux/**' - 'tools/steamclient_loader/linux/**'
workflow_dispatch:
# allows manual trigger
permissions: permissions:
contents: write contents: write
jobs: jobs:
emu-regular-x32-release: emu-win-all:
name: Regular x32 (release) name: Emu win all
if: ${{ !cancelled() }} if: ${{ !cancelled() }}
uses: ./.github/workflows/build-win-2.yml uses: ./.github/workflows/build-emu-all-win.yml
with:
emu-variant: regular
x32: true
debug: false
emu-regular-x32-debug:
name: Regular x32 (debug)
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-win-2.yml
with:
emu-variant: regular
x32: true
debug: true
emu-exp-x32-release:
name: Experimental x32 (release)
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-win-2.yml
with:
emu-variant: exp
x32: true
debug: false
emu-exp-x32-debug:
name: Experimental x32 (debug)
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-win-2.yml
with:
emu-variant: exp
x32: true
debug: true
emu-client-x32-release:
name: Client x32 (release)
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-win-2.yml
with:
emu-variant: client
x32: true
debug: false
emu-client-x32-debug:
name: Client x32 (debug)
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-win-2.yml
with:
emu-variant: client
x32: true
debug: true
emu-regular-x64-release:
name: Regular x64 (release)
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-win-2.yml
with:
emu-variant: regular
x32: false
debug: false
emu-regular-x64-debug:
name: Regular x64 (debug)
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-win-2.yml
with:
emu-variant: regular
x32: false
debug: true
emu-exp-x64-release:
name: Experimental x64 (release)
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-win-2.yml
with:
emu-variant: exp
x32: false
debug: false
emu-exp-x64-debug:
name: Experimental x64 (debug)
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-win-2.yml
with:
emu-variant: exp
x32: false
debug: true
emu-client-x64-release:
name: Client x64 (release)
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-win-2.yml
with:
emu-variant: client
x32: false
debug: false
emu-client-x64-debug:
name: Client x64 (debug)
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-win-2.yml
with:
emu-variant: client
x32: false
debug: true
tools-release:
name: Tools (release)
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-win-2.yml
with:
emu-variant: tools
debug: false
tools-debug:
name: Tools (debug)
if: ${{ !cancelled() }}
uses: ./.github/workflows/build-win-2.yml
with:
emu-variant: tools
debug: true