-
Notifications
You must be signed in to change notification settings - Fork 20
173 lines (152 loc) · 4.68 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: CI
on:
release:
types: [created]
push:
schedule:
# Runs every Thursday at 20:23 GMT to avoid bit rot
- cron: "20 23 * * 4"
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
- name: Lint with rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
- name: Lint with clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --all-features
- name: Test with cargo
uses: actions-rs/[email protected]
with:
command: test
toolchain: stable
native-build:
runs-on: ${{ matrix.os }}
needs: lint
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Run image
uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.3.2
- name: Install package deps
run: |
poetry install
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install Rust aarch64-apple-darwin target
if: matrix.os == 'macos-latest'
run: rustup target add aarch64-apple-darwin
- name: Build on macOS universal2
if: matrix.os == 'macos-latest'
shell: bash
env:
DEVELOPER_DIR: /Applications/Xcode.app/Contents/Developer
MACOSX_DEPLOYMENT_TARGET: "10.9"
ARCHFLAGS: -arch x86_64 -arch arm64
PYO3_CROSS_LIB_DIR: /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib
run: poetry run python setup.py bdist_wheel && poetry install
- name: Build Python package
if: matrix.os != 'macos-latest'
run: poetry run python setup.py bdist_wheel && poetry install
- name: pytest
run: poetry run pytest tests
- name: archive wheels
uses: actions/upload-artifact@v2
if: matrix.os != 'ubuntu-latest'
with:
name: wheels
path: dist/*.whl
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && matrix.os != 'ubuntu-latest'
with:
files: dist/sqloxide*.whl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
manylinux-build:
if: true
strategy:
fail-fast: false
matrix:
include:
- { tag: manylinux2014, arch: x86_64 }
- { tag: manylinux2014, arch: i686 }
# TODO: figure out a way to renable these, for now far too slow
# to run in github actions (> 6hrs)
# - {tag: manylinux2014, arch: ppc64le}
# - {tag: manylinux2014, arch: aarch64}
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v2
with:
path: io
- name: Set up QEMU for multi-arch build
uses: docker/setup-qemu-action@v1
- name: Build Wheels
run: >-
docker run --rm
-e PLAT=${{ matrix.tag }}_${{ matrix.arch }}
-e PACKAGE_NAME=sqloxide
-v `pwd`:/io
--workdir /io
quay.io/pypa/${{ matrix.tag }}_${{ matrix.arch }}
io/build-wheels.sh
- name: Archive Wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: io/dist/*${{ matrix.tag }}_${{ matrix.arch }}.whl
source-build:
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v2
- name: Build source distribution
run: |
pip install -U setuptools wheel setuptools-rust
python setup.py sdist
- name: Archive source distribution
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist/*
publish:
runs-on: ubuntu-latest
needs: [manylinux-build, native-build, source-build]
steps:
- uses: actions/download-artifact@v2
with:
name: wheels
path: dist/
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@master
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
with:
user: __token__
password: ${{ secrets.PYPI }}
skip_existing: true