ci: Use PostgreSQL 16 and fix database issues in local/sandboxes #427
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: Run tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- '*' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Docker build app-test | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: docker/Dockerfile | |
target: app-test | |
push: false | |
tags: app-test:latest | |
- name: Start database | |
run: docker run --name=database -e POSTGRES_DB=app -e POSTGRES_PASSWORD=password -d postgres:14.6 | |
- name: Start memcached | |
run: docker run --name=memcached -d memcached:latest | |
- name: Run tests | |
run: | | |
set -x | |
docker run -i --rm --name=app-test -u root --link=database --link=memcached -e DATABASE_URL="postgres://postgres:password@database/app" -e APP_SECRET_KEY=xxxx -e ENVIRONMENT=test -v $(pwd)/coverage:/coverage app-test | |
cp coverage/.coverage coverage/coverage.xml ./ | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4-beta | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |