shithub: rgbds

ref: 2eca43cd2da5a4be21cada359bd5e152f1896453
dir: /.github/workflows/testing.yml/

View raw version
name: "Regression testing"
on:
  - push
  - pull_request

jobs:
  unix-testing:
    strategy:
      matrix:
        os: [ubuntu-20.04, ubuntu-18.04, ubuntu-16.04, macos-10.15]
        cc: [gcc, clang]
        buildsys: [make, cmake]
        include:
          - os: ubuntu-18.04
            cc: gcc
            target: develop
            cmakevars: -DDEVELOP=ON
          - os: ubuntu-20.04
            cc: gcc
            target: develop
            cmakevars: -DDEVELOP=ON
      fail-fast: false
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v2
      - name: Install deps
        shell: bash
        run: |
          ./.github/actions/install_deps.sh ${{ matrix.os }}
      - name: Build & install using Make
        run: |
          make ${{ matrix.target }} -j Q= CC=${{ matrix.cc }}
          sudo make install -j Q=
        if: matrix.buildsys == 'make'
      - name: Build & install using CMake
        run: |
          cmake -S . -B build -DCMAKE_VERBOSE_MAKEFILE=ON ${{ matrix.cmakevars }}
          cmake --build build
          cp build/src/rgb{asm,link,fix,gfx} .
          sudo cmake --install build
        if: matrix.buildsys == 'cmake'
      - name: Package binaries
        run: |
          mkdir bins
          cp rgb{asm,link,fix,gfx} bins
      - name: Upload binaries
        uses: actions/upload-artifact@v1
        with:
          name: rgbds-canary-${{ matrix.os }}-${{ matrix.cc }}-${{ matrix.buildsys }}
          path: bins
      - name: Test
        shell: bash
        run: |
          test/run-tests.sh

  windows-build:
    strategy:
      matrix:
        bits: [32, 64]
        os: [ubuntu-latest]
        include:
          - bits: 32
            arch: i686
            triplet: i686-w64-mingw32
          - bits: 64
            arch: x86-64
            triplet: x86_64-w64-mingw32
    runs-on: ${{ matrix.os }}
    env:
      DIST_DIR: win${{ matrix.bits }}
    steps:
      - uses: actions/checkout@v2
      - name: Install deps
        shell: bash
        run: |
          ./.github/actions/install_deps.sh ${{ matrix.os }}
      - name: Install MinGW
        run: |
          sudo apt-get install gcc-mingw-w64-${{ matrix.arch }} mingw-w64-tools libz-mingw-w64-dev
      - name: Install libpng dev headers for MinGW
        run: |
          sudo ./.github/actions/mingw-w64-libpng-dev.sh ${{ matrix.triplet }}
      - name: Build Windows binaries
        run: |
          make mingw${{ matrix.bits }} -j Q=
      - name: Package binaries
        run: |
          mkdir bins
          mv rgbasm bins/rgbasm.exe
          mv rgblink bins/rgblink.exe
          mv rgbfix bins/rgbfix.exe
          mv rgbgfx bins/rgbgfx.exe
          cp /usr/${{ matrix.triplet }}/lib/zlib1.dll bins
          cp /usr/${{ matrix.triplet }}/bin/libpng16-16.dll bins
          if [ ${{ matrix.bits }} -eq 32 ]; then cp /usr/lib/gcc/${{ matrix.triplet }}/7.3-win32/libgcc_s_sjlj-1.dll bins; fi
      - name: Upload Windows binaries
        uses: actions/upload-artifact@v1
        with:
          name: rgbds-canary-win${{ matrix.bits }}
          path: bins

  windows-testing:
    needs: windows-build
    strategy:
      matrix:
        bits: [32, 64]
    runs-on: windows-2019
    steps:
      - uses: actions/checkout@v2
      - name: Retrieve binaries
        uses: actions/download-artifact@v1
        with:
          name: rgbds-canary-win${{ matrix.bits }}
          path: bins
      - name: Extract binaries
        shell: bash
        run: |
          cp bins/* .
      - name: Run tests
        shell: bash
        run: |
          test/run-tests.sh