-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (84 loc) · 2.42 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: CI
on: [push]
jobs:
checks:
name: Checks
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-3.8-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('requirements.txt') }}
- name: Update pip
run: pip install .[extra]
- name: Check formatting with Black
run: black --check --diff .
- name: Lint with flake8
run: flake8 .
- name: Static type checking
run: |
# Use mypy for static type checking
mkdir -p .mypy_cache # Workaround issue with mypy: https://github.com/tk-woven/mypy-install-types-mre
mypy --install-types --non-interactive .
dist:
name: Build dist
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install dependencies
run: |
pip install -U pip setuptools wheel
pip install -U build
- name: Build dist
run: python -m build --sdist --wheel
- name: Upload dist as artifact
uses: actions/upload-artifact@v4
with:
name: pybldc-${{ github.sha }}
path: dist
release:
needs: [checks, dist]
name: Release
runs-on: ubuntu-22.04
timeout-minutes: 5
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: "3.8"
- uses: actions/download-artifact@v4
with:
name: pybldc-${{ github.sha }}
path: pybldc
- name: Publish to PyPI server
id: pypi
run: |
pip install -U pip setuptools wheel
pip install -U twine
twine check pybldc/*
twine upload -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} pybldc/*
- name: Calculate checksums
run: |
pushd pybldc
sha256sum * > SHA256SUMS
popd
- name: Publish to Github Release
if: ${{ ! cancelled() && steps.pypi.conclusion == 'success' }}
uses: softprops/action-gh-release@v1
with:
files: pybldc/*
draft: true
fail_on_unmatched_files: true