2020-05-05 17:01:29 +00:00
|
|
|
name: C/C++ CI
|
|
|
|
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: ${{ matrix.config.name }}
|
|
|
|
runs-on: ${{ matrix.config.os }}
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
config:
|
2021-01-04 21:10:23 +00:00
|
|
|
# - {name: i686-pc-windows-msvc, os: windows-latest, cmakeArgs: -G "Visual Studio 16 2019" -A Win32}
|
2020-05-08 11:59:13 +00:00
|
|
|
- {name: x86_64-apple-darwin, os: macos-latest, cmakeArgs: -G "Xcode"}
|
|
|
|
- {name: x86_64-pc-linux-gnu, os: ubuntu-latest}
|
2021-01-05 10:16:25 +00:00
|
|
|
- {name: x86_64-pc-windows-msvc, os: windows-latest, cmakeArgs: -DCMAKE_SYSTEM_VERSION="10.0.18362.0" -G "Visual Studio 16 2019" -A x64}
|
2020-05-05 17:01:29 +00:00
|
|
|
- {name: x86_64-w64-mingw32, os: windows-latest, cmakeArgs: -G "MinGW Makefiles"}
|
|
|
|
|
|
|
|
steps:
|
2020-05-08 11:59:13 +00:00
|
|
|
- name: Set up build environment (macos-latest)
|
|
|
|
run: |
|
|
|
|
brew install ccache flac libao libomp pulseaudio sdl2 zlib
|
2020-11-19 10:56:10 +00:00
|
|
|
echo "/usr/local/opt/ccache/libexec" >> $GITHUB_PATH
|
|
|
|
echo "CCACHE_DIR=/tmp/ccache" >> $GITHUB_ENV
|
2020-05-08 11:59:13 +00:00
|
|
|
if: matrix.config.os == 'macos-latest'
|
|
|
|
|
|
|
|
- name: Set up build environment (ubuntu-latest)
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
2020-12-28 10:31:26 +00:00
|
|
|
sudo apt-get -y install ccache libao-dev libasound2-dev libevdev-dev libflac-dev libgl1-mesa-dev libpulse-dev libsdl2-dev libudev-dev libzip-dev libminiupnpc-dev
|
2020-11-19 10:56:10 +00:00
|
|
|
echo "CCACHE_DIR=/tmp/ccache" >> $GITHUB_ENV
|
2020-05-08 11:59:13 +00:00
|
|
|
if: matrix.config.os == 'ubuntu-latest'
|
|
|
|
|
|
|
|
- uses: actions/cache@v1
|
|
|
|
with:
|
|
|
|
path: /tmp/ccache
|
|
|
|
key: ccache-${{ matrix.config.os }}-${{ github.sha }}
|
|
|
|
restore-keys: ccache-${{ matrix.config.os }}-
|
|
|
|
if: matrix.config.os != 'windows-latest'
|
2020-05-05 17:01:29 +00:00
|
|
|
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- run: git fetch origin +refs/tags/*:refs/tags/*
|
|
|
|
|
|
|
|
- name: Create artifact directory
|
|
|
|
run: mkdir -p build/artifact
|
|
|
|
|
|
|
|
- name: CMake
|
|
|
|
run: |
|
|
|
|
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=artifact ${{ matrix.config.cmakeArgs }}
|
|
|
|
cmake --build build --config Release --parallel 2
|
|
|
|
|
2020-05-08 11:59:13 +00:00
|
|
|
- name: Unit Tests
|
|
|
|
run: |
|
|
|
|
mkdir -p build/tests
|
|
|
|
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=tests -DENABLE_CTEST=ON ${{ matrix.config.cmakeArgs }}
|
|
|
|
cmake --build build --config Release --parallel 2
|
|
|
|
./build/tests/flycast
|
|
|
|
if: matrix.config.name == 'x86_64-pc-linux-gnu'
|
|
|
|
|
2020-05-05 17:01:29 +00:00
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: flycast-${{ matrix.config.name }}
|
|
|
|
path: build/artifact
|