-
Notifications
You must be signed in to change notification settings - Fork 23
146 lines (119 loc) · 3.68 KB
/
cicd.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: 🚀 CI/CD
on:
push:
jobs:
test_and_build:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Load Cached Poetry
uses: actions/cache@v2
with:
path: ~/.local
key: poetry-dependencies-v2
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-in-project: true
- name: Load Cached Python Dependencies
uses: actions/cache@v2
with:
path: .venv
key: python-dependencies-${{ hashFiles('**/poetry.lock') }}
- name: Install Python Dependencies
run: poetry install
- name: Install APT Dependencies
uses: upciti/wakemeops-action@v1
with:
packages: |
debhelper
fakeroot
- name: Run ruff format
run: poetry run ruff format
- name: Run ruff check
run: poetry run ruff check
- name: Run pytest
run: poetry run pytest --cov=src --cov-report=term-missing tests
- name: Generate coverage report
shell: bash
run: poetry run coverage xml
- uses: codecov/codecov-action@v2
with:
files: ./coverage.xml
- name: Build single binary application
run: |
poetry install --extras pyinstaller
poetry run poetry-dynamic-versioning
poetry run pyinstaller --onefile src/wheel2deb/__main__.py --name wheel2deb -s
dist/wheel2deb version
dist/wheel2deb
mv dist/wheel2deb wheel2deb_linux_amd64
- name: Upload build artifact
uses: actions/upload-artifact@v2
with:
name: wheel2deb_linux_amd64
path: wheel2deb_linux_amd64
retention-days: 2
publish_release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [test_and_build]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install clog-cli
uses: upciti/wakemeops-action@v1
with:
packages: clog-cli
- name: Build Release Changelog
run: |
clog --setversion $(git tag --sort=creatordate | tail -n1) \
--from $(git tag --sort=creatordate | tail -n2 | head -n1) \
-o changelog.md \
-r https://github.com/upciti/wheel2deb
- name: Download build artifact
uses: actions/download-artifact@v2
with:
name: wheel2deb_linux_amd64
- name: Create Release
uses: softprops/action-gh-release@v1
with:
body_path: changelog.md
files: wheel2deb_linux_amd64
publish_pypi:
runs-on: ubuntu-20.04
needs: [test_and_build]
if: startsWith(github.ref, 'refs/tags')
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Load Cached Poetry
uses: actions/cache@v2
with:
path: ~/.local
key: poetry-dependencies-v2
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Get Release Version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Build Distribution
run: |
poetry version "$RELEASE_VERSION"
poetry build
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}