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*
|
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-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:
|
|
|
|
THIRD_PARTY_BASE_DIR: 'third-party'
|
2023-12-17 01:58:52 +02:00
|
|
|
|
2023-12-16 16:44:23 +02:00
|
|
|
DEPS_CACHE_KEY: emu-deps-linux
|
|
|
|
DEPS_CACHE_DIR: build-linux-deps
|
2023-12-20 15:37:05 +02:00
|
|
|
|
2023-12-17 01:58:52 +02:00
|
|
|
PACKAGE_ROOT_PATH: "build-linux/package"
|
|
|
|
|
2023-12-16 07:20:05 +02:00
|
|
|
jobs:
|
2023-12-20 15:37:05 +02:00
|
|
|
build:
|
2023-12-16 07:20:05 +02:00
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
|
|
|
|
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/')
|
|
|
|
|
2023-12-16 07:20:05 +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-16 07:20:05 +02:00
|
|
|
lookup-only: true
|
|
|
|
|
|
|
|
- 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"
|
|
|
|
|
|
|
|
- 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
|
2023-12-16 07:25:21 +02:00
|
|
|
run: sudo chmod 777 build_linux_deps.sh && sudo ./build_linux_deps.sh
|
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
|
|
|
|
run: sudo chmod 777 build_linux_deps.sh && sudo ./build_linux_deps.sh -packages_only
|
|
|
|
|
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-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 }}
|
|
|
|
run: "sudo chmod 777 build_linux.sh && ./build_linux.sh release"
|
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)
|
2023-12-17 01:58:52 +02:00
|
|
|
- name: Upload build pacakge (release)
|
2023-12-16 07:20:05 +02:00
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: "build-linux-release-${{ github.sha }}"
|
2023-12-17 01:58:52 +02:00
|
|
|
path: "${{ env.PACKAGE_ROOT_PATH }}/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 }}
|
2023-12-16 09:56:33 +02:00
|
|
|
run: "sudo chmod 777 build_linux.sh && ./build_linux.sh debug"
|
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)
|
2023-12-17 01:58:52 +02:00
|
|
|
- name: Upload build pacakge (debug)
|
2023-12-16 07:20:05 +02:00
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: "build-linux-debug-${{ github.sha }}"
|
2023-12-17 01:58:52 +02:00
|
|
|
path: "${{ env.PACKAGE_ROOT_PATH }}/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:
|
|
|
|
files: "${{ env.PACKAGE_ROOT_PATH }}/**/*"
|
2023-12-16 07:20:05 +02:00
|
|
|
|