Ensure unit tests are run within a docker context as part of CI builds

This commit is contained in:
Oliver Walters 2022-05-15 23:37:01 +10:00
parent 55f87033b2
commit 47269a88d2

View File

@ -3,9 +3,8 @@
# This CI action runs on pushes to either the master or stable branches # This CI action runs on pushes to either the master or stable branches
# 1. Build the development docker image (as per the documentation) # 1. Build the development docker image (as per the documentation)
# 2. Install requied python libs into the docker container # 2. Launch the development server, and update the installation
# 3. Launch the container # 3. Run unit tests within the docker context
# 4. Check that the API endpoint is available
name: Docker Test name: Docker Test
@ -15,6 +14,10 @@ on:
- 'master' - 'master'
- 'stable' - 'stable'
pull_request:
branches-ignore:
- l10*
jobs: jobs:
docker: docker:
@ -26,12 +29,14 @@ jobs:
- name: Build Docker Image - name: Build Docker Image
run: | run: |
cd docker cd docker
docker-compose -f docker-compose.sqlite.yml build docker-compose build
docker-compose -f docker-compose.sqlite.yml run inventree-dev-server invoke update docker-compose run inventree-dev-server invoke update
docker-compose -f docker-compose.sqlite.yml up -d docker-compose up -d
- name: Sleepy Time - name: Wait for Server
run: sleep 60
- name: Test API
run: | run: |
pip install requests cd docker
python3 ci/check_api_endpoint.py docker-compose run inventree-dev-server invoke wait
- name: Run unit tests
run: |
cd docker
docker-compose run inventree-dev-server invoke test