From a8b01e8e4d70f99dc1e9d6a7905aa4ab68068802 Mon Sep 17 00:00:00 2001 From: otavepto <153766569+otavepto@users.noreply.github.com> Date: Sat, 11 May 2024 01:20:33 +0300 Subject: [PATCH] testing a better alternative for deps build --- .github/workflows/build-win-2.yml | 140 ++++++++++++++++++++++++++++++ .github/workflows/deps-win.yml | 71 +++++++++++++++ 2 files changed, 211 insertions(+) create mode 100644 .github/workflows/build-win-2.yml create mode 100644 .github/workflows/deps-win.yml diff --git a/.github/workflows/build-win-2.yml b/.github/workflows/build-win-2.yml new file mode 100644 index 00000000..8f344171 --- /dev/null +++ b/.github/workflows/build-win-2.yml @@ -0,0 +1,140 @@ +name: Emu build 2 (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: + uses: ./.github/workflows/deps-win.yml + + + 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 + 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 (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 new file mode 100644 index 00000000..67a2e1a0 --- /dev/null +++ b/.github/workflows/deps-win.yml @@ -0,0 +1,71 @@ +name: Third-party dependencies (Windows) + +on: + workflow_call: + # needed since it allows this to become a reusable workflow + 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 + 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: 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 + + # we need branch because it has build scripts + - name: Checkout branch + if: steps.emu-deps-cache-step.outputs.cache-hit != 'true' + uses: actions/checkout@v4 + + - 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