Skip to content

Commit

Permalink
Merge pull request #6 from teksi/test-workflows
Browse files Browse the repository at this point in the history
Add datamodel test
  • Loading branch information
sjib authored May 6, 2024
2 parents 6f5dde0 + f3017f2 commit 5c504a7
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/datamodel-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: 🐘 Datamodel | Tests

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

on:
push:
branches:
- main
paths:
- datamodel/**
- '.github/workflows/datamodel-test.yml'
pull_request:
branches:
- main
paths:
- datamodel/**
- '.github/workflows/datamodel-test.yml'
workflow_dispatch:


jobs:
datamodel-tests:
name: Run unit tests on datamodel
runs-on: ubuntu-latest

strategy:
matrix:
psycopg-version: [ 2, 3 ]
fail-fast: true

steps:
- uses: actions/checkout@v4

- name: Docker build
run: |
docker build \
--build-arg RUN_TEST=True \
--build-arg PSYCOPG_VERSION=${{ matrix.psycopg-version }} \
-f datamodel/.docker/Dockerfile \
--tag teksi/distance_heating:unstable .
- name: Initialize container
run: |
docker run -d -p 5432:5432 --name teksi-distance_heating teksi/distance_heating:unstable
docker exec teksi-distance_heating init_db.sh wait
- name: Run tests
run: docker exec teksi-distance_heating pytest datamodel

- name: Docker logs
if: failure()
run: docker logs teksi-distance_heating

static-tests:
name: Run static tests on datamodel
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- run: ./datamodel/test/static_tests.sh

0 comments on commit 5c504a7

Please sign in to comment.