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-07-25 20:22:08 +00:00
|
|
|
- {name: i686-pc-windows-msvc, os: windows-latest, cmakeArgs: -DCMAKE_SYSTEM_VERSION="10.0.18362.0" -G "Visual Studio 16 2019" -A Win32, buildType: Release}
|
2021-08-10 15:04:36 +00:00
|
|
|
- {name: apple-darwin, os: macos-latest, cmakeArgs: -G "Xcode", destDir: osx, buildType: Release}
|
2021-08-20 17:57:20 +00:00
|
|
|
- {name: apple-ios, os: macos-latest, cmakeArgs: -DCMAKE_SYSTEM_NAME=iOS -G "Xcode", destDir: ios, buildType: Release}
|
2021-07-25 20:22:08 +00:00
|
|
|
- {name: x86_64-pc-linux-gnu, os: ubuntu-latest, buildType: Release}
|
|
|
|
- {name: x86_64-pc-windows-msvc, os: windows-latest, cmakeArgs: -DCMAKE_SYSTEM_VERSION="10.0.18362.0" -G "Visual Studio 16 2019" -A x64, buildType: Release}
|
|
|
|
- {name: x86_64-w64-mingw32, os: windows-latest, cmakeArgs: -G "MinGW Makefiles", destDir: win, buildType: RelWithDebInfo}
|
|
|
|
- {name: libretro-x86_64-pc-linux-gnu, os: ubuntu-latest, cmakeArgs: -DLIBRETRO=ON -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE, buildType: Release}
|
|
|
|
- {name: libretro-x86_64-w64-mingw32, os: windows-latest, cmakeArgs: -DLIBRETRO=ON -G "MinGW Makefiles", buildType: Release}
|
2020-05-05 17:01:29 +00:00
|
|
|
|
|
|
|
steps:
|
2020-05-08 11:59:13 +00:00
|
|
|
- name: Set up build environment (macos-latest)
|
|
|
|
run: |
|
2021-08-29 09:58:05 +00:00
|
|
|
brew install ccache libao libomp pulseaudio zlib ldid
|
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
|
2021-05-28 19:06:53 +00:00
|
|
|
sudo apt-get -y install ccache libao-dev libasound2-dev libevdev-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'
|
|
|
|
|
2021-04-13 09:20:11 +00:00
|
|
|
- name: Set up build environment (windows-latest)
|
2021-04-13 10:22:01 +00:00
|
|
|
run: echo "DXSDK_DIR=${Env:HOMEDRIVE}${Env:HOMEPATH}\ccache\" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
|
2021-07-06 14:19:12 +00:00
|
|
|
if: matrix.config.os == 'windows-latest' && matrix.config.name != 'x86_64-w64-mingw32' && matrix.config.name != 'libretro-x86_64-w64-mingw32'
|
2021-04-13 09:20:11 +00:00
|
|
|
|
2021-02-14 19:51:51 +00:00
|
|
|
- uses: actions/cache@v2
|
2020-05-08 11:59:13 +00:00
|
|
|
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
|
|
|
|
2021-04-13 09:20:11 +00:00
|
|
|
- uses: actions/cache@v2
|
|
|
|
id: cache
|
|
|
|
with:
|
|
|
|
path: $HOME/ccache
|
|
|
|
key: ccache-${{ matrix.config.os }}-${{ github.sha }}
|
|
|
|
restore-keys: ccache-${{ matrix.config.os }}-
|
|
|
|
if: matrix.config.os == 'windows-latest'
|
|
|
|
|
|
|
|
- name: Download DX2010
|
2021-09-10 10:19:29 +00:00
|
|
|
if: matrix.config.os == 'windows-latest' && matrix.config.name != 'x86_64-w64-mingw32' && matrix.config.name != 'libretro-x86_64-w64-mingw32'
|
2021-04-13 09:20:11 +00:00
|
|
|
run: |
|
|
|
|
curl -L https://download.microsoft.com/download/a/e/7/ae743f1f-632b-4809-87a9-aa1bb3458e31/DXSDK_Jun10.exe -o _DX2010_.exe
|
|
|
|
7z x _DX2010_.exe DXSDK/Include -o_DX2010_
|
|
|
|
7z x _DX2010_.exe DXSDK/Lib/x86 -o_DX2010_
|
|
|
|
7z x _DX2010_.exe DXSDK/Lib/x64 -o_DX2010_
|
|
|
|
mv _DX2010_/DXSDK $HOME/ccache
|
|
|
|
rm -fR _DX*_ _DX*_.exe
|
|
|
|
shell: bash
|
|
|
|
|
2021-07-25 19:55:29 +00:00
|
|
|
- name: Install MSYS2
|
|
|
|
uses: msys2/setup-msys2@v2
|
|
|
|
with:
|
|
|
|
msystem: MINGW64
|
2021-10-03 16:34:27 +00:00
|
|
|
install: git base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-breakpad-git mingw-w64-x86_64-lua
|
2021-07-25 19:55:29 +00:00
|
|
|
if: matrix.config.os == 'windows-latest'
|
|
|
|
|
2020-05-05 17:01:29 +00:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2021-09-20 17:51:53 +00:00
|
|
|
submodules: true
|
2020-05-05 17:01:29 +00:00
|
|
|
|
|
|
|
- name: Create artifact directory
|
|
|
|
run: mkdir -p build/artifact
|
|
|
|
|
2021-08-10 15:04:36 +00:00
|
|
|
- name: Build SDL (macos)
|
2021-05-19 09:29:38 +00:00
|
|
|
run: |
|
|
|
|
cd shell/apple
|
|
|
|
mkdir artifacts
|
|
|
|
brew install --build-from-source ./sdl2.rb
|
2021-08-10 15:04:36 +00:00
|
|
|
if: matrix.config.name == 'apple-darwin'
|
2021-05-19 09:29:38 +00:00
|
|
|
|
2020-05-05 17:01:29 +00:00
|
|
|
- name: CMake
|
|
|
|
run: |
|
2021-07-25 19:55:29 +00:00
|
|
|
cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.config.buildType }} -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=artifact -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=artifact ${{ matrix.config.cmakeArgs }}
|
2020-05-05 17:01:29 +00:00
|
|
|
cmake --build build --config Release --parallel 2
|
2021-07-25 20:22:08 +00:00
|
|
|
if: matrix.config.os != 'windows-latest'
|
|
|
|
|
|
|
|
- name: CMake (windows)
|
|
|
|
shell: msys2 {0}
|
|
|
|
run: |
|
2021-07-25 20:42:05 +00:00
|
|
|
unset temp tmp
|
2021-07-25 22:13:05 +00:00
|
|
|
cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.config.buildType }} -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=artifact -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO=artifact -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=artifact ${{ matrix.config.cmakeArgs }}
|
2021-07-25 20:22:08 +00:00
|
|
|
cmake --build build --config Release --parallel 2
|
|
|
|
if: matrix.config.os == 'windows-latest'
|
2020-05-05 17:01:29 +00:00
|
|
|
|
2020-05-08 11:59:13 +00:00
|
|
|
- name: Unit Tests
|
|
|
|
run: |
|
|
|
|
mkdir -p build/tests
|
2021-07-25 19:55:29 +00:00
|
|
|
cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.config.buildType }} -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=tests -DENABLE_CTEST=ON ${{ matrix.config.cmakeArgs }}
|
2020-05-08 11:59:13 +00:00
|
|
|
cmake --build build --config Release --parallel 2
|
|
|
|
./build/tests/flycast
|
|
|
|
if: matrix.config.name == 'x86_64-pc-linux-gnu'
|
|
|
|
|
2021-07-25 19:55:29 +00:00
|
|
|
- name: Dump symbols
|
2021-07-25 20:22:08 +00:00
|
|
|
shell: msys2 {0}
|
2021-07-25 19:55:29 +00:00
|
|
|
run: |
|
|
|
|
dump_syms build/artifact/flycast.exe > flycast.exe.sym 2>/dev/null
|
|
|
|
BUILD_ID=`head -1 flycast.exe.sym | awk '{ print $4 }'`
|
|
|
|
mkdir -p symbols/flycast.exe/$BUILD_ID
|
|
|
|
mv flycast.exe.sym symbols/flycast.exe/$BUILD_ID
|
|
|
|
strip build/artifact/flycast.exe
|
|
|
|
if: matrix.config.name == 'x86_64-w64-mingw32'
|
|
|
|
|
2020-05-05 17:01:29 +00:00
|
|
|
- uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: flycast-${{ matrix.config.name }}
|
|
|
|
path: build/artifact
|
2021-05-24 09:03:15 +00:00
|
|
|
|
|
|
|
- name: Package app (macos)
|
|
|
|
run: |
|
|
|
|
cd build/artifact
|
2021-05-25 09:51:59 +00:00
|
|
|
rm -rf Flycast.swiftmodule
|
|
|
|
zip -r flycast.app.zip Flycast.app
|
|
|
|
rm -rf Flycast.app
|
2021-08-10 15:04:36 +00:00
|
|
|
if: matrix.config.name == 'apple-darwin'
|
2021-05-24 09:03:15 +00:00
|
|
|
|
|
|
|
- name: Package app (windows)
|
|
|
|
run: |
|
|
|
|
powershell Compress-Archive build/artifact/flycast.exe build/artifact/flycast.zip
|
|
|
|
rm build/artifact/flycast.exe
|
|
|
|
if: matrix.config.name == 'x86_64-w64-mingw32'
|
|
|
|
|
|
|
|
- name: Configure AWS Credentials
|
2021-06-03 20:41:53 +00:00
|
|
|
id: aws-credentials
|
2021-05-24 09:03:15 +00:00
|
|
|
uses: aws-actions/configure-aws-credentials@v1
|
|
|
|
with:
|
|
|
|
aws-access-key-id: AKIAJOZQS4H2PHQWYFCA
|
|
|
|
aws-secret-access-key: ${{ secrets.S3_SECRET_KEY }}
|
|
|
|
aws-region: us-east-2
|
2021-06-03 20:41:53 +00:00
|
|
|
if: github.repository == 'flyinghead/flycast' && github.event_name == 'push' && matrix.config.destDir != ''
|
2021-05-24 09:03:15 +00:00
|
|
|
|
|
|
|
- name: Upload to S3
|
2021-09-20 17:51:53 +00:00
|
|
|
run: aws s3 sync build/artifact s3://flycast-builds/${{ matrix.config.destDir }}/${GITHUB_REF#refs/}-$GITHUB_SHA --acl public-read --follow-symlinks
|
2021-06-03 20:41:53 +00:00
|
|
|
if: ${{ steps.aws-credentials.outputs.aws-account-id != '' }}
|
2021-07-25 19:55:29 +00:00
|
|
|
|
|
|
|
- name: Upload symbols to S3
|
|
|
|
run: aws s3 sync symbols s3://flycast-symbols/${{ matrix.config.destDir }} --follow-symlinks
|
2021-07-25 20:27:17 +00:00
|
|
|
if: ${{ steps.aws-credentials.outputs.aws-account-id != '' && matrix.config.os == 'windows-latest' }}
|
2021-07-25 19:55:29 +00:00
|
|
|
|