-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (86 loc) · 2.29 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
name: CI
on:
push:
branches:
- main
- master
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: read
jobs:
check-rust:
runs-on: ubuntu-latest
steps:
- name: Check Rust Compiler and Cargo
run: |
rustc --version
cargo --version
build-and-test:
needs: check-rust
runs-on: ${{ matrix.platform.runner }}
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: x86
- runner: ubuntu-latest
target: aarch64
- runner: ubuntu-latest
target: armv7
- runner: ubuntu-latest
target: s390x
- runner: ubuntu-latest
target: ppc64le
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Build and test
run: |
python -m pip install --upgrade pip setuptools setuptools_rust wheel
python setup.py bdist_wheel
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ runner.os }}-${{ matrix.platform.target }}
path: dist/*.whl
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-latest
needs: [build-and-test, sdist] # Ensure this job waits for others to finish
environment:
name: pypi
url: https://pypi.org/project/function-sampler/
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10' # Match the version used in building
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: Install Twine
run: |
python -m pip install --upgrade pip
pip install twine
- name: Publish package distributions to PyPI
run: |
twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}