-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (54 loc) · 1.82 KB
/
ci.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: PlaceWork CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "*" ]
jobs:
tests:
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v3
- name: Setup python '3.10'
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Run Docker Compose
run: docker-compose up -d
- name: Copy .env.example to .env
run: docker-compose exec -T -u root app cp .env.example .env
- name: Install dependencies
run: docker-compose exec -T -u root app poetry install --no-interaction --no-ansi
- name: Run tests
run: |
docker-compose exec -T -u root app bash -c "source .venv/bin/activate && python manage.py test"
- name: Run coverage
run: |
docker-compose exec -T -u root app bash -c "pytest -s -x --ignore .venv --cov placework -vv && coverage xml && coverage html"
# - name: SonarCloud Scan
# uses: SonarSource/sonarcloud-github-action@master
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Teardown Docker Compose
if: always()
run: docker-compose down
dockerHub:
needs: tests
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v3
- name: Setup Docker Build
uses: docker/[email protected]
- name: Docker Login
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker images
uses: docker/[email protected]
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/placework:latest