Skip to content

Commit 600d0ae

Browse files
authored
Update CI/CD workflows, setup config files, and build wheels for Python >= 3.8 (#524)
* Update CI/CD workflows * disable cython for 3.12 and pypy3.9 * forgot to disable tests for 3.7 * properly disable cython * syntax is annoying * we should only test with orjson if we have cython installed * allow experimentals to fail * a test should take no longer than ten minutes * i guess we can't use continue-on-error that way then * test cibuildwheel * revert dist.yml changes * disable testing for 3.12 until properly supported in August or so * disable scripts/coverage call in scripts/tests because we already do it in a separate job * remove old tests and disable timeout * dsiable integ * try skipping meticulous tests * disable pypy tests for now * fix typo * extend timeout * switch over setup.cfg to pyproject.toml * fix linting * flake8 is impossible to please apparently * update gh-pages.yml * fix all yamls * fix requirements seutp * cleanup * should continue on false * fix continue on error placement * check linting only * Update python-package.yml to use experimental * Update python-package.yml * Update tests to run meticulous again * Update python-package.yml to allow 3.12 to fail * just disable 3.12 for now * Update python-package.yml to not test pypy until we figure this out * Update python-package.yml to extend job timeout to 10m * consolidate dist.yml into python-package.yml * update pyproject.toml with proper cibuildwheel config * forgot fetch-depth for wheel builds * reformat * skip builds for musllinux_x86_64 * enable check requirement * revert drastic changes for linting * pull in new changes from master
1 parent f79cc16 commit 600d0ae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+497
-319
lines changed
Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
# For most projects, this workflow file will not need changing; you simply need
23
# to commit it to your repository.
34
#
@@ -9,17 +10,15 @@
910
# the `language` matrix defined below to confirm you have the correct set of
1011
# supported CodeQL languages.
1112
#
12-
name: "CodeQL"
13-
13+
name: CodeQL
1414
on:
1515
push:
16-
branches: [ master ]
16+
branches: [master]
1717
pull_request:
1818
# The branches below must be a subset of the branches above
19-
branches: [ master ]
19+
branches: [master]
2020
schedule:
21-
- cron: '19 10 * * 6'
22-
21+
- cron: 19 10 * * 6
2322
jobs:
2423
analyze:
2524
name: Analyze
@@ -28,33 +27,31 @@ jobs:
2827
actions: read
2928
contents: read
3029
security-events: write
31-
3230
strategy:
3331
fail-fast: false
3432
matrix:
35-
language: [ 'python' ]
33+
language: [python]
3634
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
3735
# Learn more:
3836
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
39-
4037
steps:
41-
- name: Checkout repository
42-
uses: actions/checkout@v3
38+
- name: Checkout repository
39+
uses: actions/checkout@v3
4340

4441
# Initializes the CodeQL tools for scanning.
45-
- name: Initialize CodeQL
46-
uses: github/codeql-action/init@v2
47-
with:
48-
languages: ${{ matrix.language }}
42+
- name: Initialize CodeQL
43+
uses: github/codeql-action/init@v2
44+
with:
45+
languages: ${{ matrix.language }}
4946
# If you wish to specify custom queries, you can do so here or in a config file.
5047
# By default, queries listed here will override any specified in a config file.
5148
# Prefix the list here with "+" to use these queries and those in the config file.
5249
# queries: ./path/to/local/query, your-org/your-repo/queries@main
5350

5451
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5552
# If this step fails, then you should remove it and run the build manually (see below)
56-
- name: Autobuild
57-
uses: github/codeql-action/autobuild@v2
53+
- name: Autobuild
54+
uses: github/codeql-action/autobuild@v2
5855

5956
# ℹ️ Command-line programs to run using the OS shell.
6057
# 📚 https://git.io/JvXDl
@@ -66,6 +63,5 @@ jobs:
6663
#- run: |
6764
# make bootstrap
6865
# make release
69-
70-
- name: Perform CodeQL Analysis
71-
uses: github/codeql-action/analyze@v2
66+
- name: Perform CodeQL Analysis
67+
uses: github/codeql-action/analyze@v2

.github/workflows/dist.yml

Lines changed: 0 additions & 73 deletions
This file was deleted.

.github/workflows/gh-pages.yml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
1+
---
12
name: Pages
2-
33
on:
44
push:
5-
branches: ["master"]
5+
branches: [master]
66
pull_request:
7-
branches: ["master"]
7+
branches: [master]
88
release:
99
types: [created]
10-
branches:
11-
- 'master'
12-
10+
branches: [master]
1311
jobs:
1412
build:
15-
name: "Build docs"
13+
name: Build docs
1614
runs-on: ubuntu-latest
1715
steps:
18-
- uses: actions/setup-python@v4
19-
- uses: actions/checkout@v3
20-
with:
21-
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
22-
- name: "Install runtime dependencies"
23-
run: "scripts/install"
24-
- name: "Install doc build deps and build with Sphinx"
25-
run: make docs
26-
- name: "Upload artifacts"
27-
uses: actions/upload-pages-artifact@v1
28-
with:
16+
- uses: actions/setup-python@v4
17+
- uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
20+
- name: Install runtime dependencies
21+
run: |
22+
pip install .
23+
pip install -r requirements/docs.txt
24+
- name: Install doc build deps and build with Sphinx
25+
run: make docs
26+
- name: Upload artifacts
27+
uses: actions/upload-pages-artifact@v1
28+
with:
2929
# Upload built docs
30-
path: "./Documentation"
30+
path: ./Documentation
3131
deploy:
32-
name: "Deploy docs"
32+
name: Deploy docs
3333
if: github.event_name == 'release' && github.event.action == 'created'
3434
needs: build
3535
runs-on: ubuntu-latest
3636
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
3737
permissions:
38-
pages: write # to deploy to Pages
39-
id-token: write # to verify the deployment originates from an appropriate source
38+
pages: write # to deploy to Pages
39+
id-token: write # to verify the deployment originates from an appropriate source
4040
# Deploy to the github-pages environment
4141
environment:
4242
name: github-pages
4343
url: ${{ steps.deployment.outputs.page_url }}
4444
steps:
45-
- uses: actions/deploy-pages@v2
46-
id: deployment
47-
name: "Deploy to GitHub Pages"
45+
- uses: actions/deploy-pages@v2
46+
id: deployment
47+
name: Deploy to GitHub Pages
Lines changed: 128 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,143 @@
1-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3-
4-
name: Python package
5-
1+
---
2+
name: Test Python library
63
on:
74
push:
8-
branches: ["master"]
5+
branches: [master]
96
pull_request:
10-
branches: ["master"]
7+
branches: [master]
8+
release:
9+
types: [created]
10+
branches: [master]
11+
env:
12+
FORCE_COLOR: '1' # Make tools pretty.
13+
PIP_DISABLE_PIP_VERSION_CHECK: '1'
14+
PIP_NO_PYTHON_VERSION_WARNING: '1'
15+
PYTHON_LATEST: '3.11'
1116

17+
# For re-actors/checkout-python-sdist
18+
sdist-artifact: python-package-distributions
1219
jobs:
13-
tests:
14-
name: "Python ${{ matrix.python-version }}/Cython: ${{ matrix.use-cython }}"
15-
runs-on: "ubuntu-latest"
16-
20+
lint:
21+
name: Check linting
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout project
25+
uses: actions/checkout@v3
26+
with:
27+
fetch-depth: 0
28+
- name: Set up Python
29+
uses: actions/setup-python@v4
30+
with:
31+
python-version: ${{ env.PYTHON_LATEST }}
32+
cache: pip
33+
- run: |
34+
python -m pip install build
35+
python -m pip install -r requirements/test.txt
36+
name: Install core libraries for build and install
37+
- name: Run linting checks
38+
run: scripts/check
39+
test-pytest:
40+
name: 'Python ${{ matrix.python-version }}/Cython: ${{ matrix.use-cython }}'
41+
runs-on: ubuntu-latest
42+
timeout-minutes: 10 # Maybe we should remove this someday but the PyPy tests are acting strange
1743
strategy:
1844
# Complete all jobs even if one fails, allows us to see
1945
# for example if a test fails only when Cython is enabled
2046
fail-fast: false
2147
matrix:
22-
python-version: ["3.8", "3.9", "3.10", "3.11"]
23-
use-cython: ["true", "false"]
48+
python-version: ['3.8', '3.9', '3.10', '3.11']
49+
use-cython: ['true', 'false']
50+
experimental: [false]
51+
# include:
52+
# - python-version: pypy3.9
53+
# experimental: true
54+
# use-cython: 'false'
55+
# - python-version: ~3.12.0-0
56+
# experimental: true
57+
# use-cython: 'false'
2458
env:
2559
USE_CYTHON: ${{ matrix.use-cython }}
26-
60+
continue-on-error: ${{ matrix.experimental }}
2761
steps:
28-
- uses: "actions/checkout@v3"
29-
with:
30-
# You need to include this or setuptools_scm in GitHub runners won't detect the version
31-
fetch-depth: 0
32-
- uses: "actions/setup-python@v4"
33-
with:
34-
python-version: "${{ matrix.python-version }}"
35-
- name: "Install dependencies"
36-
run: "scripts/install"
37-
- name: "Run linting checks"
38-
run: "scripts/check"
39-
- name: "Run tests"
40-
run: "scripts/tests"
41-
- name: "Enforce coverage"
62+
- uses: actions/checkout@v3
63+
with:
64+
fetch-depth: 0
65+
- uses: actions/setup-python@v4
66+
with:
67+
python-version: ${{ matrix.python-version }}
68+
cache: pip
69+
cache-dependency-path: requirements/test.txt
70+
- name: Install dependencies
71+
run: |
72+
pip install -r requirements/test.txt
73+
pip install .
74+
- name: Run tests
75+
run: scripts/tests
76+
- name: Enforce coverage
4277
uses: codecov/codecov-action@v3
4378
with:
44-
token: ${{ secrets.CODECOV_TOKEN }}
79+
token: ${{ secrets.CODECOV_TOKEN }}
80+
check: # This job does nothing and is only used for the branch protection
81+
name: ✅ Ensure the required checks passing
82+
if: always()
83+
needs: [lint, test-pytest]
84+
runs-on: ubuntu-latest
85+
steps:
86+
- name: Decide whether the needed jobs succeeded or failed
87+
uses: re-actors/alls-green@release/v1
88+
with:
89+
jobs: ${{ toJSON(needs) }}
90+
build_wheels:
91+
name: 📦 Build wheels on ${{ matrix.os }}
92+
runs-on: ${{ matrix.os }}
93+
needs: check
94+
if: github.event_name == 'release' && github.event.action == 'created'
95+
strategy:
96+
matrix:
97+
os: [ubuntu-20.04, macos-11]
98+
steps:
99+
- uses: actions/checkout@v3
100+
with:
101+
fetch-depth: 0
102+
- name: Build wheels
103+
uses: pypa/cibuildwheel@v2.10.1
104+
- uses: actions/upload-artifact@v3
105+
with:
106+
path: ./wheelhouse/*.whl
107+
build_sdist:
108+
name: 📦 Build the source distribution
109+
runs-on: ubuntu-latest
110+
needs: check
111+
if: github.event_name == 'release' && github.event.action == 'created'
112+
steps:
113+
- uses: actions/checkout@v3
114+
name: Checkout source repository
115+
with:
116+
fetch-depth: 0
117+
- uses: actions/setup-python@v4
118+
- name: Build sdist
119+
run: >
120+
pip3 install pkgconfig cython --upgrade &&
121+
python3 setup.py sdist
122+
- uses: actions/upload-artifact@v3
123+
name: Upload build artifacts
124+
with:
125+
path: dist/*.tar.gz
126+
publish:
127+
name: 📦 Publish to PyPI
128+
runs-on: ubuntu-latest
129+
needs: [build_wheels, build_sdist]
130+
permissions:
131+
id-token: write
132+
environment: pypi
133+
if: github.event_name == 'release' && github.event.action == 'created'
134+
steps:
135+
- name: Download the sdist artifact
136+
uses: actions/download-artifact@v3
137+
with:
138+
name: artifact
139+
path: dist
140+
- name: Publish package to PyPI
141+
uses: pypa/gh-action-pypi-publish@release/v1
142+
with:
143+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)