CMake #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake | |
concurrency: | |
group: build-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: [ develop ] | |
pull_request: | |
branches: [ develop ] | |
workflow_run: | |
workflows: [Docker Image] | |
types: [completed] | |
branches: [develop] | |
jobs: | |
build-linux: | |
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [x64] | |
os: [ubuntu-20.04, ubuntu-22.04] | |
compiler: [gcc, clang] | |
runs-on: ${{ matrix.os }} | |
env: | |
MATRIX_COMPILER: ${{matrix.compiler}} | |
MATRIX_OS: ${{matrix.os}} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get dependencies | |
run: | | |
echo 'APT::Get::Always-Include-Phased-Updates "false";' | sudo tee /etc/apt/apt.conf.d/99-phased-updates | |
sudo apt-get update && sudo apt-get upgrade | |
sudo mk/linux/setupBuildDeps.sh | |
- name: Build | |
run: | | |
if [ "${MATRIX_COMPILER}" = "clang" ]; then | |
EXTRA_OPTS="-f" | |
fi | |
mk/linux/build-mg.sh -m -d ${EXTRA_OPTS} | |
make -C mk/linux/build -j$(nproc) VERBOSE=1 | |
build-win64-deps: | |
# The CMake configure and build commands are platform agnostic and should work equally | |
# well on Windows or Mac. You can convert this to a matrix build if you need | |
# cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [x64] | |
build_type: [Release] | |
include: | |
- build_type: Release | |
release: 'ON' | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache Vcpkg Libs | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-vcpkg-deps | |
with: | |
path: c:/vcpkg/installed | |
key: vcpkg-deps | |
- name: Install Windows Deps | |
run: | | |
cd mk\windoze | |
$scriptDir = Get-Location | |
cd c:\vcpkg | |
& "$(Join-Path $scriptDir install-deps-vcpkg.ps1)" | |
build-win64: | |
needs: build-win64-deps | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [x64] | |
build_type: [Release] | |
include: | |
- build_type: Release | |
release: 'ON' | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get Vcpkg Libs Cache | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-vcpkg-deps | |
with: | |
path: c:/vcpkg/installed | |
key: vcpkg-deps | |
- name: Build MegaGlest | |
run: | | |
cd mk/windoze | |
./build-mg-vs-cmake.ps1 -vcpkg-location c:/vcpkg/ | |
- name: Git Hash | |
if: ${{ github.ref == 'refs/heads/develop' }} | |
run: echo "VERSION=$(git rev-parse --short HEAD)" >> $env:GITHUB_ENV | |
- name: Prepare Snapshot | |
if: ${{ github.ref == 'refs/heads/develop' }} | |
run: | | |
cd mk\windoze | |
Get-ChildItem *.exe | Rename-Item -NewName {$_.BaseName + "-$env:VERSION" + $_.Extension} | |
cp ..\shared\*.ini . | |
$7zPath = $(Get-Command 7z).Source | |
cp $7zPath . | |
Remove-Item glest-dev.ini | |
Compress-Archive -Path *.exe,*.ini -DestinationPath megaglest-$env:VERSION-x64-windows.zip | |
cd ../.. | |
- name: Create MegaGlest Snapshot | |
if: ${{ github.ref == 'refs/heads/develop' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: megaglest-x64-windows | |
retention-days: 1 | |
path: mk/windoze/*.zip | |
on-dockerbuild-failure: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'failure' }} | |
steps: | |
- run: | | |
echo 'The triggering workflow failed' | |
exit 1 | |
build-macos: | |
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }} | |
strategy: | |
fail-fast: false | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get dependencies | |
run: | | |
# temp hack fix to make brew work | |
brew unlink [email protected] && brew link --overwrite [email protected] | |
brew unlink node@18 | |
mk/macos/setupBuildDeps.sh | |
# more stupid hacks - these will need removing or changing at some point. | |
cd /usr/local/Cellar/libnghttp2/ | |
ln -s 1.58.0 1.57.0 | |
cd - | |
- name: Build MegaGlest With Clang Compiler | |
run: | | |
export HOMEBREW_FORCE_BREWED_CURL=1 | |
mk/macos/build-mg.sh -m | |
make -C mk/macos/build -j$(sysctl -n hw.ncpu) VERBOSE=1 | |
- name: Git Hash | |
if: ${{ github.ref == 'refs/heads/develop' }} | |
run: | | |
echo "VERSION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: Prepare Snapshot | |
if: ${{ github.ref == 'refs/heads/develop' }} | |
run: | | |
cd mk/macos | |
./make-binary-archive.sh | |
cd - | |
mv release/mg-binary-macos*.tar.bz2 release/megaglest-$VERSION-x64-macos.tar.bz2 | |
- name: Create MegaGlest Snapshot | |
if: ${{ github.ref == 'refs/heads/develop' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: megaglest-x64-macos | |
retention-days: 1 | |
path: release/*.tar.bz2 |