Skip to content

Commit

Permalink
ci: building job was universialised for using same code on both OS
Browse files Browse the repository at this point in the history
  • Loading branch information
SNMetamorph committed Jan 21, 2024
1 parent 02d2d08 commit 5e829fb
Showing 1 changed file with 15 additions and 64 deletions.
79 changes: 15 additions & 64 deletions .github/workflows/nightly-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- 'documentation/**'

jobs:
build-windows:
build-generic:
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -21,7 +21,10 @@ jobs:
cmake_preset: windows-x64-debug
build_conf: Debug
devenv_arch: amd64

- os: ubuntu-22.04
cmake_preset: linux-x64-debug
build_conf: Debug
devenv_arch: none
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -35,9 +38,17 @@ jobs:
run: cmake -E make_directory ${{ github.workspace }}/build

- uses: ilammy/[email protected]
if: runner.os == 'Windows'
with:
arch: ${{ matrix.devenv_arch }}

- name: Install Linux-specific dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install gcc-multilib g++-multilib cmake
sudo apt-get install qtbase5-dev
- name: Install ninja-build tool
uses: seanmiddleditch/gha-setup-ninja@v4

Expand All @@ -60,68 +71,8 @@ jobs:
mkdir -p publish/primext/bin
mkdir -p publish/primext/devkit
cp -r build/${{ matrix.build_conf }}/primext/* publish/primext/
cp build/${{ matrix.build_conf }}/primext_run publish/
cp -r game_dir/* publish/primext
pushd publish
zip -r ../artifacts/primext-${{ matrix.cmake_preset }}.zip ./*
popd
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: artifact-${{ matrix.cmake_preset }}
path: artifacts/*

build-linux:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-22.04
cmake_preset: linux-x64-debug
build_conf: Debug

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: Create build environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
run: cmake -E make_directory ${{ github.workspace }}/build

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install gcc-multilib g++-multilib cmake ninja-build
sudo apt-get install qtbase5-dev
- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{ github.workspace }}/build
# Note the current convention is to use the -S and -B options here to specify source
# and build directories, but this is only available with CMake 3.13 and higher.
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
run: cmake $GITHUB_WORKSPACE --preset ${{ matrix.cmake_preset }}

- name: Build
working-directory: ${{ github.workspace }}/build
shell: bash
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config ${{ matrix.build_conf }} --parallel 8

- name: Prepare artifacts
run: |
mkdir artifacts/
mkdir -p publish/primext/bin
mkdir -p publish/primext/devkit
cp -r build/${{ matrix.build_conf }}/primext/* publish/primext/
cp build/${{ matrix.build_conf }}/primext_run publish/
cp build/${{ matrix.build_conf }}/primext_run publish/ || true
cp build/${{ matrix.build_conf }}/primext.exe publish/ || true
cp -r game_dir/* publish/primext
pushd publish
zip -r ../artifacts/primext-${{ matrix.cmake_preset }}.zip ./*
Expand Down

0 comments on commit 5e829fb

Please sign in to comment.