8000 Add GitHub workflows and remove rust-toolchain file (#15) · nirnayroy/datafusion-python@a1e1e97 · GitHub
[go: up one dir, main page]

Skip to content

Commit a1e1e97

Browse files
authored
Add GitHub workflows and remove rust-toolchain file (apache#15)
* add workflows * change branch name
1 parent 1d221b2 commit a1e1e97

File tree

3 files changed

+233
-1
lines changed

3 files changed

+233
-1
lines changed

.github/workflows/build.yml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: Python Release Build
19+
on:
20+
push:
21+
tags: ["*-rc*"]
22+
branches: ["master"]
23+
24+
jobs:
25+
generate-license:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v2
29+
- uses: actions-rs/toolchain@v1
30+
with:
31+
profile: minimal
32+
toolchain: stable
33+
override: true
34+
- name: Generate license file
35+
run: python ./dev/create_license.py
36+
- uses: actions/upload-artifact@v2
37+
with:
38+
name: python-wheel-license
39+
path: LICENSE.txt
40+
41+
build-python-mac-win:
42+
needs: [generate-license]
43+
name: Mac/Win
44+
runs-on: ${{ matrix.os }}
45+
strategy:
46+
fail-fast: false
47+
matrix:
48+
python-version: ["3.10"]
49+
os: [macos-latest, windows-latest]
50+
steps:
51+
- uses: actions/checkout@v2
52+
53+
- uses: actions/setup-python@v2
54+
with:
55+
python-version: ${{ matrix.python-version }}
56+
57+
- uses: actions-rs/toolchain@v1
58+
with:
59+
toolchain: stable
60+
61+
- name: Install dependencies
62+
run: |
63+
python -m pip install --upgrade pip
64+
pip install maturin==0.12.10
65+
66+
- run: rm LICENSE.txt
67+
- name: Download LICENSE.txt
68+
uses: actions/download-artifact@v2
69+
with:
70+
name: python-wheel-license
71+
path: .
72+
73+
- name: Build Python package
74+
run: maturin build --release --strip --cargo-extra-args="--locked"
75+
76+
- name: List Windows wheels
77+
if: matrix.os == 'windows-latest'
78+
run: dir target\wheels\
79+
80+
- name: List Mac wheels
81+
if: matrix.os != 'windows-latest'
82+
run: find target/wheels/
83+
84+
- name: Archive wheels
85+
uses: actions/upload-artifact@v2
86+
with:
87+
name: dist
88+
path: target/wheels/*
89+
90+
build-manylinux:
91+
needs: [generate-license]
92+
name: Manylinux
93+
runs-on: ubuntu-latest
94+
steps:
95+
- uses: actions/checkout@v2
96+
- run: rm LICENSE.txt
97+
- name: Download LICENSE.txt
98+
uses: actions/download-artifact@v2
99+
with:
100+
name: python-wheel-license
101+
path: .
102+
- run: cat LICENSE.txt
103+
- name: Build wheels
104+
run: |
105+
export RUSTFLAGS='-C target-cpu=skylake'
106+
docker run --rm -v $(pwd):/io \
107+
--workdir /io \
108+
konstin2/maturin:v0.12.10 \
109+
build --release --manylinux 2010 --cargo-extra-args="--locked"
110+
- name: Archive wheels
111+
uses: actions/upload-artifact@v2
112+
with:
113+
name: dist
114+
path: target/wheels/*
115+
116+
# NOTE: PyPI publish needs to be done manually for now after release passed the vote
117+
# release:
118+
# name: Publish in PyPI
119+
# needs: [build-manylinux, build-python-mac-win]
120+
# runs-on: ubuntu-latest
121+
# steps:
122+
# - uses: actions/download-artifact@v2
123+
# - name: Publish to PyPI
124+
# uses: pypa/gh-action-pypi-publish@master
125+
# with:
126+
# user: __token__
127+
# password: ${{ secrets.pypi_password }}

.github/workflows/test.yaml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: Python test
19+
on:
20+
push:
21+
branches: [master]
22+
pull_request:
23+
branches: [master]
24+
25+
concurrency:
26+
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
27+
cancel-in-progress: true
28+
29+
jobs:
30+
test-matrix:
31+
runs-on: ubuntu-latest
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
python-version:
36+
- "3.10"
37+
toolchain:
38+
- "stable"
39+
- "beta"
40+
# we are not that much eager in walking on the edge yet
41+
# - nightly
42+
# build stable for only 3.7
43+
include:
44+
- python-version: "3.7"
45+
toolchain: "stable"
46+
steps:
47+
- uses: actions/checkout@v2
48+
49+
- name: Setup Rust Toolchain
50+
uses: actions-rs/toolchain@v1
51+
id: rust-toolchain
52+
with:
53+
toolchain: ${{ matrix.toolchain }}
54+
override: true
55+
56+
- name: Setup Python
57+
uses: actions/setup-python@v2
58+
with:
59+
python-version: ${{ matrix.python-version }}
60+
61+
- name: Cache Cargo
62+
uses: actions/cache@v2
63+
with:
64+
path: ~/.cargo
65+
key: cargo-cache-${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('Cargo.lock') }}
66+
67+
- name: Check Formatting
68+
uses: actions-rs/cargo@v1
69+
if: ${{ matrix.python-version == '3.10' && matrix.toolchain == 'stable' }}
70+
with:
71+
command: fmt
72+
args: -- --check
73+
74+
- name: Run Clippy
75+
uses: actions-rs/cargo@v1
76+
if: ${{ matrix.python-version == '3.10' && matrix.toolchain == 'stable' }}
77+
with:
78+
command: clippy
79+
args: --all-targets --all-features -- -D clippy::all
80+
81+
- name: Create Virtualenv (3.10)
82+
if: ${{ matrix.python-version == '3.10' }}
83+
run: |
84+
python -m venv venv
85+
source venv/bin/activate
86+
pip install -r requirements-310.txt
87+
88+
- name: Create Virtualenv (3.7)
89+
if: ${{ matrix.python-version == '3.7' }}
90+
run: |
91+
python -m venv venv
92+
source venv/bin/activate
93+
pip install -r requirements-37.txt
94+
95+
- name: Run Python Linters
96+
if: ${{ matrix.python-version == '3.10' && matrix.toolchain == 'stable' }}
97+
run: |
98+< 7958 /span>
source venv/bin/activate
99+
flake8 --exclude venv --ignore=E501
100+
black --line-length 79 --diff --check .
101+
102+
- name: Run tests
103+
run: |
104+
source venv/bin/activate
105+
maturin develop --cargo-extra-args='--locked'
106+
RUST_BACKTRACE=1 pytest -v .

rust-toolchain

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)
0