-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (75 loc) · 2.46 KB
/
build.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
73
74
75
76
on:
push:
branches:
- "master"
name: CI
jobs:
test-and-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.9.7"
- name: Install dependencies
run: |
echo $(pwd)
sudo apt install -y patch
python -m pip install --upgrade poetry wheel
poetry install
poetry env info
poetry run pip3 uninstall -y dacot_models
poetry run pip3 install -e dacot_models/
cd /home/runner/.cache/pypoetry/virtualenvs/*/lib/python3.9/site-packages/graphene && patch -p0 --verbose --ignore-whitespace --fuzz 3 < /home/runner/work/backend/backend/graphene_arguments.patch
- name: Run coverage tool
run: |
poetry run coverage run -m pytest -v tests/
- name: Generate xml coverage report
run: |
poetry run coverage report --omit '*python3*' -m
poetry run coverage xml -i
- name: Upload xml coverage report
uses: actions/[email protected]
with:
name: report
path: coverage.xml
sonarcloud:
runs-on: ubuntu-latest
needs: [test-and-coverage]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Download coverage report
uses: actions/[email protected]
with:
name: report
- name: List files in coverage report
run: |
ls -lah /home/runner/work/backend/backend
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
build_docker:
runs-on: ubuntu-latest
needs: [test-and-coverage]
steps:
- uses: actions/checkout@v2
- run: echo "::set-output name=repo_lower::$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')"
id: repo
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push
uses: docker/build-push-action@v1
with:
registry: docker.pkg.github.com
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ steps.repo.outputs.repo_lower }}/fastapi
tag_with_sha: true
tag_with_ref: true