-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (40 loc) · 1.48 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Continuous Integration
on: [push]
env:
WEB_TEST_IMAGE: ghcr.io/$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]')/web-test
jobs:
build:
name: FastAPI Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: main
- name: Add environment variables to .env
run: |
echo "DATABASE_URL=postgresql+asyncpg://postgres:postgres@db:5432/starter_db_dev" >> .env
echo "ENV_FOR_DYNACONF=ci" >> .env
echo "POSTGRES_USER=postgres" >> .env
echo "POSTGRES_PASSWORD=postgres" >> .env
echo "POSTGRES_DB=starter_db_dev" >> .env
- name: Set environment variables
run: |
echo "WEB_TEST_IMAGE=$(echo ${{env.WEB_TEST_IMAGE}} )" >> $GITHUB_ENV
- name: Log in to GitHub Packages
run: echo ${PERSONAL_ACCESS_TOKEN} | docker login ghcr.io -u jonwhittlestone --password-stdin
env:
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Pull images
run: |
docker pull ${{ env.WEB_TEST_IMAGE }} || true
- name: Build images
run: |
docker-compose -f docker-compose.ci.yml up -d --build
- name: Run pytest in container
run: |
docker-compose -f docker-compose.ci.yml run web-test pytest tests -x -o log_cli=true
# - name: Push images
# run: |
# docker push ${{ env.WEB_IMAGE }}
# docker push ${{ env.NGINX_IMAGE }}