-
Notifications
You must be signed in to change notification settings - Fork 2
69 lines (55 loc) · 1.74 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
name: Falcon CI
on: pull_request
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip' # caching pip dependencies
- run: pip install -r requirements.txt
- name: Docker Build and run
run: |
docker build . -t scottyfullstack/falcon-look-app
docker run -dit -p 8000:8000 scottyfullstack/falcon-look-app
- name: Test Code
run: coverage run -m pytest tests/
- name: Generate the report
if: ${{ always() }}
run: coverage report > coverage-report
- name: Scan image
uses: anchore/scan-action@v3
id: scan
with:
image: "scottyfullstack/falcon-look-app"
- name: upload Anchore scan SARIF report
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: ${{ steps.scan.outputs.sarif }}
- uses: actions/upload-artifact@v3
with:
name: vuln-report
path: results.sarif
- uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: coverage-report
path: coverage-report
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
tags: scottyfullstack/falcon-look-app:latest
- name: Create issue on failure
if: ${{ failure() }}
run: |
gh issue create --title "Failure on workflow: ${{ github.workflow }} - ${{ github.sha }}" --body "Failure on Job: ${{ github.job }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}