Skip to content

Commit 71ec849

Browse files
testing the new deployment pipeline (#89)
Co-authored-by: Cellan Hall <[email protected]>
1 parent 7de2c20 commit 71ec849

Some content is hidden

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

50 files changed

+4427
-4353
lines changed

.github/actions/action.yml

-46
This file was deleted.

.github/workflows/ci.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
tags:
6+
- '**'
7+
pull_request: {}
8+
9+
jobs:
10+
test-python:
11+
name: test ${{ matrix.python-version }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
python-version:
16+
- '3.8'
17+
- '3.9'
18+
- '3.10'
19+
- '3.11'
20+
- '3.12'
21+
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: install rust stable
28+
uses: dtolnay/rust-toolchain@stable
29+
30+
- name: cache rust
31+
uses: Swatinem/rust-cache@v2
32+
with:
33+
key: test-v3
34+
35+
- name: set up python
36+
uses: actions/setup-python@v5
37+
with:
38+
python-version: ${{ matrix.python-version }}
39+
40+
# Issue with requests < 2.29.0 and docker. See: https://github.com/docker/docker-py/issues/3113
41+
- run: pip install docker requests==2.28.2
42+
43+
- run: pip install -e .
44+
env:
45+
RUST_BACKTRACE: 1
46+
47+
- run: pip freeze
48+
49+
- run: sh scripts/run_tests.sh
50+
51+
- run: cargo test
52+

.github/workflows/cross_build.yml

+81-159
Original file line numberDiff line numberDiff line change
@@ -4,184 +4,106 @@ on:
44
pull_request:
55
types: [closed]
66
branches:
7-
- main
7+
- release-staging
88

99
env:
1010
CARGO_TERM_COLOR: always
1111

1212
jobs:
13-
14-
wait-for-other-workflow:
15-
name: Wait for Other Workflow
13+
linux:
1614
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le]
1718
steps:
18-
- name: Wait for Other Workflow to Complete
19-
run: "echo 'Waiting for other workflow to complete...'"
20-
21-
build: # Workflow credit to https://github.com/samuelcolvin/rtoml/blob/main/.github/workflows/ci.yml
22-
if: github.event.pull_request.merged == true
23-
name: >
24-
build ${{ matrix.python-version }} on ${{ matrix.platform || matrix.os }}
25-
(${{ matrix.alt_arch_name || matrix.arch }})
19+
- uses: actions/checkout@v4
20+
- uses: actions/setup-python@v5
21+
with:
22+
python-version: '3.10'
23+
- name: Build wheels
24+
uses: PyO3/maturin-action@v1
25+
with:
26+
target: ${{ matrix.target }}
27+
args: --release --out dist --find-interpreter
28+
sccache: 'true'
29+
manylinux: auto
30+
- name: Upload wheels
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: wheels-linux-${{ matrix.target }}
34+
path: dist
35+
36+
windows:
37+
runs-on: windows-latest
2638
strategy:
27-
fail-fast: false
2839
matrix:
29-
os: [ubuntu, macos, windows]
30-
python-version: ["cp310", "pp37", "pp38", "pp39"]
31-
arch: [main, alt]
32-
include:
33-
- os: ubuntu
34-
platform: linux
35-
- os: windows
36-
ls: dir
37-
- os: macos
38-
arch: alt
39-
alt_arch_name: "arm64 universal2"
40-
exclude:
41-
- os: macos
42-
python-version: "pp37"
43-
arch: alt
44-
- os: macos
45-
python-version: "pp38"
46-
arch: alt
47-
- os: macos
48-
python-version: "pp39"
49-
arch: alt
50-
runs-on: ${{ format('{0}-latest', matrix.os) }}
40+
target: [x64, x86]
5141
steps:
52-
- uses: actions/checkout@v3
53-
54-
- name: set up python
55-
uses: actions/setup-python@v4
42+
- uses: actions/checkout@v4
43+
- uses: actions/setup-python@v5
5644
with:
57-
python-version: "3.9"
58-
59-
- name: set up rust
60-
uses: dtolnay/rust-toolchain@stable
45+
python-version: '3.10'
46+
architecture: ${{ matrix.target }}
47+
- name: Build wheels
48+
uses: PyO3/maturin-action@v1
6149
with:
62-
toolchain: stable
63-
64-
- name: update pip version
65-
run: |
66-
pip install requests
67-
python get_latest_version.py
68-
69-
- name: Setup Rust cache
70-
uses: Swatinem/rust-cache@v2
50+
target: ${{ matrix.target }}
51+
args: --release --out dist --find-interpreter
52+
sccache: 'true'
53+
- name: Upload wheels
54+
uses: actions/upload-artifact@v4
7155
with:
72-
key: ${{ matrix.alt_arch_name }}
73-
74-
- run: rustup target add aarch64-apple-darwin
75-
if: matrix.os == 'macos'
76-
77-
- run: rustup toolchain install stable-i686-pc-windows-msvc
78-
if: matrix.os == 'windows'
79-
80-
- run: rustup target add i686-pc-windows-msvc
81-
if: matrix.os == 'windows'
82-
83-
- name: Get pip cache dir
84-
id: pip-cache
85-
if: matrix.os != 'windows'
86-
run: |
87-
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
88-
89-
- name: Get pip cache dir
90-
id: pip-cache-win
91-
if: matrix.os == 'windows'
92-
run: |
93-
"dir=$(pip cache dir)" >> $env:GITHUB_OUTPUT
94-
95-
- name: Cache python dependencies
96-
uses: actions/cache@v3
56+
name: wheels-windows-${{ matrix.target }}
57+
path: dist
58+
59+
macos:
60+
runs-on: macos-latest
61+
strategy:
62+
matrix:
63+
target: [x86_64, aarch64]
64+
steps:
65+
- uses: actions/checkout@v4
66+
- uses: actions/setup-python@v5
9767
with:
98-
path: ${{ steps.pip-cache.outputs.dir || steps.pip-cache-win.outputs.dir }}
99-
key: ${{ runner.os }}-pip-${{ matrix.python-version }}
100-
101-
- name: install python dependencies
102-
run: pip install -U setuptools wheel twine cibuildwheel platformdirs
103-
104-
- name: Display cibuildwheel cache dir
105-
id: cibuildwheel-cache
106-
run: |
107-
from platformdirs import user_cache_path
108-
import os
109-
with open(os.getenv('GITHUB_OUTPUT'), 'w') as f:
110-
f.write(f"dir={str(user_cache_path(appname='cibuildwheel', appauthor='pypa'))}")
111-
shell: python
112-
113-
- name: Cache cibuildwheel tools
114-
uses: actions/cache@v3
68+
python-version: '3.10'
69+
- name: Build wheels
70+
uses: PyO3/maturin-action@v1
11571
with:
116-
path: ${{ steps.cibuildwheel-cache.outputs.dir }}
117-
key: ${{ runner.os }}-cibuildwheel-${{ matrix.python-version }}
118-
119-
- name: Install LLVM and Clang # required for bindgen to work, see https://github.com/rust-lang/rust-bindgen/issues/1797
120-
uses: KyleMayes/install-llvm-action@v1
121-
if: runner.os == 'Windows'
72+
target: ${{ matrix.target }}
73+
args: --release --out dist --find-interpreter
74+
sccache: 'true'
75+
- name: Upload wheels
76+
uses: actions/upload-artifact@v4
12277
with:
123-
version: "11.0"
124-
directory: ${{ runner.temp }}/llvm
125-
126-
- name: Set LIBCLANG_PATH
127-
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
128-
if: runner.os == 'Windows'
129-
130-
- name: build_sdist
131-
if: matrix.os == 'ubuntu' && matrix.python-version == 'cp310'
132-
run: |
133-
pip install maturin build
134-
python -m build --sdist -o wheelhouse
135-
- name: build ${{ matrix.platform || matrix.os }} binaries
136-
run: cibuildwheel --output-dir wheelhouse
137-
env:
138-
CIBW_BUILD: "${{ matrix.python-version }}-*"
139-
# rust doesn't seem to be available for musl linux on i686
140-
CIBW_SKIP: "*-musllinux_i686"
141-
# we build for "alt_arch_name" if it exists, else 'auto'
142-
CIBW_ARCHS: ${{ matrix.alt_arch_name || 'auto' }}
143-
CIBW_ENVIRONMENT: 'PATH="$HOME/.cargo/bin:$PATH" CARGO_TERM_COLOR="always"'
144-
CIBW_ENVIRONMENT_WINDOWS: 'PATH="$UserProfile\.cargo\bin;$PATH"'
145-
CIBW_BEFORE_BUILD: rustup show
146-
CIBW_BEFORE_BUILD_LINUX: >
147-
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=stable --profile=minimal -y &&
148-
rustup show
149-
CIBW_BUILD_VERBOSITY: 1
150-
151-
- run: ${{ matrix.ls || 'ls -lh' }} wheelhouse/
152-
153-
- uses: actions/upload-artifact@v3
78+
name: wheels-macos-${{ matrix.target }}
79+
path: dist
80+
81+
sdist:
82+
runs-on: ubuntu-latest
83+
steps:
84+
- uses: actions/checkout@v4
85+
- name: Build sdist
86+
uses: PyO3/maturin-action@v1
15487
with:
155-
name: wheels
156-
path: wheelhouse
157-
88+
command: sdist
89+
args: --out dist
90+
- name: Upload sdist
91+
uses: actions/upload-artifact@v4
92+
with:
93+
name: wheels-sdist
94+
path: dist
95+
15896
release:
159-
if: github.event.pull_request.merged == true
160-
needs: build
97+
name: Release
16198
runs-on: ubuntu-latest
99+
if: "startsWith(github.ref, 'refs/tags/')"
100+
needs: [linux, windows, macos, sdist]
162101
steps:
163-
- uses: actions/download-artifact@v2
164-
with:
165-
name: wheels
166-
path: wheelhouse
167-
168-
- name: Install twine
169-
run: python -m pip install --upgrade twine
170-
171-
- name: Create pypirc file
172-
run: |
173-
echo "[distutils]" > ~/.pypirc
174-
echo "index-servers =" >> ~/.pypirc
175-
echo " pypi" >> ~/.pypirc
176-
echo "" >> ~/.pypirc
177-
echo "[pypi]" >> ~/.pypirc
178-
echo "username: __token__" >> ~/.pypirc
179-
echo "password: \${{ secrets.PYPI_TOKEN }}" >> ~/.pypirc
180-
env:
181-
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
182-
102+
- uses: actions/download-artifact@v4
183103
- name: Publish to PyPI
184-
run: twine upload wheelhouse/*
104+
uses: PyO3/maturin-action@v1
185105
env:
186-
TWINE_USERNAME: __token__
187-
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
106+
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
107+
with:
108+
command: upload
109+
args: --non-interactive --skip-existing wheels-*/*

0 commit comments

Comments
 (0)