added example input and output data (#121) #264
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: Docker Compose Test API | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
docker-compose-test: | |
runs-on: ubuntu-latest | |
environment: | |
name: test | |
env: | |
MONGO_INITDB_ROOT_PASSWORD: ${{ secrets.MONGO_INITDB_ROOT_PASSWORD }} | |
MONGO_INITDB_ROOT_USERNAME: ${{ vars.MONGO_INITDB_ROOT_USERNAME }} | |
MONGO_CONNSTRING: mongodb://${{ vars.MONGO_INITDB_ROOT_USERNAME }}:${{ secrets.MONGO_INITDB_ROOT_PASSWORD }}@biaint-mongo:27017 | |
DB_NAME: ${{ vars.DB_NAME }} | |
JWT_SECRET_KEY: ${{ secrets.JWT_SECRET_KEY }} | |
USER_CREATE_SECRET_TOKEN: ${{ secrets.USER_CREATE_SECRET_TOKEN }} | |
defaults: | |
run: | |
working-directory: ./api | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 # Checkout your repository to the GitHub Actions runner | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 # Set up Docker Buildx for building and pushing Docker images | |
- name: Cache Docker layers | |
uses: actions/cache@v2 # Cache Docker layers to speed up subsequent builds | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Docker Compose Up | |
run: | | |
docker compose up -d --build | |
- name: Run tests | |
run: | | |
docker compose exec -T bia-integrator-api poetry run pytest | |
# Always cleanup - even for cancelled jobs | |
- name: Docker Compose Down | |
run: | | |
docker compose down | |
if: ${{ always() }} |