test now that other error fixed #31
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: CI with Docker Compose | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: | |
name: Dev | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: "3.12" | |
- name: Install Docker Compose | |
run: | | |
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
sudo chmod +x /usr/local/bin/docker-compose | |
- name: Build | |
run: | | |
docker image prune -a -f | |
ls -lah | |
ls -lah ./backend/src/ | |
ls -lah ./backend/src/init_db/ # Confirm init_db.sql is present | |
docker-compose -f docker-compose-dev-ga.yaml down | |
docker-compose -f docker-compose-dev-ga.yaml up --build -d | |
env: | |
JWT_SECRET_KEY: ${{ secrets.JWT_SECRET_KEY }} | |
FLASK_SECRET_KEY: ${{ secrets.FLASK_SECRET_KEY }} | |
DATABASE_USER: ${{ secrets.DATABASE_USER }} | |
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }} | |
DATABASE_DB: ${{ secrets.DATABASE_DB }} | |
DATABASE_HOST: ${{ secrets.DATABASE_HOST }} | |
TEST_DATABASE_DB: ${{ secrets.TEST_DATABASE_DB }} | |
ENVIRONMENT: ${{ env.ENVIRONMENT }} | |
- name: Run Tests | |
run: | | |
docker-compose -f docker-compose-dev-ga.yaml exec -T commonplace-public_backend_1 pip3 install pytest | |
docker-compose -f docker-compose-dev-ga.yaml exec -T commonplace-public_backend_1 pytest | |
- name: Fetch container logs | |
if: always() | |
run: | | |
docker ps -a | |
docker image ls | |
df -h | |
docker logs commonplace-public_db_1 | |
docker logs commonplace-public_backend_1 | |
- name: Cleanup | |
if: always() | |
run: docker-compose -f docker-compose-dev-ga.yaml down |