-
Notifications
You must be signed in to change notification settings - Fork 24
115 lines (95 loc) · 3.05 KB
/
main.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
name: Main
on:
push:
branches: ["*"] # Run only when push to branches (not tags).
paths-ignore:
- "codeforlife/version.py"
- "**/*.md"
- ".vscode/**"
- ".*"
workflow_dispatch:
env:
PYTHON_VERSION: 3.8
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.8]
steps:
- name: 🛫 Checkout
uses: actions/checkout@v3
- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: 🛠 Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pipenv
pipenv install --dev
- name: 🔎 Check Code Format
run: if ! pipenv run black --check .; then exit 1; fi
- name: 🔎 Check Migrations
run: pipenv run python manage.py makemigrations --check --dry-run
# TODO: assert code coverage target.
- name: 🧪 Test Code Units
run: pipenv run pytest
sync:
runs-on: ubuntu-latest
needs: [test]
steps:
- name: 🛫 Checkout
uses: actions/checkout@v3
- name: 🐍 Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: 🛠 Install Dependencies
run: |
python -m pip install --upgrade pip
# pipenv-setup requires downgraded vistir: https://github.com/Madoshakalaka/pipenv-setup/issues/138
python -m pip install pipenv-setup[black]==3.2.0 vistir==0.6.1
- name: ⚙️ Configure Git
run: |
git config --local user.name cfl-bot
git config --local user.email [email protected]
- name: 🔄 Sync Setup Dependencies
run: |
pipenv-setup sync
git add setup.py
# Only commit and push if there are differences.
if ! git diff --staged --quiet; then
git commit -m "ci[setup]: sync dependencies [skip ci]"
git push
fi
release:
concurrency: release
runs-on: ubuntu-latest
needs: [sync]
if: github.ref_name == 'main'
steps:
- name: 🛫 Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
fetch-depth: 0
- name: 🔄 Sync Setup Dependencies
run: git pull
- name: 🐍 Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: 🛠 Install Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install python-semantic-release~=7.33
- name: ⚙️ Configure Git
run: |
git config --local user.name cfl-bot
git config --local user.email [email protected]
- name: 🚀 Publish Semantic Release
env:
GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: semantic-release publish --verbosity=INFO