Update discord-haskell upper bound to include 1.18.0 #127
Workflow file for this run
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
| # Heavy references from agda/agda's workflows, thank you! | |
| name: Build (Cabal) | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: {} | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| build: | |
| name: Build (cabal) - ${{ matrix.os }} - ${{ matrix.ghc }} | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: | |
| 60 | |
| continue-on-error: false | |
| strategy: | |
| matrix: | |
| os: ["ubuntu-24.04"] | |
| # Range all supported versions on most common ubuntu OS | |
| ghc: ["8.10.7", "9.0.2", "9.2.8", "9.6.7", "9.8.4"] | |
| include: | |
| - os: ubuntu-22.04 # one previous ubuntu version | |
| ghc: "9.8.4" | |
| - os: macOS-latest | |
| ghc: "8.10.7" # oldest supported version | |
| - os: macOS-latest | |
| ghc: "9.8.4" # LTS | |
| - os: windows-latest | |
| ghc: "8.10.7" # oldest supported version | |
| - os: windows-latest | |
| ghc: "9.8.4" # LTS | |
| fail-fast: false | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| # Default is 1 (only one commit) but in order to do git log on PRs and | |
| # get the PR head commit, we need more history -- so we set it to 0 | |
| # (unlimited). | |
| # | |
| # The PR head commit on a pull_request event is not the most recent | |
| # commit, since GitHub Actions performs a merge onto the base branch | |
| # and runs CI on the result. | |
| fetch-depth: 0 | |
| - name: Install LLVM 12 for 8.10.7 and 9.0.2 on macOS (override disabled) | |
| if: ${{ matrix.os == 'macOS-latest' && (matrix.ghc == '8.10.7' || matrix.ghc == '9.0.2') }} | |
| run: | | |
| # Download the llvm@12 formula and patch it to remove the disabled reason | |
| brew update | |
| brew fetch --formula llvm@12 | |
| FORMULA_PATH="$(brew --repo homebrew/core)/Formula/l/[email protected]" | |
| if [ ! -f "$FORMULA_PATH" ]; then | |
| FORMULA_PATH="$(brew --repo homebrew/core)/Formula/l/[email protected]" | |
| fi | |
| # Remove the 'disable!' line | |
| sed -i.bak '/^ disable!/d' "$FORMULA_PATH" | |
| # Install ignoring the disabled status | |
| HOMEBREW_NO_INSTALL_FROM_API=1 brew install llvm@12 | |
| echo "OPT=$(brew --prefix llvm@12)/bin/opt" >> "${GITHUB_ENV}" | |
| echo "LLC=$(brew --prefix llvm@12)/bin/llc" >> "${GITHUB_ENV}" | |
| - name: Workaround for a problem with GHC 9.0.2 on Arm Mac | |
| run: echo "C_INCLUDE_PATH=`xcrun --show-sdk-path`/usr/include/ffi" >> "${GITHUB_ENV}" | |
| if: ${{ matrix.os == 'macOS-latest' && matrix.ghc == '9.0.2' }} | |
| - uses: haskell-actions/setup@v2 | |
| id: setup-haskell | |
| with: | |
| ghc-version: ${{ matrix.ghc }} | |
| - name: Set Haskell PATH and environment variables | |
| run: | | |
| echo "GHC=${{ steps.setup-haskell.outputs.ghc-exe }}" >> $GITHUB_ENV | |
| echo "GHC_VER=$(ghc --numeric-version)" >> $GITHUB_ENV | |
| echo "CABAL=${{ steps.setup-haskell.outputs.cabal-exe }}" >> $GITHUB_ENV | |
| echo "CABAL_VER=$(cabal --numeric-version)" >> $GITHUB_ENV | |
| - name: Print GHC/Cabal versions and env | |
| run: | | |
| ${GHC} --version || true | |
| ${CABAL} --version || true | |
| env | |
| - name: Install libsodium and Opus (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| pacman -S --noconfirm mingw-w64-x86_64-pkg-config mingw-w64-x86_64-opus mingw-w64-x86_64-libsodium | |
| shell: C:\shells\msys2bash.cmd {0} | |
| - name: Add to cabal.project (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| echo "PATH=C:\msys64\mingw64\bin;C:\msys64\usr\bin;$env:Path" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
| echo "PKG_CONFIG_PATH=C:\msys64\mingw64\lib\pkgconfig" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
| # https://github.com/haskell/cabal/issues/2997 | |
| echo @" | |
| package saltine | |
| extra-include-dirs: c:/msys64/mingw64/include | |
| extra-lib-dirs: c:/msys64/mingw64/lib | |
| package opus | |
| extra-include-dirs: c:/msys64/mingw64/include | |
| extra-lib-dirs: c:/msys64/mingw64/lib | |
| "@ >> cabal.project | |
| cat cabal.project | |
| shell: pwsh | |
| - name: Install libsodium (Linux) | |
| if: startsWith(matrix.os, 'ubuntu') | |
| run: | | |
| sudo apt-get install -y libsodium-dev libopus-dev | |
| - name: Install libsodium (macOS) | |
| if: matrix.os == 'macOS-latest' | |
| run: | | |
| brew install libsodium opus | |
| # Temporary until runner image is updated: actions/runner-images#6364 | |
| # or until cabal is updated: haskell/cabal#8496 | |
| # whichever is earlier | |
| brew update && brew reinstall highway | |
| # Renovate is configured in renovate.json to tell the CI about the specific | |
| # version bump using a Git message trailer. So we parse from this and | |
| # make it so CI for Renovate is forced to use that constraints -- otherwise | |
| # cabal might solve using older package versions. | |
| # See https://github.com/haskell-actions/setup/commit/e09ab5080aed999b46591720b1be129e00e0eef5 | |
| - name: (Only for Renovate PRs) Apply bumped dependency version constraint | |
| if: ${{ github.event_name == 'pull_request' }} | |
| run: | | |
| if [ ! -f cabal.project ] | |
| then echo "packages: ." > cabal.project | |
| fi | |
| for constraint in $(git log "--format=%(trailers:key=New-Versions,valueonly=true)" ${{ github.event.pull_request.head.sha }} -1) | |
| do echo "constraints: $constraint" >> cabal.project | |
| done | |
| - name: Update cabal database and set up build plan | |
| run: | | |
| cabal update | |
| cabal configure | |
| cabal build --dry-run -v | |
| - name: Cache Cabal Dependencies | |
| id: cache | |
| uses: actions/cache@v4 | |
| with: | |
| key: cabal-${{ matrix.os }}-${{ env.GHC_VER }}-${{ env.CABAL_VER }}-${{ hashFiles('**/plan.json') }} | |
| path: | | |
| ${{ steps.setup-haskell.outputs.cabal-store }} | |
| dist-newstyle | |
| restore-keys: | | |
| cabal-${{ matrix.os }}-${{ env.GHC_VER }}-${{ env.CABAL_VER }}- | |
| cabal-${{ matrix.os }}-${{ env.GHC_VER }}- | |
| - name: Install dependencies | |
| if: ${{ !steps.cache.outputs.cache-hit }} | |
| run: | | |
| ${CABAL} build --disable-tests --disable-benchmarks --dependencies-only -j2 all | |
| ${CABAL} build --enable-tests --dependencies-only -j2 all | |
| - name: Cabal check | |
| run: | | |
| ${CABAL} -vnormal check | |
| - name: Build discord-haskell-voice | |
| run: | | |
| ${CABAL} build | |
| # The following job always runs and checks the status of the previous jobs. | |
| # This is used for status checks for PRs since it abstracts away the actual | |
| # individual jobs generated by the matrices. | |
| status-post-job: | |
| if: always() | |
| name: Validate post job | |
| runs-on: ubuntu-latest | |
| # IMPORTANT! Any job added to the workflow should be added here too | |
| needs: [build] | |
| steps: | |
| - run: | | |
| echo "jobs info: ${{ toJSON(needs) }}" | |
| - if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') | |
| run: exit 1 |