-
Notifications
You must be signed in to change notification settings - Fork 13
100 lines (83 loc) · 2.95 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: CI and release pipeline
on:
pull_request:
push:
branches: ["main", "develop"]
tags: ["*"]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "pypy3.8", "pypy3.9", "pypy3.10"]
pylint-version: ["~=2.14.0"]
include:
- python-version: "3.11"
pylint-version: "~=2.17.7"
- python-version: "3.12"
pylint-version: "~=3.0.2"
- python-version: "3.12"
pylint-version: ""
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- uses: actions/[email protected]
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip
- uses: actions/[email protected]
with:
path: .venv
key: ${{ runner.os }}-py${{ matrix.python-version }}-pylint${{ matrix.pylint-version }}-venv-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-py${{ matrix.python-version }}-pylint${{ matrix.pylint-version }}-venv-
${{ runner.os }}-py${{ matrix.python-version }}-pylint
- name: Install poetry
run: pip install poetry
- name: Install dependencies
run: poetry install
env:
POETRY_VIRTUALENVS_IN_PROJECT: true
- name: Install pylint ${{ matrix.pylint-version }}
run: poetry run pip install pylint${{ matrix.pylint-version }}
- name: Run test
run: poetry run test/test.sh
release:
runs-on: ubuntu-latest
needs: [test]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.12'
- uses: actions/[email protected]
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip
- name: Install poetry
run: pip install poetry
- name: Publish to PyPI
run: poetry publish --build
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
- name: Set version
id: version
run: echo "version=${GITHUB_REF#refs/*/v}" >> $GITHUB_OUTPUT
- name: Extract changelog
id: changelog
run: sed -E -n '/^## \[${{ steps.version.outputs.version }}\]/,/^## \[[0-9\.]+\]/{/^\[[0-9\.]+\]/!p;}' CHANGES.md | sed '1d;$d' > release-body-raw.md
- uses: docker://pandoc/core:2.10
with:
args: --wrap none --from markdown --to gfm+hard_line_breaks --output release-body.md release-body-raw.md
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
body_path: release-body.md
tag_name: v${{ steps.version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}