Skip to content

Commit

Permalink
Merge pull request #13 from open-formulieren/feature/refactor-ci
Browse files Browse the repository at this point in the history
Refactor CI to not use the OF test docker images
  • Loading branch information
sergei-maertens authored Aug 29, 2023
2 parents 0858492 + 146625a commit 605d8f1
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 101 deletions.
65 changes: 58 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,71 @@ jobs:
tests:
name: Run the Django test suite
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
env:
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
# Needed because the postgres container does not provide a healthcheck
options:
--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
--name postgres
redis:
image: redis:6
ports:
- 6379:6379

steps:
- uses: actions/checkout@v3
- name: Checkout Open Forms
uses: actions/checkout@v3
with:
repository: open-formulieren/open-forms
path: open-forms

- name: Build test docker image
- name: Checkout Token Exchange extension
uses: actions/checkout@v3
with:
path: extension

- name: Set up backend environment
uses: maykinmedia/[email protected]
with:
apt-packages: 'libxml2-dev libxmlsec1-dev libxmlsec1-openssl gettext postgresql-client gdal-bin'
python-version: '3.10'
optimize-postgres: 'yes'
pg-service: 'postgres'
setup-node: 'yes'
nvmrc-custom-dir: 'open-forms'
npm-ci-flags: '--legacy-peer-deps'
working-directory: ${{ github.workspace }}/open-forms

- name: Make symlink in OF to the extension
run: |
docker build . \
--tag $IMAGE_NAME:test \
--file ./ci/Dockerfile
ln -s ${{ github.workspace }}/extension/token_exchange ${{ github.workspace }}/open-forms/src
- name: Run tests
run: |
docker-compose -f docker-compose.ci.yml up -d
working-directory: ci
export OPEN_FORMS_EXTENSIONS=token_exchange
python src/manage.py compilemessages
coverage run --source=token_exchange src/manage.py test token_exchange
coverage combine
coverage xml -o coverage-extension.xml
env:
DJANGO_SETTINGS_MODULE: openforms.conf.ci
SECRET_KEY: dummy
DB_USER: postgres
DB_PASSWORD: ''
working-directory: ${{ github.workspace }}/open-forms

- name: Publish coverage report
uses: codecov/[email protected]
with:
root_dir: ${{ github.workspace }}/extension
working-directory: ${{ github.workspace }}/open-forms
files: ./coverage-extension.xml

docker_build:
name: Build Docker image
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ venv.bak/

# mypy
.mypy_cache/

# Editor
.idea/
17 changes: 0 additions & 17 deletions bin/docker_test.sh

This file was deleted.

24 changes: 0 additions & 24 deletions ci/Dockerfile

This file was deleted.

49 changes: 0 additions & 49 deletions ci/docker-compose.ci.yml

This file was deleted.

4 changes: 0 additions & 4 deletions ci/docker-init-db.sql

This file was deleted.

0 comments on commit 605d8f1

Please sign in to comment.