|
1 |
| -on: [push, pull_request] |
2 |
| - |
3 | 1 | name: Build
|
4 | 2 |
|
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + tags: |
| 8 | + - '**' |
| 9 | + pull_request: {} |
| 10 | + |
| 11 | +# some code from https://github.com/pydantic/pydantic-core/blob/d6e7890b36ef21cb28180a7f5b1479da2319012d/.github/workflows/ci.yml |
| 12 | +# MIT License, see author list by link |
5 | 13 | jobs:
|
6 |
| - macos: |
7 |
| - runs-on: macos-latest |
| 14 | + build: |
| 15 | + name: build on ${{ matrix.platform || matrix.os }} (${{ matrix.target }} - ${{ matrix.manylinux || 'auto' }}) |
8 | 16 | strategy:
|
| 17 | + fail-fast: false |
9 | 18 | matrix:
|
10 |
| - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] |
11 |
| - steps: |
12 |
| - - uses: actions/checkout@v2 |
13 |
| - - uses: actions/setup-python@v2 |
14 |
| - with: |
15 |
| - python-version: ${{ matrix.python-version }} |
16 |
| - - name: Install Rust toolchain |
17 |
| - uses: actions-rs/toolchain@v1 |
18 |
| - with: |
19 |
| - toolchain: stable |
20 |
| - target: aarch64-apple-darwin |
21 |
| - profile: minimal |
22 |
| - default: true |
23 |
| - - name: Build |
24 |
| - run: cargo build --release |
25 |
| - - name: Build wheels - x86_64 |
26 |
| - uses: messense/maturin-action@v1 |
27 |
| - with: |
28 |
| - target: x86_64 |
29 |
| - args: -i python --release --out dist --sdist |
30 |
| - - name: Install built wheel - x86_64 |
31 |
| - run: | |
32 |
| - pip install python-calamine --no-index --find-links dist --force-reinstall |
33 |
| - - name: Build wheels - universal2 |
34 |
| - if: ${{ matrix.python-version != '3.7' }} |
35 |
| - uses: messense/maturin-action@v1 |
36 |
| - with: |
37 |
| - args: -i python --release --universal2 --out dist |
38 |
| - - name: Install built wheel - universal2 |
39 |
| - if: ${{ matrix.python-version != '3.7' }} |
40 |
| - run: | |
41 |
| - pip install python-calamine --no-index --find-links dist --force-reinstall |
42 |
| - - name: Python UnitTest |
43 |
| - run: | |
44 |
| - pip install pytest |
45 |
| - pytest |
46 |
| - - name: Upload wheels |
47 |
| - uses: actions/upload-artifact@v2 |
48 |
| - with: |
49 |
| - name: wheels |
50 |
| - path: dist |
| 19 | + os: [ubuntu, macos, windows] |
| 20 | + target: [x86_64, aarch64] |
| 21 | + manylinux: [auto] |
| 22 | + include: |
| 23 | + - os: ubuntu |
| 24 | + platform: linux |
| 25 | + - os: windows |
| 26 | + ls: dir |
| 27 | + interpreter: 3.7 3.8 3.9 3.10 3.11 |
| 28 | + - os: windows |
| 29 | + ls: dir |
| 30 | + target: i686 |
| 31 | + python-architecture: x86 |
| 32 | + interpreter: 3.7 3.8 3.9 3.10 3.11 |
| 33 | + - os: macos |
| 34 | + target: aarch64 |
| 35 | + interpreter: 3.7 3.8 3.9 3.10 3.11 |
| 36 | + - os: ubuntu |
| 37 | + platform: linux |
| 38 | + target: i686 |
| 39 | + # GCC 4.8.5 in manylinux2014 container doesn't support c11 atomic |
| 40 | + # we use manylinux_2_24 container for aarch64 and armv7 targets instead, |
| 41 | + - os: ubuntu |
| 42 | + platform: linux |
| 43 | + target: aarch64 |
| 44 | + container: messense/manylinux_2_24-cross:aarch64 |
| 45 | + - os: ubuntu |
| 46 | + platform: linux |
| 47 | + target: armv7 |
| 48 | + container: messense/manylinux_2_24-cross:armv7 |
| 49 | + interpreter: 3.7 3.8 3.9 3.10 3.11 |
| 50 | + # musllinux |
| 51 | + - os: ubuntu |
| 52 | + platform: linux |
| 53 | + target: x86_64 |
| 54 | + manylinux: musllinux_1_1 |
| 55 | + - os: ubuntu |
| 56 | + platform: linux |
| 57 | + target: aarch64 |
| 58 | + manylinux: musllinux_1_1 |
| 59 | + - os: ubuntu |
| 60 | + platform: linux |
| 61 | + target: ppc64le |
| 62 | + container: messense/manylinux_2_24-cross:ppc64le |
| 63 | + interpreter: 3.7 3.8 3.9 3.10 3.11 |
| 64 | + - os: ubuntu |
| 65 | + platform: linux |
| 66 | + target: s390x |
| 67 | + container: messense/manylinux_2_24-cross:s390x |
| 68 | + interpreter: 3.7 3.8 3.9 3.10 3.11 |
| 69 | + exclude: |
| 70 | + # Windows on arm64 only supports Python 3.11+ |
| 71 | + - os: windows |
| 72 | + target: aarch64 |
51 | 73 |
|
52 |
| - windows: |
53 |
| - runs-on: windows-latest |
54 |
| - strategy: |
55 |
| - matrix: |
56 |
| - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] |
57 |
| - target: [x64, x86] |
| 74 | + runs-on: ${{ matrix.os }}-latest |
58 | 75 | steps:
|
59 |
| - - uses: actions/checkout@v2 |
60 |
| - - uses: actions/setup-python@v2 |
| 76 | + - uses: actions/checkout@v3 |
| 77 | + |
| 78 | + - name: set up python |
| 79 | + uses: actions/setup-python@v4 |
61 | 80 | with:
|
62 |
| - python-version: ${{ matrix.python-version }} |
63 |
| - architecture: ${{ matrix.target }} |
64 |
| - - name: Update rustup |
65 |
| - run: rustup self update |
66 |
| - - name: Install Rust toolchain |
67 |
| - uses: actions-rs/toolchain@v1 |
| 81 | + python-version: '3.11' |
| 82 | + architecture: ${{ matrix.python-architecture || 'x64' }} |
| 83 | + |
| 84 | + - run: pip install -U twine |
| 85 | + |
| 86 | + - name: build sdist |
| 87 | + if: ${{ matrix.os == 'ubuntu' && matrix.target == 'x86_64' && matrix.manylinux == 'auto' }} |
| 88 | + uses: PyO3/maturin-action@v1 |
68 | 89 | with:
|
69 |
| - toolchain: stable |
70 |
| - profile: minimal |
71 |
| - default: true |
72 |
| - - name: Build |
73 |
| - if: matrix.target == 'x64' |
74 |
| - run: cargo build --release |
75 |
| - - name: Build wheels |
76 |
| - uses: messense/maturin-action@v1 |
| 90 | + command: sdist |
| 91 | + args: --out dist |
| 92 | + rust-toolchain: stable |
| 93 | + |
| 94 | + - name: build wheels |
| 95 | + uses: PyO3/maturin-action@v1 |
77 | 96 | with:
|
78 | 97 | target: ${{ matrix.target }}
|
79 |
| - args: -i python --release --out dist |
80 |
| - - name: Install built wheel |
81 |
| - run: | |
82 |
| - pip install python-calamine --no-index --find-links dist --force-reinstall |
83 |
| - - name: Python UnitTest |
84 |
| - run: | |
85 |
| - pip install pytest |
86 |
| - pytest |
87 |
| - - name: Upload wheels |
88 |
| - uses: actions/upload-artifact@v2 |
| 98 | + manylinux: ${{ matrix.manylinux || 'auto' }} |
| 99 | + container: ${{ matrix.container }} |
| 100 | + args: --release --out dist --interpreter ${{ matrix.interpreter || '3.7 3.8 3.9 3.10 3.11 pypy3.7 pypy3.8 pypy3.9' }} |
| 101 | + rust-toolchain: stable |
| 102 | + |
| 103 | + - run: ${{ matrix.ls || 'ls -lh' }} dist/ |
| 104 | + |
| 105 | + - run: twine check dist/* |
| 106 | + |
| 107 | + - uses: actions/upload-artifact@v3 |
89 | 108 | with:
|
90 | 109 | name: wheels
|
91 | 110 | path: dist
|
92 | 111 |
|
93 |
| - linux: |
| 112 | + release: |
| 113 | + needs: [build] |
| 114 | + if: "startsWith(github.ref, 'refs/tags/')" |
94 | 115 | runs-on: ubuntu-latest
|
95 |
| - strategy: |
96 |
| - matrix: |
97 |
| - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] |
98 |
| - target: [x86_64, i686] |
| 116 | + |
99 | 117 | steps:
|
100 |
| - - uses: actions/checkout@v2 |
101 |
| - - name: Install Rust toolchain |
102 |
| - uses: actions-rs/toolchain@v1 |
103 |
| - with: |
104 |
| - toolchain: stable |
105 |
| - profile: minimal |
106 |
| - default: true |
107 |
| - - name: Build |
108 |
| - run: cargo build --release |
109 |
| - - uses: actions/setup-python@v2 |
110 |
| - with: |
111 |
| - python-version: ${{ matrix.python-version }} |
112 |
| - - name: Build Wheels |
113 |
| - uses: messense/maturin-action@v1 |
| 118 | + - uses: actions/checkout@v3 |
| 119 | + |
| 120 | + - name: set up python |
| 121 | + uses: actions/setup-python@v4 |
114 | 122 | with:
|
115 |
| - target: ${{ matrix.target }} |
116 |
| - manylinux: auto |
117 |
| - args: -i python${{ matrix.python-version }} --release --out dist |
118 |
| - - name: Python UnitTest |
119 |
| - if: matrix.target == 'x86_64' |
120 |
| - run: | |
121 |
| - pip install python-calamine --no-index --find-links dist --force-reinstall |
122 |
| - rm -rf python_calamine |
123 |
| - pip install pytest |
124 |
| - pytest |
125 |
| - - name: Upload wheels |
126 |
| - uses: actions/upload-artifact@v2 |
| 123 | + python-version: '3.10' |
| 124 | + |
| 125 | + - run: pip install -U twine |
| 126 | + |
| 127 | + - name: get dist artifacts |
| 128 | + uses: actions/download-artifact@v3 |
127 | 129 | with:
|
128 | 130 | name: wheels
|
129 | 131 | path: dist
|
130 | 132 |
|
131 |
| - release: |
132 |
| - name: Release |
133 |
| - runs-on: ubuntu-latest |
134 |
| - if: "startsWith(github.ref, 'refs/tags/')" |
135 |
| - needs: [ macos, windows, linux ] |
136 |
| - steps: |
137 |
| - - uses: actions/download-artifact@v2 |
138 |
| - with: |
139 |
| - name: wheels |
140 |
| - - uses: actions/setup-python@v2 |
141 |
| - with: |
142 |
| - python-version: 3.9 |
143 |
| - - name: Publish to PyPi |
| 133 | + - run: twine check dist/* |
| 134 | + |
| 135 | + - name: upload to pypi |
| 136 | + run: twine upload dist/* |
144 | 137 | env:
|
145 | 138 | TWINE_USERNAME: __token__
|
146 | 139 | TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
|
147 |
| - run: | |
148 |
| - pip install --upgrade twine |
149 |
| - twine upload --skip-existing * |
0 commit comments