fallout2-ce/.github/workflows/ci-build.yml
Alexander Batalov 42376b7172 Format workflows
2022-07-26 16:49:10 +03:00

190 lines
3.9 KiB
YAML

name: Build
on:
push:
paths:
- '.github/workflows/ci-build.yml'
- 'src/**.cc'
- 'src/**.h'
- '**/CMakeLists.txt'
- '**/*.cmake'
pull_request:
paths:
- '.github/workflows/ci-build.yml'
- 'src/**.cc'
- 'src/**.h'
- '**/CMakeLists.txt'
- '**/*.cmake'
defaults:
run:
shell: bash
jobs:
static-analysis:
name: Static analysis
runs-on: ubuntu-latest
steps:
- name: Install
run: |
sudo apt update
sudo apt install cppcheck
- name: Clone
uses: actions/checkout@v3
- name: cppcheck
run: cppcheck --std=c++17 src/
linux:
name: Linux (${{ matrix.arch }})
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
arch:
- x86
- x64
steps:
- name: Clone
uses: actions/checkout@v3
- name: Dependencies (x86)
if: matrix.arch == 'x86'
run: |
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install --allow-downgrades libpcre2-8-0=10.34-7
sudo apt install g++-multilib libsdl2-dev:i386 zlib1g-dev:i386
- name: Dependencies (x64)
if: matrix.arch == 'x64'
run: |
sudo apt update
sudo apt install libsdl2-dev zlib1g-dev
- name: Cache cmake build
uses: actions/cache@v3
with:
path: build
key: linux-${{ matrix.arch }}-cmake-v1
- name: Configure (x86)
if: matrix.arch == 'x86'
run: |
cmake \
-B build \
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D CMAKE_TOOLCHAIN_FILE=cmake/toolchain/Linux32.cmake \
# EOL
- name: Configure (x64)
if: matrix.arch == 'x64'
run: |
cmake \
-B build \
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
# EOL
- name: Build
run: |
cmake \
--build build \
-j $(nproc) \
# EOL
- name: Upload
uses: actions/upload-artifact@v3
with:
name: fallout2-ce-linux-${{ matrix.arch }}
path: build/fallout2-ce
retention-days: 7
macos:
name: macOS
runs-on: macos-11
steps:
- name: Clone
uses: actions/checkout@v3
- name: Cache cmake build
uses: actions/cache@v3
with:
path: build
key: macos-cmake-v3
- name: Configure
run: |
cmake \
-B build \
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
# EOL
- name: Build
run: |
cmake \
--build build \
-j $(sysctl -n hw.physicalcpu) \
--target package \
# EOL
- name: Upload
uses: actions/upload-artifact@v3
with:
name: fallout2-ce-macos.dmg
path: build/fallout2-ce.dmg
retention-days: 7
windows:
name: Windows (${{ matrix.arch }})
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
include:
- arch: x86
generator-platform: Win32
- arch: x64
generator-platform: x64
steps:
- name: Clone
uses: actions/checkout@v3
- name: Cache cmake build
uses: actions/cache@v3
with:
path: build
key: windows-${{ matrix.arch }}-cmake-v1
- name: Configure
run: |
cmake \
-B build \
-G "Visual Studio 16 2019" \
-A ${{ matrix.generator-platform }} \
# EOL
- name: Build
run: |
cmake \
--build build \
--config RelWithDebInfo \
# EOL
- name: Upload
uses: actions/upload-artifact@v3
with:
name: fallout2-ce-windows-${{ matrix.arch }}
path: build/RelWithDebInfo/fallout2-ce.exe
retention-days: 7