2023-12-16 23:50:30 +08:00
|
|
|
name: Emu build (Windows)
|
2023-12-15 21:12:26 +08:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2023-12-16 23:35:56 +08:00
|
|
|
branches: [
|
2023-12-17 07:58:52 +08:00
|
|
|
"ci-build-emu-win*",
|
2023-12-16 23:35:56 +08:00
|
|
|
"ci-build-all"
|
|
|
|
]
|
2023-12-17 07:58:52 +08:00
|
|
|
tags:
|
|
|
|
- release*
|
2023-12-16 23:35:56 +08:00
|
|
|
pull_request:
|
|
|
|
branches: [ "dev" ]
|
2023-12-17 07:58:52 +08:00
|
|
|
workflow_dispatch:
|
2023-12-20 21:07:01 +08:00
|
|
|
# allows manual trigger
|
2023-12-15 21:12:26 +08:00
|
|
|
|
|
|
|
permissions:
|
2023-12-17 07:58:52 +08:00
|
|
|
contents: write
|
2023-12-15 21:12:26 +08:00
|
|
|
|
|
|
|
env:
|
2023-12-16 22:44:23 +08:00
|
|
|
DEPS_CACHE_KEY: emu-deps-win
|
2023-12-27 03:32:52 +08:00
|
|
|
DEPS_CACHE_DIR: build/deps/win
|
2023-12-17 07:58:52 +08:00
|
|
|
|
2023-12-28 03:45:55 +08:00
|
|
|
PACKAGE_BASE_DIR: "build/package/win"
|
2023-12-26 08:22:08 +08:00
|
|
|
THIRD_PARTY_BASE_DIR: 'third-party'
|
2023-12-15 21:12:26 +08:00
|
|
|
|
|
|
|
jobs:
|
2023-12-27 02:16:21 +08:00
|
|
|
# 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:
|
|
|
|
# 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@v3
|
|
|
|
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 }}
|
2024-03-03 11:17:01 +08:00
|
|
|
run: build_win_deps.bat -verbose
|
2023-12-27 02:16:21 +08:00
|
|
|
|
|
|
|
|
2023-12-20 21:37:05 +08:00
|
|
|
build:
|
2023-12-16 12:37:14 +08:00
|
|
|
runs-on: windows-2022
|
2023-12-27 02:16:21 +08:00
|
|
|
needs: [ dependencies ]
|
2023-12-28 04:46:39 +08:00
|
|
|
if: ${{ !cancelled() }}
|
2023-12-15 21:12:26 +08:00
|
|
|
|
|
|
|
steps:
|
2023-12-20 21:37:05 +08:00
|
|
|
- name: Checkout branch
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
### deps
|
2023-12-16 12:08:03 +08:00
|
|
|
- name: Lookup cache for deps
|
2023-12-16 22:44:23 +08:00
|
|
|
id: emu-deps-cache-step
|
2023-12-20 21:37:05 +08:00
|
|
|
# !tag && !pull_request
|
|
|
|
# also you could use this: github.event_name != 'pull_request'
|
|
|
|
if: |
|
|
|
|
!startsWith(github.ref, 'refs/tags/') &&
|
|
|
|
!startsWith(github.ref, 'refs/pull/')
|
2023-12-15 21:12:26 +08:00
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
2023-12-16 22:44:23 +08:00
|
|
|
key: ${{ env.DEPS_CACHE_KEY }}
|
|
|
|
path: ${{ env.DEPS_CACHE_DIR }}
|
2023-12-15 21:12:26 +08:00
|
|
|
|
2023-12-27 02:16:21 +08:00
|
|
|
# attempt to download again because in tags/PRs no cache is created
|
2023-12-15 21:12:26 +08:00
|
|
|
- name: Clone third-party deps (deps/win)
|
2023-12-16 22:44:23 +08:00
|
|
|
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
|
2023-12-15 21:12:26 +08:00
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
2023-12-17 01:51:55 +08:00
|
|
|
ref: 'third-party/deps/win'
|
2023-12-15 21:12:26 +08:00
|
|
|
path: "${{env.THIRD_PARTY_BASE_DIR}}/deps/win"
|
|
|
|
|
|
|
|
- name: Clone third-party deps (deps/common)
|
2023-12-16 22:44:23 +08:00
|
|
|
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
|
2023-12-15 21:12:26 +08:00
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
2023-12-17 01:51:55 +08:00
|
|
|
ref: 'third-party/deps/common'
|
2023-12-15 21:12:26 +08:00
|
|
|
path: "${{env.THIRD_PARTY_BASE_DIR}}/deps/common"
|
|
|
|
|
|
|
|
- name: Clone third-party deps (common/win)
|
2023-12-16 22:44:23 +08:00
|
|
|
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
|
2023-12-15 21:12:26 +08:00
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
2023-12-17 01:51:55 +08:00
|
|
|
ref: 'third-party/common/win'
|
2023-12-15 21:12:26 +08:00
|
|
|
path: "${{env.THIRD_PARTY_BASE_DIR}}/common/win"
|
|
|
|
|
|
|
|
- name: Build deps
|
2023-12-16 22:44:23 +08:00
|
|
|
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
|
2023-12-15 21:12:26 +08:00
|
|
|
shell: cmd
|
2023-12-16 13:25:21 +08:00
|
|
|
working-directory: ${{ github.workspace }}
|
2024-03-03 11:17:01 +08:00
|
|
|
run: build_win_deps.bat -verbose
|
2023-12-15 21:12:26 +08:00
|
|
|
|
2023-12-20 21:37:05 +08:00
|
|
|
## extra helpers/tools, these are not built inside the deps build dir
|
2023-12-15 21:12:26 +08:00
|
|
|
- name: Clone third-party build helpers (common/win)
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
2023-12-17 01:51:55 +08:00
|
|
|
ref: 'third-party/common/win'
|
2023-12-15 21:12:26 +08:00
|
|
|
path: "${{env.THIRD_PARTY_BASE_DIR}}/common/win"
|
|
|
|
|
2023-12-17 07:58:52 +08:00
|
|
|
- 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"
|
|
|
|
|
2024-01-01 01:54:03 +08:00
|
|
|
- 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"
|
|
|
|
|
2023-12-20 21:37:05 +08:00
|
|
|
### build (release mode)
|
2023-12-15 21:12:26 +08:00
|
|
|
- name: Build release mode
|
|
|
|
shell: cmd
|
2023-12-16 13:25:21 +08:00
|
|
|
working-directory: ${{ github.workspace }}
|
2024-03-03 11:17:01 +08:00
|
|
|
run: build_win.bat -verbose +exclient-extra-32 +exclient-extra-64 release
|
2023-12-15 21:12:26 +08:00
|
|
|
|
2023-12-20 21:37:05 +08:00
|
|
|
### package (release mode)
|
2023-12-17 07:58:52 +08:00
|
|
|
- name: Package build (release)
|
|
|
|
shell: cmd
|
|
|
|
working-directory: ${{ github.workspace }}
|
|
|
|
run: package_win.bat release
|
|
|
|
|
2023-12-20 21:37:05 +08:00
|
|
|
### upload artifact/package to github Actions (release mode)
|
2024-02-06 04:18:00 +08:00
|
|
|
- name: Upload build package (release)
|
2023-12-16 12:08:03 +08:00
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
2023-12-16 12:22:06 +08:00
|
|
|
name: "build-win-release-${{ github.sha }}"
|
2023-12-26 08:22:08 +08:00
|
|
|
path: "${{ env.PACKAGE_BASE_DIR }}/release/"
|
2023-12-16 12:08:03 +08:00
|
|
|
if-no-files-found: 'error'
|
|
|
|
compression-level: 9
|
2023-12-16 23:35:20 +08:00
|
|
|
retention-days: 1
|
2023-12-16 12:08:03 +08:00
|
|
|
|
2023-12-20 21:37:05 +08:00
|
|
|
### build (debug mode)
|
2023-12-16 12:22:06 +08:00
|
|
|
- name: Build debug mode
|
|
|
|
shell: cmd
|
2023-12-16 13:25:21 +08:00
|
|
|
working-directory: ${{ github.workspace }}
|
2024-03-03 11:17:01 +08:00
|
|
|
run: build_win.bat -verbose +exclient-extra-32 +exclient-extra-64 debug
|
2023-12-16 12:22:06 +08:00
|
|
|
|
2023-12-20 21:37:05 +08:00
|
|
|
### package (debug mode)
|
2023-12-17 07:58:52 +08:00
|
|
|
- name: Package build (debug)
|
|
|
|
shell: cmd
|
|
|
|
working-directory: ${{ github.workspace }}
|
|
|
|
run: package_win.bat debug
|
|
|
|
|
2023-12-20 21:37:05 +08:00
|
|
|
### upload artifact/package to github Actions (debug mode)
|
2024-02-06 04:18:00 +08:00
|
|
|
- name: Upload build package (debug)
|
2023-12-16 12:08:03 +08:00
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
2023-12-16 12:22:06 +08:00
|
|
|
name: "build-win-debug-${{ github.sha }}"
|
2023-12-26 08:22:08 +08:00
|
|
|
path: "${{ env.PACKAGE_BASE_DIR }}/debug/"
|
2023-12-16 12:08:03 +08:00
|
|
|
if-no-files-found: 'error'
|
|
|
|
compression-level: 9
|
2023-12-16 23:35:20 +08:00
|
|
|
retention-days: 1
|
2023-12-17 07:58:52 +08:00
|
|
|
|
2023-12-20 21:37:05 +08:00
|
|
|
### release (debug + release modes) if this is a tag push
|
2023-12-17 07:58:52 +08:00
|
|
|
- name: Release
|
2023-12-25 21:22:02 +08:00
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
2023-12-17 07:58:52 +08:00
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
with:
|
2023-12-26 08:22:08 +08:00
|
|
|
files: "${{ env.PACKAGE_BASE_DIR }}/**/*"
|
2023-12-16 12:08:03 +08:00
|
|
|
|