-
Notifications
You must be signed in to change notification settings - Fork 26
100 lines (95 loc) · 3.03 KB
/
bindings.python.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
name: Bindings Python
on:
push:
branches:
- main
tags:
- v*
pull_request:
branches:
- main
paths:
- 'sql/**'
- 'bindings/python/**'
- ".github/workflows/bindings.python.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: ./.github/actions/setup
with:
cache-key: bindings-python
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pipenv'
cache-dependency-path: 'bindings/python/Pipfile.lock'
- name: Install pipenv
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
- name: Install dependencies
working-directory: bindings/python
run: pipenv install --dev
- name: Check format
working-directory: bindings/python
run: pipenv run black --check .
- name: Setup develop
working-directory: bindings/python
run: pipenv run maturin develop
- name: Test
run: make -C tests test-bindings-python
build:
name: build-${{ matrix.os }}-${{ matrix.arch }}
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- { os: linux, arch: x86_64, target: x86_64-unknown-linux-gnu, runner: ubuntu-20.04 }
# - { os: linux, arch: aarch64, target: aarch64-unknown-linux-gnu, runner: ubuntu-20.04 }
- { os: windows, arch: x86_64, target: x86_64-pc-windows-msvc, runner: windows-2019 }
- { os: macos, arch: x86_64, target: x86_64-apple-darwin, runner: macos-11 }
- { os: macos, arch: aarch64, target: aarch64-apple-darwin, runner: macos-11 }
steps:
- uses: actions/checkout@v4
- name: Get opts
id: opts
shell: bash
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "BUILD_ARGS=--strip --out dist" >> $GITHUB_OUTPUT
else
echo "BUILD_ARGS=--release --strip --out dist" >> $GITHUB_OUTPUT
fi
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
working-directory: bindings/python
target: ${{ matrix.target }}
sccache: 'true'
args: ${{ steps.opts.outputs.BUILD_ARGS }}
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: dist
path: bindings/python/dist/*.whl
publish:
if: startsWith(github.ref, 'refs/tags/v')
needs: [build, integration]
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
environment:
name: pypi.org
url: https://pypi.org/p/databend-driver/
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
- uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true