Skip to content

Commit fbe4783

Browse files
authored
enable ci-tests and ci-wheels (#79)
* enable ci-tests and ci-wheels * review actions * ci-wheels main to master
1 parent d736656 commit fbe4783

27 files changed

+355
-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: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
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+
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
33+
34+
steps:
35+
- uses: actions/checkout@v3
36+
with:
37+
fetch-depth: 0
38+
39+
- name: "build ${{ matrix.os }} wheels"
40+
uses: pypa/[email protected]
41+
env:
42+
CIBW_SKIP: "cp36-* cp37-* pp* *-musllinux*"
43+
CIBW_ARCHS_LINUX: "x86_64"
44+
CIBW_ARCHS_MACOS: "x86_64 arm64"
45+
CIBW_ARCHS_WINDOWS: "AMD64"
46+
CIBW_BUILD_FRONTEND: "build"
47+
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014"
48+
CIBW_TEST_SKIP: "*-macosx_arm64"
49+
CIBW_TEST_REQUIRES: "pytest"
50+
CIBW_TEST_COMMAND: >
51+
python -m pytest --pyargs stratify
52+
53+
- uses: actions/upload-artifact@v3
54+
with:
55+
name: pypi-artifacts
56+
path: ${{ github.workspace }}/wheelhouse/*.whl
57+
58+
59+
build_sdist:
60+
name: "Build sdist"
61+
runs-on: ubuntu-latest
62+
steps:
63+
- uses: actions/checkout@v3
64+
with:
65+
fetch-depth: 0
66+
67+
- name: "Building sdist"
68+
shell: bash
69+
run: |
70+
pipx run build --sdist
71+
72+
- uses: actions/upload-artifact@v3
73+
with:
74+
name: pypi-artifacts
75+
path: ${{ github.workspace }}/dist/*.tar.gz
76+
77+
78+
show-artifacts:
79+
needs: [build_bdist, build_sdist]
80+
name: "Show artifacts"
81+
runs-on: ubuntu-latest
82+
steps:
83+
- uses: actions/download-artifact@v3
84+
with:
85+
name: pypi-artifacts
86+
path: ${{ github.workspace }}/dist
87+
88+
- shell: bash
89+
run: |
90+
ls -l ${{ github.workspace }}/dist
91+
92+
93+
publish-artifacts-test-pypi:
94+
needs: [build_bdist, build_sdist]
95+
name: "Publish to Test PyPI"
96+
runs-on: ubuntu-latest
97+
# upload to Test PyPI for every commit on master branch
98+
if: github.event_name == 'push' && github.event.ref == 'refs/heads/master'
99+
steps:
100+
- uses: actions/download-artifact@v3
101+
with:
102+
name: pypi-artifacts
103+
path: ${{ github.workspace }}/dist
104+
105+
- uses: pypa/gh-action-pypi-publish@release/v1
106+
with:
107+
user: __token__
108+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
109+
repository_url: https://test.pypi.org/legacy/
110+
skip_existing: true
111+
print_hash: true
112+
113+
114+
publish-artifacts-pypi:
115+
needs: [build_bdist, build_sdist]
116+
name: "Publish to PyPI"
117+
runs-on: ubuntu-latest
118+
# upload to PyPI for every tag starting with 'v'
119+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
120+
steps:
121+
- uses: actions/download-artifact@v3
122+
with:
123+
name: pypi-artifacts
124+
path: ${{ github.workspace }}/dist
125+
126+
- uses: pypa/gh-action-pypi-publish@release/v1
127+
with:
128+
user: __token__
129+
password: ${{ secrets.PYPI_API_TOKEN }}
130+
print_hash: true

0 commit comments

Comments
 (0)