Update python-cicd.yml #12
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 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
docker: | |
image: docker:stable-dind | |
options: --privileged | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install Docker Compose | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y docker-compose | |
- name: Start Docker containers | |
run: docker-compose up --detach | |
- name: Wait for services to be ready | |
run: | | |
while ! docker-compose exec -T postgresql pg_isready -q -h postgresql -p 5432 -U postgres; do | |
sleep 1 | |
done | |
- name: Run tests | |
run: docker-compose exec app pytest | |
- name: Stop Docker containers | |
run: docker-compose down |