diff --git a/.github/workflows/build-emu-all-win.yml b/.github/workflows/build-emu-all-win.yml new file mode 100644 index 00000000..d29a7321 --- /dev/null +++ b/.github/workflows/build-emu-all-win.yml @@ -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 diff --git a/.github/workflows/build-win-2.yml b/.github/workflows/build-emu-variant-win.yml similarity index 62% rename from .github/workflows/build-win-2.yml rename to .github/workflows/build-emu-variant-win.yml index 505daf39..01a1c798 100644 --- a/.github/workflows/build-win-2.yml +++ b/.github/workflows/build-emu-variant-win.yml @@ -1,4 +1,4 @@ -name: Emu build 2 (Windows) +name: Build emu variant (Windows) on: workflow_call: @@ -10,31 +10,25 @@ on: exp: build the experimental version of the emu client: build the experimental steamclient version of the emu tools: build the tools only - all: build all variants - default: 'all' - required: false + required: true type: string x32: description: | - build architecture, unused when 'emu-variant' == 'all' or 'emu-variant' == 'tools' + build architecture, unused when 'emu-variant' == 'tools' true: x32 false: x64 - default: true required: false type: boolean + default: true debug: description: | - build mode, unused when 'emu-variant' == 'all' + build mode true: build in debug mode false: build in release mode - default: false - required: false + required: true type: boolean - - workflow_dispatch: - # allows manual trigger permissions: contents: write @@ -43,19 +37,11 @@ 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: - dependencies: - name: Restore or build deps - if: ${{ !cancelled() }} - uses: ./.github/workflows/deps-win.yml - - build: runs-on: windows-2022 - needs: [ dependencies ] if: ${{ !cancelled() }} steps: ### setup build vars @@ -65,14 +51,6 @@ jobs: echo env file = "%GITHUB_ENV%" 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=" if /i "${{ inputs.x32 }}"=="true" ( set "arch=32" @@ -90,16 +68,20 @@ jobs: 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 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 ( 1>&2 echo [X] invalid emu variant "${{ inputs.emu-variant }}" exit /b 1 ) - - echo final 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 - name: Ensure LF line ending shell: cmd @@ -127,12 +109,6 @@ jobs: 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: @@ -146,37 +122,12 @@ jobs: working-directory: ${{ github.workspace }} run: build_win.bat -verbose ${{ env.build_mode }} clean +build_str ${{ github.sha }} ${{ env.build_switches }} -### build all - - name: Build all - 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 +### upload artifact/package to github Actions (for targets) + - name: Upload build package (for targets) uses: actions/upload-artifact@v4 with: - name: "win-${{ inputs.emu-variant }}-${{ env.build_arch }}-${{ env.build_mode }}-${{ github.sha }}" - path: "${{ env.PACKAGE_BASE_DIR }}/" + 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 diff --git a/.github/workflows/build-win.yml b/.github/workflows/build-win.yml deleted file mode 100644 index 636bedae..00000000 --- a/.github/workflows/build-win.yml +++ /dev/null @@ -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 }}/**/*" - \ No newline at end of file diff --git a/.github/workflows/deps-win.yml b/.github/workflows/deps-win.yml index f24a9253..68efa705 100644 --- a/.github/workflows/deps-win.yml +++ b/.github/workflows/deps-win.yml @@ -21,6 +21,7 @@ jobs: deps-build: runs-on: windows-2022 if: ${{ !cancelled() }} + steps: # on Windows Git will auto change line ending to CRLF, not preferable - name: Ensure LF line ending diff --git a/.github/workflows/pull-request-win.yml b/.github/workflows/pull-request-win.yml index 0fff2292..63035c73 100644 --- a/.github/workflows/pull-request-win.yml +++ b/.github/workflows/pull-request-win.yml @@ -14,138 +14,12 @@ on: - 'tools/generate_emu_config/**' - 'tools/migrate_gse/**' - 'tools/steamclient_loader/linux/**' - - workflow_dispatch: - # allows manual trigger permissions: contents: write jobs: - emu-regular-x32-release: - name: Regular x32 (release) + emu-win-all: + name: Emu win all if: ${{ !cancelled() }} - uses: ./.github/workflows/build-win-2.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 + uses: ./.github/workflows/build-emu-all-win.yml