Add a build/test CI based on setup-haskell and get-tested #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Run Tests (on push and pull request) | |
| on: | |
| pull_request: | |
| branches: ['master'] | |
| push: | |
| branches: ['master'] | |
| jobs: | |
| generate-matrix: | |
| name: "Generate matrix from cabal file" | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Extract the tested GHC versions | |
| id: set-matrix | |
| uses: kleidukos/[email protected] | |
| with: | |
| cabal-file: opus.cabal | |
| ubuntu-version: "latest" | |
| macos-version: "latest" | |
| windows-version: "latest" | |
| version: 0.1.7.1 | |
| tests: | |
| name: ${{ matrix.ghc }} on ${{ matrix.os }} | |
| needs: generate-matrix | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }} | |
| steps: | |
| - name: Checkout the repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Haskell | |
| id: setup-haskell | |
| uses: haskell-actions/setup@v2 | |
| with: | |
| ghc-version: ${{ matrix.ghc }} | |
| cabal-version: "latest" | |
| - name: Install libopus (Linux only) | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get install libopus-dev | |
| - name: Install libopus (macOS only) | |
| if: runner.os == 'macOS' | |
| run: brew install opus | |
| - name: Install libopus (Windows only) | |
| if: runner.os == 'Windows' | |
| run: | | |
| set "PATH=C:\msys64\usr\bin;%PATH%" | |
| pacman --noconfirm -S mingw64/mingw-w64-x86_64-opus mingw64/mingw-w64-x86_64-pkg-config | |
| set "GITHUB_PATH=C:\msys64\mingw64\bin;%GITHUB_PATH%" | |
| - name: Build the project | |
| run: cabal build | |
| - name: Run the tests | |
| run: cabal test |