gbe_fork/.github/workflows/build-linux.yml
2023-12-18 02:50:05 +02:00

121 lines
3.2 KiB
YAML

name: Linux-build
on:
push:
branches: [ "ci_runner" ]
# pull_request:
# branches: [ "ci_runner" ]
permissions:
contents: read
env:
# Expected format {owner}/{repo}.
DEPS_REPO: 'otavepto/gbe_fork-deps'
THIRD_PARTY_BASE_DIR: 'third-party'
DEPS_CACHE_KEY: emu-deps-linux
DEPS_CACHE_DIR: build-linux-deps
jobs:
dependencies:
runs-on: ubuntu-22.04
steps:
- 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
# we need the repo to build the deps since it has the 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/linux)
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: "${{env.DEPS_REPO}}"
ref: 'deps/linux'
path: "${{env.THIRD_PARTY_BASE_DIR}}/deps/linux"
lfs: true
- name: Clone third-party deps (deps/common)
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: "${{env.DEPS_REPO}}"
ref: 'deps/common'
path: "${{env.THIRD_PARTY_BASE_DIR}}/deps/common"
lfs: true
- name: Build deps
if: steps.emu-deps-cache-step.outputs.cache-hit != 'true'
shell: bash
run: sudo chmod 777 build_linux_deps.sh && sudo ./build_linux_deps.sh
build:
needs: [ dependencies ]
runs-on: ubuntu-22.04
steps:
- name: Checkout branch
uses: actions/checkout@v4
### deps
- name: Grab cache for deps
id: emu-deps-cache-step
uses: actions/cache@v3
with:
key: ${{ env.DEPS_CACHE_KEY }}
path: ${{ env.DEPS_CACHE_DIR }}
fail-on-cache-miss: true
- name: Install required packages
shell: bash
run: sudo chmod 777 build_linux_deps.sh && sudo ./build_linux_deps.sh -packages_only
- name: Clone third-party build helpers (build/linux)
uses: actions/checkout@v4
with:
repository: "${{env.DEPS_REPO}}"
ref: 'build/linux'
path: "${{env.THIRD_PARTY_BASE_DIR}}/build/linux"
lfs: true
### build + upload release
- name: Build release mode
continue-on-error: true
shell: bash
working-directory: ${{ github.workspace }}
run: "sudo chmod 777 build_linux.sh && ./build_linux.sh release"
- name: Upload build (release)
if: success()
uses: actions/upload-artifact@v4
with:
name: "build-linux-release-${{ github.sha }}"
path: 'build-linux/release/'
if-no-files-found: 'error'
compression-level: 9
### build + upload debug
- name: Build debug mode
continue-on-error: true
shell: bash
working-directory: ${{ github.workspace }}
run: "sudo chmod 777 build_linux.sh && ./build_linux.sh debug"
- name: Upload build (debug)
if: success()
uses: actions/upload-artifact@v4
with:
name: "build-linux-debug-${{ github.sha }}"
path: 'build-linux/debug/'
if-no-files-found: 'error'
compression-level: 9