Skip to content

Commit 3457280

Browse files
committed
enable ci-tests and ci-wheels
1 parent cc90eaa commit 3457280

27 files changed

+359
-511
lines changed

.cirrus.yml

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

.coveragerc

Lines changed: 0 additions & 18 deletions
This file was deleted.
File renamed without changes.

.github/workflows/ci-manifest.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ name: ci-manifest
55

66
on:
77
pull_request:
8-
branches:
9-
- "*"
108

119
push:
12-
branches-ignore:
13-
- "auto-update-lockfiles"
14-
- "pre-commit-ci-update-config"
15-
- "dependabot/*"
10+
branches:
11+
- "master"
12+
- "v*x"
13+
- "!auto-update-lockfiles"
14+
- "!pre-commit-ci-update-config"
15+
- "!dependabot/*"
16+
tags:
17+
- "v*"
1618

1719
workflow_dispatch:
1820

.github/workflows/ci-tests.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Reference:
2+
# - https://github.com/actions/cache
3+
# - https://github.com/actions/checkout
4+
# - https://github.com/actions/download-artifact
5+
# - https://github.com/actions/upload-artifact
6+
# - https://github.com/conda-incubator/setup-miniconda
7+
8+
name: ci-tests
9+
10+
on:
11+
pull_request:
12+
13+
push:
14+
branches:
15+
- "master"
16+
- "v*x"
17+
- "!auto-update-lockfiles"
18+
- "!pre-commit-ci-update-config"
19+
- "!dependabot/*"
20+
tags:
21+
- "v*"
22+
23+
workflow_dispatch:
24+
25+
concurrency:
26+
group: ${{ github.workflow }}-${{ github.ref }}
27+
cancel-in-progress: true
28+
29+
jobs:
30+
tests:
31+
name: "tests (py${{ matrix.python-version }} ${{ matrix.os }})"
32+
33+
runs-on: ubuntu-latest
34+
35+
defaults:
36+
run:
37+
shell: bash -l {0}
38+
39+
env:
40+
ENV_NAME: "ci-tests"
41+
CYTHON_COVERAGE: true
42+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
43+
44+
strategy:
45+
fail-fast: false
46+
matrix:
47+
os: ["ubuntu-latest"]
48+
python-version: ["39", "310", "311"]
49+
include:
50+
- python-version: "311"
51+
cov-report: "--cov-report=xml --cov"
52+
codecov: "codecov"
53+
54+
steps:
55+
- uses: actions/checkout@v3
56+
with:
57+
fetch-depth: 0
58+
59+
- name: "mambaforge setup (python ${{ matrix.python-version }})"
60+
uses: conda-incubator/setup-miniconda@v2
61+
with:
62+
miniforge-variant: Mambaforge
63+
miniforge-version: latest
64+
channels: conda-forge,defaults
65+
channel-priority: true
66+
auto-update-conda: true
67+
environment-file: "requirements/locks/py${{ matrix.python-version }}-linux-64.lock"
68+
activate-environment: ${{ env.ENV_NAME }}
69+
70+
- name: "stratify tests (py${{ matrix.python-version }})"
71+
run: |
72+
python setup.py build_ext --inplace
73+
python -m pip install --no-deps --editable .
74+
pytest ${{ matrix.cov-report }}
75+
${{ matrix.codecov }}

.github/workflows/ci-wheels.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# Reference:
2+
# - https://github.com/actions/checkout
3+
# - https://github.com/actions/download-artifact
4+
# - https://github.com/actions/upload-artifact
5+
# - https://github.com/pypa/cibuildwheel
6+
# - https://github.com/pypa/build
7+
# - https://github.com/pypa/gh-action-pypi-publish
8+
# - https://test.pypi.org/help/#apitoken
9+
10+
name: ci-wheels
11+
12+
on:
13+
pull_request:
14+
15+
push:
16+
branches:
17+
- "master"
18+
- "v*x"
19+
- "!auto-update-lockfiles"
20+
- "!pre-commit-ci-update-config"
21+
- "!dependabot/*"
22+
tags:
23+
- "v*"
24+
25+
jobs:
26+
build_bdist:
27+
name: "build ${{ matrix.os }} wheels"
28+
runs-on: ${{ matrix.os }}
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
# TBD: extend to support windows
33+
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
34+
35+
steps:
36+
- uses: actions/checkout@v3
37+
with:
38+
fetch-depth: 0
39+
40+
- name: "build ${{ matrix.os }} wheels"
41+
uses: pypa/cibuildwheel@v2.12.3
42+
env:
43+
CIBW_SKIP: "cp36-* cp37-* pp* *-musllinux*"
44+
CIBW_ARCHS_LINUX: "x86_64"
45+
CIBW_ARCHS_MACOS: "x86_64 arm64"
46+
CIBW_ARCHS_WINDOWS: "AMD64"
47+
CIBW_BUILD_FRONTEND: "build"
48+
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014"
49+
CIBW_TEST_SKIP: "*-macosx_arm64"
50+
CIBW_TEST_REQUIRES: "pytest"
51+
CIBW_TEST_COMMAND: >
52+
python -m pytest --pyargs stratify
53+
54+
- uses: actions/upload-artifact@v3
55+
with:
56+
name: pypi-artifacts
57+
path: ${{ github.workspace }}/wheelhouse/*.whl
58+
59+
60+
build_sdist:
61+
name: "Build sdist"
62+
runs-on: ubuntu-latest
63+
steps:
64+
- uses: actions/checkout@v3
65+
with:
66+
fetch-depth: 0
67+
68+
- name: "Building sdist"
69+
shell: bash
70+
run: |
71+
pipx run build --sdist
72+
73+
- uses: actions/upload-artifact@v3
74+
with:
75+
name: pypi-artifacts
76+
path: ${{ github.workspace }}/dist/*.tar.gz
77+
78+
79+
show-artifacts:
80+
needs: [build_bdist, build_sdist]
81+
name: "Show artifacts"
82+
runs-on: ubuntu-latest
83+
steps:
84+
- uses: actions/download-artifact@v3
85+
with:
86+
name: pypi-artifacts
87+
path: ${{ github.workspace }}/dist
88+
89+
- shell: bash
90+
run: |
91+
ls -l ${{ github.workspace }}/dist
92+
93+
94+
publish-artifacts-test-pypi:
95+
needs: [build_bdist, build_sdist]
96+
name: "Publish to Test PyPI"
97+
runs-on: ubuntu-latest
98+
# upload to Test PyPI for every commit on main branch
99+
if: github.event_name == 'push' && github.event.ref == 'refs/heads/main'
100+
steps:
101+
- uses: actions/download-artifact@v3
102+
with:
103+
name: pypi-artifacts
104+
path: ${{ github.workspace }}/dist
105+
106+
- uses: pypa/gh-action-pypi-publish@release/v1
107+
with:
108+
user: __token__
109+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
110+
repository_url: https://test.pypi.org/legacy/
111+
skip_existing: true
112+
print_hash: true
113+
114+
115+
publish-artifacts-pypi:
116+
needs: [build_bdist, build_sdist]
117+
name: "Publish to PyPI"
118+
runs-on: ubuntu-latest
119+
# upload to PyPI for every tag starting with 'v'
120+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
121+
steps:
122+
- uses: actions/download-artifact@v3
123+
with:
124+
name: pypi-artifacts
125+
path: ${{ github.workspace }}/dist
126+
127+
- uses: pypa/gh-action-pypi-publish@release/v1
128+
with:
129+
user: __token__
130+
password: ${{ secrets.PYPI_API_TOKEN }}
131+
print_hash: true

0 commit comments

Comments
 (0)