Use latest major versions of dependencies #384
Workflow file for this run
This file contains 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: Tests | |
on: | |
pull_request: | |
push: | |
branches: ["main"] | |
jobs: | |
generate-matrix: | |
name: "Generate matrix from cabal" | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Extract the tested GHC versions | |
id: set-matrix | |
uses: kleidukos/get-tested@0.1.6.0 | |
with: | |
cabal-file: get-tested.cabal | |
ubuntu: true | |
version: 0.1.6.0 | |
tests: | |
name: ${{ matrix.ghc }} on ${{ matrix.os }} | |
needs: generate-matrix | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }} | |
# Service containers to run with `container-job` | |
services: | |
# Label used to access the service container | |
postgres: | |
# Docker Hub image | |
image: postgres | |
# Provide the password for postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v4 | |
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/main' | |
- name: "Configure ghcup" | |
run: | | |
ghcup config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml; | |
- name: Set up Haskell | |
id: setup-haskell | |
uses: haskell-actions/setup@v2 | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
cabal-version: ${{ matrix.cabal }} | |
- name: Configure environment | |
run: | | |
sudo apt update -y | |
sudo apt install -y postgresql libpq-dev | |
wget https://github.com/rust-lang/mdBook/releases/download/v0.4.30/mdbook-v0.4.30-x86_64-unknown-linux-gnu.tar.gz | |
tar -xzvf *.tar.gz | |
mkdir "$HOME/.local/bin" | |
mv mdbook $HOME/.local/bin/mdbook | |
echo "/usr/lib/postgresql/14/bin/" >> $GITHUB_PATH | |
echo "$HOME/.ghcup/bin" >> $GITHUB_PATH | |
echo "$HOME/.cabal/bin" >> $GITHUB_PATH | |
source ./environment.sh | |
touch ~/.pgpass | |
chmod 0600 ~/.pgpass | |
echo "${FLORA_DB_HOST}:${FLORA_DB_PORT}:${FLORA_DB_DATABASE}:${FLORA_DB_USER}:${FLORA_DB_PASSWORD}" > .pgpass | |
cabal freeze | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.setup-haskell.outputs.cabal-store }} | |
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-cabal-${{ hashFiles('**/plan.json') }} | |
restore-keys: ${{ runner.os }}-ghc-${{ matrix.ghc }}- | |
- name: Build | |
run: | | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
make build | |
cabal install postgresql-migration | |
- name: Test | |
run: | | |
source environment.sh | |
make test | |
env: | |
PGPASSWORD: "postgres" |