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