-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (34 loc) · 1.29 KB
/
deploy-pr.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
name: Test PR
on:
pull_request:
types: [opened, synchronize]
jobs:
build:
runs-on: ubuntu-latest
name: build-main-api
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/test.txt
- name: Static Code Analysis
run: |
pylint **/*.py --fail-under=7.0
- name: Code Coverage
run: |
pytest --ds=demo.settings.dev --cov=. --cov-fail-under=80
- name: Login to Docker Hub
run: echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin
- name: Build, tag, and push image to Docker Hub
run: |
docker build . --file docker-conf/Dockerfile-django-api --tag ${{ secrets.DOCKER_REGISTRY }}/algova-django-api:${GITHUB_SHA::7}
docker push ${{ secrets.DOCKER_REGISTRY }}/algova-django-api:${GITHUB_SHA::7}
echo "IMAGE_REF=${{ secrets.DOCKER_REGISTRY }}/algova-django-api:${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Vulnerability scan
uses: aquasecurity/[email protected]
with:
image-ref: ${{ env.IMAGE_REF }}
format: 'table'
exit-code: '0'