Documentation and changlog for release 2.3.0 #599
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 backend and frontend tests inside docker image | |
on: | |
push: | |
branches: | |
- master | |
- dev | |
pull_request: | |
branches: | |
- master | |
- dev | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Buildx cache | |
uses: actions/cache@v3 | |
with: | |
path: buildx-cache | |
key: ${{ runner.os }}-buildx-${{ hashFiles('buildx-cache/**') }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Run the backend and frontend tests in containers | |
run: | | |
export MAIN_IMAGE=teamware-main | |
export STATIC_IMAGE=teamware-static | |
export DJANGO_SETTINGS_MODULE=teamware.settings.docker-test | |
./generate-docker-env.sh | |
# Remove container registry address | |
sed -i 's/ghcr.io\/gatenlp\///g' .env | |
# Display the environment variable file for the logs | |
cat .env | |
# Build the test image with npm and pytest installed | |
docker buildx build --cache-from type=local,src=buildx-cache --cache-to type=local,dest=buildx-cache-out,mode=max --load -t teamware-main:latest --target test . | |
# Clear up the cache | |
rm -rf buildx-cache && mv buildx-cache-out buildx-cache | |
# Export the environment variables | |
source .env | |
# Launch the database container | |
docker compose up -d db | |
# Hacky method of waiting for postgres to be up and running | |
sleep 10 | |
# Allow Django to create databases for the testing | |
docker compose exec -T db psql -v ON_ERROR_STOP=1 --username postgres -c 'ALTER USER '"$DB_USERNAME"' CREATEDB;' | |
# Run the backend tests | |
docker compose run --rm --entrypoint npm backend run test:pytest | |
# Run the frontend tests | |
docker compose run --rm --entrypoint npm backend run test:frontend |