[FLORA-443] support non hackage repo urls #1204
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: Backend tests | |
on: | |
pull_request: | |
push: | |
branches: ["main", "development"] | |
concurrency: | |
group: backend-${{ github.ref_name }} | |
cancel-in-progress: true | |
jobs: | |
generateMatrix: | |
name: "Generate matrix from cabal" | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout base repo | |
uses: actions/checkout@v4 | |
- name: Extract the tested GHC versions | |
id: set-matrix | |
run: | | |
wget https://github.com/Kleidukos/get-tested/releases/download/v0.1.4.0/get-tested-0.1.4.0-linux-amd64 -O get-tested | |
chmod +x get-tested | |
./get-tested --ubuntu *.cabal >> $GITHUB_OUTPUT | |
Backend_tests: | |
needs: generateMatrix | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: ${{ fromJSON(needs.generateMatrix.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 | |
- name: Set up Haskell | |
id: setup-haskell | |
uses: haskell-actions/setup@v2 | |
with: | |
ghc-version: "${{ matrix.ghc }}" | |
cabal-version: "latest" | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: "18" | |
cache: "yarn" | |
cache-dependency-path: assets/yarn.lock | |
- name: Configure environment | |
run: | | |
./.github/workflows/setup.sh | |
echo "/usr/lib/postgresql/14/bin/" >> $GITHUB_PATH | |
echo "$HOME/.ghcup/bin" >> $GITHUB_PATH | |
echo "$HOME/.cabal/bin" >> $GITHUB_PATH | |
echo "$HOME/.local/bin" >> $GITHUB_PATH | |
echo "$HOME/node_modules/.bin" >> $GITHUB_PATH | |
source ./environment.ci.sh | |
touch ~/.pgpass | |
chmod 0600 ~/.pgpass | |
echo "${FLORA_DB_HOST}:${FLORA_DB_PORT}:${FLORA_DB_DATABASE}:${FLORA_DB_USER}:${FLORA_DB_PASSWORD}" > .pgpass | |
cat ~/.pgpass | |
cabal update | |
cabal freeze | |
- name: Cache | |
uses: actions/[email protected] | |
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: | | |
make soufflé | |
make assets-deps | |
make build-assets | |
make build | |
cabal install postgresql-migration | |
- name: Test | |
run: | | |
set -x | |
source ./environment.ci.sh | |
createdb -h "${FLORA_DB_HOST}" -p "${FLORA_DB_PORT}" -U "${FLORA_DB_USER}" -w "${FLORA_DB_DATABASE}" | |
migrate init "${FLORA_DB_CONNSTRING}" | |
migrate migrate "${FLORA_DB_CONNSTRING}" migrations | |
cabal run -- flora-cli create-user --username "hackage-user" --email "[email protected]" --password "foobar2000" | |
make test | |
env: | |
PGPASSWORD: "postgres" |