2023-12-16 17:50:30 +02:00
|
|
|
name: Emu build (Linux)
|
2023-12-16 07:20:05 +02:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2023-12-16 17:35:56 +02:00
|
|
|
branches: [
|
2023-12-17 01:58:52 +02:00
|
|
|
"ci-build-emu-linux*",
|
2023-12-16 17:35:56 +02:00
|
|
|
"ci-build-all"
|
|
|
|
]
|
2023-12-17 01:58:52 +02:00
|
|
|
tags:
|
|
|
|
- release*
|
2024-05-06 19:14:03 +03:00
|
|
|
|
2024-05-11 02:01:35 +03:00
|
|
|
# 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/**' # these are just shell scripts, not compiled
|
2024-05-06 19:14:03 +03:00
|
|
|
|
2023-12-17 01:58:52 +02:00
|
|
|
workflow_dispatch:
|
2023-12-20 15:07:01 +02:00
|
|
|
# allows manual trigger
|
2023-12-16 07:20:05 +02:00
|
|
|
|
|
|
|
permissions:
|
2023-12-17 01:58:52 +02:00
|
|
|
contents: write
|
2023-12-16 07:20:05 +02:00
|
|
|
|
|
|
|
env:
|
2023-12-16 16:44:23 +02:00
|
|
|
DEPS_CACHE_KEY: emu-deps-linux
|
2023-12-26 21:32:52 +02:00
|
|
|
DEPS_CACHE_DIR: build/deps/linux
|
2023-12-20 15:37:05 +02:00
|
|
|
|
2023-12-27 21:45:55 +02:00
|
|
|
PACKAGE_BASE_DIR: "build/package/linux"
|
2023-12-26 02:22:08 +02:00
|
|
|
THIRD_PARTY_BASE_DIR: 'third-party'
|
2023-12-17 01:58:52 +02:00
|
|
|
|
2023-12-16 07:20:05 +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: ubuntu-22.04
|
|
|
|
# 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
|
|
|
|
|
2023-12-26 21:19:45 +02:00
|
|
|
### fix folder permissions! not sure why this fails
|
|
|
|
# nested subdirs "build/linux/release" cause permission problems
|
|
|
|
- name: Give all permissions for repo folder
|
|
|
|
shell: bash
|
|
|
|
working-directory: ${{ github.workspace }}
|
|
|
|
run: sudo chmod -R 777 "${{ github.workspace }}"
|
|
|
|
|
2023-12-26 20:16:21 +02:00
|
|
|
- name: Lookup cache for deps
|
|
|
|
id: emu-deps-cache-step
|
2024-04-10 11:48:00 +02:00
|
|
|
uses: actions/cache@v4
|
2023-12-26 20:16:21 +02:00
|
|
|
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/linux)
|
|
|
|
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
ref: 'third-party/deps/linux'
|
|
|
|
path: "${{env.THIRD_PARTY_BASE_DIR}}/deps/linux"
|
|
|
|
|
|
|
|
- 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: Build deps
|
|
|
|
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
|
|
|
|
shell: bash
|
2024-03-03 05:17:01 +02:00
|
|
|
run: sudo chmod 777 build_linux_deps.sh && sudo ./build_linux_deps.sh -verbose
|
2023-12-26 20:16:21 +02:00
|
|
|
|
|
|
|
|
2023-12-20 15:37:05 +02:00
|
|
|
build:
|
2023-12-16 07:20:05 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2023-12-26 20:16:21 +02:00
|
|
|
needs: [ dependencies ]
|
2023-12-27 22:46:39 +02:00
|
|
|
if: ${{ !cancelled() }}
|
2023-12-16 07:20:05 +02:00
|
|
|
|
|
|
|
steps:
|
2023-12-20 15:37:05 +02:00
|
|
|
- name: Checkout branch
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
### deps
|
2023-12-16 07:20:05 +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/')
|
2024-04-10 11:48:00 +02:00
|
|
|
uses: actions/cache@v4
|
2023-12-16 07:20:05 +02:00
|
|
|
with:
|
2023-12-16 16:44:23 +02:00
|
|
|
key: ${{ env.DEPS_CACHE_KEY }}
|
|
|
|
path: ${{ env.DEPS_CACHE_DIR }}
|
2023-12-16 07:20:05 +02:00
|
|
|
|
2023-12-26 20:16:21 +02:00
|
|
|
# attempt to download again because in tags/PRs no cache is created
|
2023-12-16 07:20:05 +02:00
|
|
|
- name: Clone third-party deps (deps/linux)
|
2023-12-16 16:44:23 +02:00
|
|
|
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
|
2023-12-16 07:20:05 +02:00
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
2023-12-16 19:51:55 +02:00
|
|
|
ref: 'third-party/deps/linux'
|
2023-12-16 07:20:05 +02:00
|
|
|
path: "${{env.THIRD_PARTY_BASE_DIR}}/deps/linux"
|
|
|
|
|
|
|
|
- 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-16 07:20:05 +02:00
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
2023-12-16 19:51:55 +02:00
|
|
|
ref: 'third-party/deps/common'
|
2023-12-16 07:20:05 +02:00
|
|
|
path: "${{env.THIRD_PARTY_BASE_DIR}}/deps/common"
|
|
|
|
|
2023-12-28 00:59:15 +02:00
|
|
|
### fix folder permissions! not sure why this fails
|
|
|
|
# nested subdirs "build/linux/release" cause permission problems
|
|
|
|
- name: Give all permissions for repo folder
|
|
|
|
shell: bash
|
|
|
|
working-directory: ${{ github.workspace }}
|
|
|
|
run: sudo chmod -R 777 "${{ github.workspace }}"
|
|
|
|
|
2023-12-16 07:20:05 +02:00
|
|
|
- name: Build deps
|
2023-12-16 16:44:23 +02:00
|
|
|
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
|
2023-12-16 07:20:05 +02:00
|
|
|
shell: bash
|
2024-03-03 05:17:01 +02:00
|
|
|
run: sudo chmod 777 build_linux_deps.sh && sudo ./build_linux_deps.sh -verbose
|
2023-12-16 07:20:05 +02:00
|
|
|
|
2023-12-20 15:37:05 +02:00
|
|
|
## mandatory Linux packages, installed via sudo apt install ...
|
2023-12-16 08:37:31 +02:00
|
|
|
- name: Install required packages
|
|
|
|
shell: bash
|
2024-03-03 05:17:01 +02:00
|
|
|
run: sudo chmod 777 build_linux_deps.sh && sudo ./build_linux_deps.sh -verbose -packages_only
|
2023-12-16 08:37:31 +02:00
|
|
|
|
2023-12-20 15:37:05 +02:00
|
|
|
## extra helpers/tools, these are not built inside the deps build dir
|
2023-12-16 07:20:05 +02:00
|
|
|
- name: Clone third-party build helpers (build/linux)
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
2023-12-16 19:51:55 +02:00
|
|
|
ref: 'third-party/build/linux'
|
2023-12-16 07:20:05 +02:00
|
|
|
path: "${{env.THIRD_PARTY_BASE_DIR}}/build/linux"
|
|
|
|
|
2023-12-28 00:59:15 +02:00
|
|
|
### fix folder permissions! not sure why this fails
|
|
|
|
# nested subdirs "build/linux/release" cause permission problems
|
|
|
|
- name: Give all permissions for repo folder
|
|
|
|
shell: bash
|
|
|
|
working-directory: ${{ github.workspace }}
|
|
|
|
run: sudo chmod -R 777 "${{ github.workspace }}"
|
|
|
|
|
2023-12-20 15:37:05 +02:00
|
|
|
### build (release mode)
|
2023-12-16 07:20:05 +02:00
|
|
|
- name: Build release mode
|
|
|
|
shell: bash
|
2023-12-16 07:25:21 +02:00
|
|
|
working-directory: ${{ github.workspace }}
|
2024-04-10 10:59:51 +02:00
|
|
|
run: "sudo chmod 777 build_linux.sh && ./build_linux.sh -verbose release +build_str ${{ github.sha }}"
|
2023-12-16 07:20:05 +02:00
|
|
|
|
2023-12-20 15:37:05 +02:00
|
|
|
### package (release mode)
|
2023-12-17 01:58:52 +02:00
|
|
|
- name: Package build (release)
|
|
|
|
shell: bash
|
|
|
|
working-directory: ${{ github.workspace }}
|
|
|
|
run: sudo chmod 77 package_linux.sh && sudo ./package_linux.sh release
|
|
|
|
|
2023-12-20 15:37:05 +02:00
|
|
|
### upload artifact/package to github Actions (release mode)
|
2024-02-05 22:18:00 +02:00
|
|
|
- name: Upload build package (release)
|
2023-12-16 07:20:05 +02:00
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: "build-linux-release-${{ github.sha }}"
|
2023-12-26 02:22:08 +02:00
|
|
|
path: "${{ env.PACKAGE_BASE_DIR }}/release/"
|
2023-12-16 07:20:05 +02:00
|
|
|
if-no-files-found: 'error'
|
|
|
|
compression-level: 9
|
2023-12-16 17:35:20 +02:00
|
|
|
retention-days: 1
|
2023-12-16 07:20:05 +02:00
|
|
|
|
2023-12-20 15:37:05 +02:00
|
|
|
### build (debug mode)
|
2023-12-16 07:20:05 +02:00
|
|
|
- name: Build debug mode
|
|
|
|
shell: bash
|
2023-12-16 07:25:21 +02:00
|
|
|
working-directory: ${{ github.workspace }}
|
2024-04-10 10:59:51 +02:00
|
|
|
run: "sudo chmod 777 build_linux.sh && ./build_linux.sh -verbose debug +build_str ${{ github.sha }}"
|
2023-12-16 07:20:05 +02:00
|
|
|
|
2023-12-20 15:37:05 +02:00
|
|
|
### package (debug mode)
|
2023-12-17 01:58:52 +02:00
|
|
|
- name: Package build (debug)
|
|
|
|
shell: bash
|
|
|
|
working-directory: ${{ github.workspace }}
|
|
|
|
run: sudo chmod 77 package_linux.sh && sudo ./package_linux.sh debug
|
|
|
|
|
2023-12-20 15:37:05 +02:00
|
|
|
### upload artifact/package to github Actions (debug mode)
|
2024-02-05 22:18:00 +02:00
|
|
|
- name: Upload build package (debug)
|
2023-12-16 07:20:05 +02:00
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: "build-linux-debug-${{ github.sha }}"
|
2023-12-26 02:22:08 +02:00
|
|
|
path: "${{ env.PACKAGE_BASE_DIR }}/debug/"
|
2023-12-16 07:20:05 +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 07:20:05 +02:00
|
|
|
|