name: build

on:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]

jobs:
  build:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest]
        preset: [MinSizeRel]
    runs-on: ${{ matrix.os }}
    container: devkitpro/devkita64:latest

    steps:
    - uses: actions/checkout@v3

    # fetch latest cmake
    - uses: lukka/get-cmake@latest

    - name: Configure CMake
      run: |
        cmake --preset ${{ matrix.preset }} -DUSE_VFS_GC=0

    - name: Build
      run: cmake --build --preset ${{ matrix.preset }} --parallel 4

    - uses: actions/upload-artifact@master
      with:
        name: sphaira-${{ matrix.preset }}
        path: build/${{ matrix.preset }}/sphaira.nro
