Skip to content

Initial commit

Initial commit #1

Workflow file for this run

# This file is autogenerated by maturin v1.7.0
# To update, run
#
# maturin generate-ci github --platform all --zig
#
name: CI
on:
push:
branches:
- main
tags:
- "*"
pull_request:
branches:
- main
permissions:
contents: read
jobs:
test:
name: Run tests
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner:
- ubuntu-latest
- macos-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:nixpkgs-24.05-darwin
- name: Generate cache key
run: |
nixpkgs_hash=$(egrep -o 'archive/[0-9a-f]{40}\.tar\.gz' shell.nix | cut -d'/' -f2 | cut -d'.' -f1)
echo "CACHE_KEY=${{ runner.os }}-$nixpkgs_hash" >> $GITHUB_ENV
- name: Cache Nix store
uses: actions/cache@v4
id: nix-cache
with:
key: nix-${{ env.CACHE_KEY }}
path: /tmp/nix-cache
- name: Import Nix store cache
if: steps.nix-cache.outputs.cache-hit == 'true'
run: |
nix-store --import < /tmp/nix-cache
- name: Cache Python packages
uses: actions/cache@v4
with:
key: python-${{ env.CACHE_KEY }}-${{ hashFiles('uv.lock') }}
path: ~/.cache/uv
- name: Assert tag name matches version
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
run: |
nix-shell --pure --run "uv tree 2>&1 | grep -o 'polyline-rs v.*' | sed 's/polyline-rs v//' > version.txt"
version=$(cat version.txt)
tag_name=${{ github.ref_name }}
if [ "$version" != "$tag_name" ]; then
echo "Tag name mismatch: $version != $tag_name"
exit 1
fi
- name: Run tests
run: |
nix-shell --pure --run run-tests
- name: Export Nix store cache
if: steps.nix-cache.outputs.cache-hit != 'true'
run: |
nix-store --export $(find /nix/store -maxdepth 1 -name '*-*') > /tmp/nix-cache
linux:
runs-on: ${{ matrix.platform.runner }}
if: "github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')"
needs: test
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist --zig
sccache: "true"
manylinux: auto
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.platform.target }}
path: dist
musllinux:
runs-on: ${{ matrix.platform.runner }}
if: "github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')"
needs: test
strategy:
matrix:
platform:
- runner: ubuntu-latest
target: x86_64
- runner: ubuntu-latest
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist
sccache: "true"
manylinux: musllinux_1_2
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-musllinux-${{ matrix.platform.target }}
path: dist
windows:
runs-on: ${{ matrix.platform.runner }}
if: "github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')"
needs: test
strategy:
matrix:
platform:
- runner: windows-latest
target: x64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
architecture: ${{ matrix.platform.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-windows-${{ matrix.platform.target }}
path: dist
macos:
runs-on: ${{ matrix.platform.runner }}
if: "github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')"
needs: test
strategy:
matrix:
platform:
- runner: macos-12
target: x86_64
- runner: macos-14
target: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-macos-${{ matrix.platform.target }}
path: dist
sdist:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist
release:
name: Release
runs-on: ubuntu-latest
if: "github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')"
needs: [linux, musllinux, windows, macos, sdist]
environment:
name: pypi
url: https://pypi.org/p/polyline-rs
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheels-*
path: dist
merge-multiple: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1