Skip to content

Build abi3 wheels so we don't need to build separate wheels for each platform #645

Build abi3 wheels so we don't need to build separate wheels for each platform

Build abi3 wheels so we don't need to build separate wheels for each platform #645

Workflow file for this run

name: build_test
on:
pull_request:
types: [opened, synchronize]
jobs:
rust-fmt-clippy:
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-D warnings"
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Install latest stable Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
- name: Cache rust dependencies
uses: Swatinem/rust-cache@v1
with:
cache-on-failure: True
- name: Check cargo fmt compliance
run: cargo fmt --all -- --check
- name: Check no rustc warnings
run: cargo check --tests --features=protobuf-src
- name: Check for clippy warnings
run: cargo clippy --features=protobuf-src -- -A clippy::borrow_deref_ref
test-rust:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- windows-2022
- macos-11
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Install apt system dependencies needed to build nodecanvas
run: |
sudo apt-get install -y libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++
if: ${{ runner.os == 'Linux' }}
- name: Install protoc on Window
run: |
choco install --yes protoc
if: ${{ runner.os == 'Windows' }}
- name: Install latest stable Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install node
uses: actions/setup-node@v2
with:
node-version: '17.9.0'
- name: Install test node dependencies
working-directory: vegafusion-runtime/tests/util/vegajs_runtime
run: |
npm install
- name: Run Rust Tests (Windows)
if: ${{ runner.os == 'Windows' }}
uses: actions-rs/cargo@v1
env:
CARGO_HOME: C:\cargo_home\
CARGO_TARGET_DIR: C:\cargo_target_dir\
with:
command: test
args: --workspace --exclude vegafusion-python-embed --exclude vegafusion-wasm
- name: Run Rust Tests (MacOs/Linux)
if: ${{ runner.os != 'Windows' }}
uses: actions-rs/cargo@v1
with:
command: test
args: --release --all-features --workspace --exclude vegafusion-python-embed --exclude vegafusion-wasm
- name: Upload test artifacts
uses: actions/upload-artifact@v2
if: always()
with:
name: vegafusion-rt-test-images
path: |
vegafusion-runtime/tests/output
build-vegafusion-server:
strategy:
matrix:
options: [
[ubuntu-latest, linux-64],
[windows-2022, win-64],
[macos-11, osx-64],
[macos-11, osx-arm64],
]
runs-on: ${{ matrix.options[0] }}
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Install protoc on Window
run: |
choco install --yes protoc
if: ${{ runner.os == 'Windows' }}
- name: Install latest stable Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Cache rust dependencies
uses: Swatinem/rust-cache@v1
with:
cache-on-failure: True
- name: Download Apple Silicon toolchain
if: ${{ matrix.options[1] == 'osx-arm64' }}
run: |
rustup target add aarch64-apple-darwin
- name: Build vegafusion-server (Windows)
uses: actions-rs/cargo@v1
if: ${{ runner.os == 'Windows' }}
with:
command: build
args: -p vegafusion-server --release
- name: Build vegafusion-server (Mac/Linux)
uses: actions-rs/cargo@v1
if: ${{ matrix.options[1] != 'osx-arm64' && runner.os != 'Windows'}}
with:
command: build
args: -p vegafusion-server --release --features=protobuf-src
- name: Build vegafusion-server (Apple Silicon)
uses: actions-rs/cargo@v1
if: ${{ matrix.options[1] == 'osx-arm64' }}
with:
command: build
args: -p vegafusion-server --release --target aarch64-apple-darwin --features=protobuf-src
- name: zip executable (Windows)
uses: papeloto/action-zip@v1
if: runner.os == 'Windows'
with:
files: target/release/vegafusion-server.exe
dest: vegafusion-server-${{ matrix.options[1] }}.zip
- name: zip executable (Mac or Linux)
uses: papeloto/action-zip@v1
if: ${{ matrix.options[1] != 'osx-arm64' && runner.os != 'Windows'}}
with:
files: target/release/vegafusion-server
dest: vegafusion-server-${{ matrix.options[1] }}.zip
- name: zip executable (Apple silicon)
uses: papeloto/action-zip@v1
if: ${{ matrix.options[1] == 'osx-arm64'}}
with:
files: target/aarch64-apple-darwin/release/vegafusion-server
dest: vegafusion-server-${{ matrix.options[1] }}.zip
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: vegafusion-server
path: |
vegafusion-server-*
build-vegafusion-python-embed:
runs-on: ${{ matrix.options[0] }}
strategy:
matrix:
options:
- [ubuntu-latest, linux-64]
- [windows-2022, win-64]
- [macos-11, osx-64]
- [macos-11, osx-arm64]
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Install protoc on Window
if: ${{ runner.os == 'Windows' }}
run: |
choco install --yes protoc
- name: Install latest stable Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Cache rust dependencies
uses: Swatinem/rust-cache@v1
with:
cache-on-failure: True
- name: Download Apple Silicon toolchain
if: ${{ matrix.options[1] == 'osx-arm64' }}
run: |
rustup target add aarch64-apple-darwin
- name: Build wheels (Windows)
if: ${{ runner.os == 'Windows'}}
uses: messense/maturin-action@v1
with:
maturin-version: 0.12.20
command: build
manylinux: 2014
rust-toolchain: stable
args: --release -m vegafusion-python-embed/Cargo.toml --strip
- name: Build wheels (Mac/Linux)
if: ${{ matrix.options[1] != 'osx-arm64' && runner.os != 'Windows'}}
uses: messense/maturin-action@v1
with:
maturin-version: 0.13.6
command: build
manylinux: 2014
rust-toolchain: stable
args: --release -m vegafusion-python-embed/Cargo.toml --features=protobuf-src --strip
- name: Build Apple Silicon wheels
if: ${{ matrix.options[1] == 'osx-arm64' }}
uses: messense/maturin-action@v1
with:
maturin-version: 0.13.6
command: build
rust-toolchain: stable
args: --release -m vegafusion-python-embed/Cargo.toml --features=protobuf-src --strip --target aarch64-apple-darwin
- name: Remove unwanted universal
if: ${{ runner.os == 'macOS' }}
run: |
rm -rf target/wheels/*universal2*.whl
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: vegafusion-python-embed-wheels
path: |
target/wheels/*.tar.gz
target/wheels/*cp37*.whl
target/wheels/*cp38*.whl
target/wheels/*cp39*.whl
target/wheels/*cp310*.whl
target/wheels/*cp311*.whl
build-vegafusion-wasm:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Install node
uses: actions/setup-node@v2
with:
node-version: '17.9.0'
- name: Build package
working-directory: vegafusion-wasm/
run: |
npm run build:protobuf-src
wasm-pack pack
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: vegafusion-wasm-packages
path: vegafusion-wasm/pkg
build-vegafusion-wheel:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Check out repository code
uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
activate-environment: vegafusion_dev
miniforge-version: latest
environment-file: python/vegafusion-jupyter/conda-linux-64-cp310.lock
- name: Build vegafusion
working-directory: python/vegafusion
run: |
python setup.py sdist bdist_wheel
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: vegafusion-wheel
path: |
python/vegafusion/dist/*.whl
python/vegafusion/dist/*.tar.gz
build-vegafusion-jupyter-package:
needs: [build-vegafusion-wheel, build-vegafusion-wasm]
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Check out repository code
uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
activate-environment: vegafusion_dev
miniforge-version: latest
environment-file: python/vegafusion-jupyter/conda-linux-64-cp310.lock
- name: Download vegafusion-wasm packages
uses: actions/download-artifact@v2
with:
name: vegafusion-wasm-packages
path: vegafusion-wasm/pkg
- name: Build vegafusion-embed
working-directory: javascript/vegafusion-embed/
run: |
npm install
npm run build
- name: Download vegafusion wheel
uses: actions/download-artifact@v2
with:
name: vegafusion-wheel
path: target/wheels/
- name: Install vegafusion wheel
run: |
python -m pip install target/wheels/vegafusion-*.whl
- name: Install vegafusion-wasm npm dependencies
working-directory: vegafusion-wasm/
run: |
npm install
- name: Build vegafusion-jupyter
working-directory: python/vegafusion-jupyter
run: |
python setup.py sdist bdist_wheel
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: vegafusion-jupyter-packages
path: |
python/vegafusion-jupyter/dist/*.whl
python/vegafusion-jupyter/dist/*.tar.gz
test-vegafusion-python:
needs: [ build-vegafusion-wheel, build-vegafusion-jupyter-package ]
strategy:
matrix:
options: [
[ubuntu-latest, linux-64, "bash -l {0}", cp38, "vegafusion-jupyter"],
[ubuntu-latest, linux-64, "bash -l {0}", cp38, "vegafusion"],
[ubuntu-latest, linux-64, "bash -l {0}", cp310, "vegafusion-jupyter"],
[ubuntu-latest, linux-64, "bash -l {0}", cp310, "vegafusion"],
# TODO: Should vegafusion-jupyter tests on Windows and Mac as well, but there a selenium+GitHub action issue
# [windows-2022, win-64, "pwsh", cp38, "vegafusion"],
# [macos-11, osx-64, "bash -l {0}", cp310, "vegafusion"],
# [windows-2022, win-64, "pwsh", cp38, "vegafusion-jupyter"],
# [macos-11, osx-64, "bash -l {0}", cp310, "vegafusion-jupyter"],
]
runs-on: ${{ matrix.options[0] }}
defaults:
run:
shell: ${{ matrix.options[2] }}
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Create conda test environment
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
activate-environment: vegafusion_dev
miniforge-version: latest
environment-file: python/vegafusion-jupyter/conda-${{ matrix.options[1] }}-${{ matrix.options[3] }}.lock
- name: Install protoc on Window
run: |
choco install --yes protoc
if: ${{ runner.os == 'Windows' }}
- name: Install latest stable Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Cache rust dependencies
uses: Swatinem/rust-cache@v1
with:
cache-on-failure: True
- name: Build vegafusion-python-embed in development mode (Non-windows)
run: |
maturin develop --release --features=protobuf-src -m vegafusion-python-embed/Cargo.toml
if: ${{ runner.os != 'Windows' }}
- name: Build vegafusion-python-embed in development mode (Windows)
run: |
maturin develop --release -m vegafusion-python-embed/Cargo.toml
if: ${{ runner.os == 'Windows' }}
- name: Install Chrome
uses: browser-actions/setup-chrome@latest
with:
chrome-version: stable
- name: Install ChromeDriver
run: |
pip install chromedriver-binary-auto
- name: Download vegafusion wheel
uses: actions/download-artifact@v2
with:
name: vegafusion-wheel
path: target/wheels/
- name: Download vegafusion-jupyter wheel
uses: actions/download-artifact@v2
with:
name: vegafusion-jupyter-packages
path: target/wheels/
- name: install wheels
working-directory: target/wheels/
run: |
ls -la
python -m pip install vegafusion-*.whl
python -m pip install vegafusion_jupyter*.whl
python -m pip install vl-convert-python==0.10.3
- name: Update to latest Altair 5
run: |
pip install -U altair
- name: Test vegafusion
working-directory: python/vegafusion/
run: pytest
if: ${{ matrix.options[4] == 'vegafusion' }}
- name: Test vegafusion-jupyter
env:
VEGAFUSION_TEST_HEADLESS: 1
working-directory: python/vegafusion-jupyter/tests/
run: pytest
if: ${{ matrix.options[5] == 'vegafusion-jupyter' }}
- name: Upload test artifacts
uses: actions/upload-artifact@v2
if: always()
with:
name: vegafusion-jupyter-test-failures
path: |
python/vegafusion-jupyter/tests/failures/*