Implement github CI for the project
This commit is contained in:
76
.github/workflows/ci.yml
vendored
Normal file
76
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build ${{ matrix.os }} - ${{ matrix.build_type }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
build_type: [Debug, Release]
|
||||
|
||||
steps:
|
||||
- name: Checkout source
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
build/_deps
|
||||
~/.cache
|
||||
~/AppData/Local/vcpkg/archives
|
||||
key: ${{ runner.os }}-cmake-${{ matrix.build_type }}-${{ hashFiles('**/CMakeLists.txt') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-cmake-${{ matrix.build_type }}
|
||||
|
||||
- name: Install dependencies (Linux)
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y cmake build-essential libsdl2-dev
|
||||
|
||||
- name: Install dependencies (macOS)
|
||||
if: matrix.os == 'macos-latest'
|
||||
run: |
|
||||
brew install cmake sdl2
|
||||
|
||||
- name: Install dependencies (Windows)
|
||||
if: matrix.os == 'windows-latest'
|
||||
run: |
|
||||
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' --yes
|
||||
vcpkg install sdl2
|
||||
shell: bash
|
||||
|
||||
- name: Configure CMake
|
||||
run: |
|
||||
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
|
||||
env:
|
||||
CMAKE_TOOLCHAIN_FILE: ${{ matrix.os == 'windows-latest' && 'C:/vcpkg/scripts/buildsystems/vcpkg.cmake' || '' }}
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build --config ${{ matrix.build_type }}
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
cd build
|
||||
cpack
|
||||
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: breadedSNES-${{ matrix.os }}-${{ matrix.build_type }}
|
||||
path: |
|
||||
build/*.zip
|
||||
build/*.dmg
|
||||
build/*.tar.gz
|
||||
build/*.tgz
|
||||
build/*.exe
|
||||
build/*.7z
|
||||
Reference in New Issue
Block a user