-
Notifications
You must be signed in to change notification settings - Fork 25
147 lines (143 loc) · 5.13 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
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
147
name: CI
on:
- release
- push
- pull_request
jobs:
lint:
name: Run lint checks
runs-on: ubuntu-20.04
# Workaround to disable pip upgrade warnings until fixed in setup-python
# See: https://github.com/actions/setup-python/issues/532
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
steps:
- uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install Poetry
# uses: snok/install-poetry@v1
uses: Gr1N/setup-poetry@v8
- name: Install dependencies (poetry)
run: poetry install --no-interaction --only=main,ci,lint
- name: Run lint checks
run: poetry run tox --quiet -e check
test:
name: Run tests
runs-on: ${{ matrix.platform }}
# Workaround to disable pip upgrade warnings until fixed in setup-python
# See: https://github.com/actions/setup-python/issues/532
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
strategy:
fail-fast: false
# Versions available:
# pypy: https://downloads.python.org/pypy/versions.json
# Python: https://github.com/actions/python-versions/blob/main/versions-manifest.json
# Additional info: https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md
# OS images: https://github.com/actions/runner-images
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
architecture:
- x86
- x64
platform:
- ubuntu-20.04
- windows-latest
# Fix tests failing on MacOS 14+ due to ARM architecture
# https://github.com/actions/setup-python/issues/825
# TODO: update tests to use ARM MacOS with 14+, add
# architecture to the list of architectures above.
- macos-13
exclude:
- platform: ubuntu-20.04
architecture: x86
- platform: macos-13
architecture: x86
# Not sure why, but 3.7 on x86 windows is cursed in CI
# It passes (for now), however it's quite slow,
# and I'm ADHD.
- platform: windows-latest
architecture: x86
python-version: 3.7
steps:
- uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
- name: Install Poetry
# uses: snok/install-poetry@v1
uses: Gr1N/setup-poetry@v8
- name: Display platform and environment information
run: |
python --version
python -c "import sys; print('sys.version: %s' % str(sys.version))"
python -c "import sys; print('sys.platform: %s' % str(sys.platform))"
python -c "import os; print('os.name: %s' % str(os.name))"
python -c "import platform; print('platform.uname(): %s' % str(platform.uname()))"
- name: Install dependencies (poetry)
run: poetry install --no-interaction --only=main,ci,test
# TODO: fix benchmark results (maybe a separate Job?)
- name: Run tests
run: poetry run tox --quiet
- uses: codecov/codecov-action@v3
with:
# codecov is annoying. Not sure why I'm still using it,
# may need to look at something that has less heisenbugs.
# https://community.codecov.com/t/ci-failure-due-to-too-many-uploads-to-this-commit/2587/12
fail_ci_if_error: false
- name: Coveralls
if: ${{ matrix.platform == 'ubuntu-20.04' && github.event_name != 'pull_request' }}
uses: AndreMiras/coveralls-python-action@develop
with:
parallel: true
flag-name: ${{ matrix.python-version }}-${{ matrix.platform }}
coveralls_finish:
needs: test
runs-on: ubuntu-20.04
steps:
- name: Coveralls Finished
if: ${{ github.event_name != 'pull_request' }}
uses: AndreMiras/coveralls-python-action@develop
with:
parallel-finished: true
# TODO: publish releases using CI
# TODO: don't publish pre-releases OR publish them as pre-releases to PyPI
# https://github.com/marketplace/actions/upload-a-build-artifact
# name: "Build and publish a release"
# on:
# release:
# types: [released]
# jobs:
# publish:
# name: "📦 Publish Python distributions"
# runs-on: "ubuntu-20.04"
# strategy:
# matrix:
# python-version:
# - "3.8"
# steps:
# - uses: actions/checkout@v3
# - name: "🐍 Set up Python ${{ matrix.python-version }}"
# uses: actions/setup-python@v4
# with:
# python-version: "${{ matrix.python-version }}"
# - name: "🐍 Install wheel and build"
# run: "python -m pip install wheel build --user"
# - name: "🐍 Build a binary wheel and a source tarball"
# run: "python -m build"
# - name: "📦 Publish distribution to PyPI"
# uses: "pypa/gh-action-pypi-publish@master"
# if: "startsWith(github.ref, 'refs/tags')"
# with:
# password: "${{ secrets.pypi_password }}"