-
Notifications
You must be signed in to change notification settings - Fork 4
116 lines (99 loc) · 2.73 KB
/
ci-pipeline.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: CI Pipeline
on:
push:
branches:
- feature/*
- fix/*
- refactor/*
- chore/*
- develop
jobs:
lint-project:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m venv venv
. venv/bin/activate
python -m pip install --upgrade pip
pip install setuptools==58.0.4 wheel
pip install -r requirements.txt
pip install flake8
- name: Create flake8 configuration file
run: |
echo "[flake8]" > .flake8
echo "exclude = venv/*" >> .flake8
echo "max-line-length = 99" >> .flake8
- name: Verify installed packages
run: |
. venv/bin/activate
pip check
- name: Run linters
run: |
. venv/bin/activate
flake8 .
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run-tests:
needs: lint-project
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m venv venv
. venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
run: |
. venv/bin/activate
pytest --maxfail=1 --disable-warnings
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-test-image:
needs: run-tests
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
registry: ghcr.io
username: abbastoof
password: ${{ secrets.GH_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
tags: ghcr.io/${{ github.repository }}:${{ github.ref_name }}
merge-develop:
runs-on: ubuntu-latest
needs: publish-test-image
if: github.ref_name == 'develop'
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Fetch all branches
run: git fetch --all
- name: Merge branches into develop
run: |
git checkout develop
git merge --no-ff ${{ github.ref_name }}
git push origin develop