Try other

This commit is contained in:
Charlie Marsh 2022-08-29 15:41:09 -04:00
parent bacfc359a6
commit 197d2779c9
4 changed files with 279 additions and 202 deletions

122
.github/workflows/ci.yaml vendored Normal file
View File

@ -0,0 +1,122 @@
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
cargo_build:
name: "cargo build"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions/cache@v3
env:
cache-name: cache-cargo
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: cargo build --release
cargo_fmt:
name: "cargo fmt"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions/cache@v3
env:
cache-name: cache-cargo
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: cargo fmt --check
cargo_clippy:
name: "cargo clippy"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions/cache@v3
env:
cache-name: cache-cargo
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: cargo clippy -- -D warnings
cargo_test:
name: "cargo test"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions/cache@v3
env:
cache-name: cache-cargo
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: cargo test
maturin_build:
name: "maturin build"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- run: pip install maturin
- uses: actions/cache@v3
env:
cache-name: cache-cargo
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: maturin build -b bin

View File

@ -1,231 +1,189 @@
name: Release name: Release
on: on:
pull_request: create:
branches: tags:
- main - v*
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
PACKAGE_NAME: ruff
PYTHON_VERSION: "3.10"
jobs: jobs:
# macos: macos:
# runs-on: macos-latest runs-on: macos-latest
# strategy:
# matrix:
# python: ["3.7", "3.8", "3.9", "3.10"]
# target: [x86_64, aarch64]
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python }}
# architecture: x64
# - name: Install Rust toolchain
# uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# profile: minimal
# default: true
# - name: Build wheels
# uses: messense/maturin-action@v1
# with:
# target: ${{ matrix.target }}
# args: -i ${{ matrix.python }} --release --out dist --sdist
# maturin-version: "latest"
# - name: Install built wheel
# if: matrix.target == 'x86_64'
# run: |
# pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
# - name: Upload wheels
# uses: actions/upload-artifact@v2
# with:
# name: wheels
# path: dist
#
# windows:
# runs-on: windows-latest
# strategy:
# matrix:
# python: ["3.7", "3.8", "3.9", "3.10"]
# target: [x64, x86]
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python }}
# architecture: ${{ matrix.target }}
# - name: Install Rust toolchain
# uses: actions-rs/toolchain@v1
# with:
# toolchain: stable
# profile: minimal
# default: true
# - name: Build wheels
# uses: messense/maturin-action@v1
# with:
# target: ${{ matrix.target }}
# args: -i ${{ matrix.python }} --release --out dist
# maturin-version: "latest"
# - name: Install built wheel
# shell: bash
# run: |
# python -m pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
# - name: Upload wheels
# uses: actions/upload-artifact@v2
# with:
# name: wheels
# path: dist
#
# linux:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# python: ["3.7", "3.8", "3.9", "3.10"]
# target: [x86_64, i686]
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python }}
# architecture: x64
# - name: Build wheels
# uses: messense/maturin-action@v1
# with:
# target: ${{ matrix.target }}
# manylinux: auto
# args: -i ${{ matrix.python }} --release --out dist
# maturin-version: "latest"
# - name: Install built wheel
# if: matrix.target == 'x86_64'
# run: |
# pip install dist/${{ env.PACKAGE_NAME }}-*.whl --force-reinstall
# - name: Upload wheels
# uses: actions/upload-artifact@v2
# with:
# name: wheels
# path: dist
linux-cross:
runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
target: [aarch64, armv7] python-version: ['3.7', '3.8', '3.9', '3.10']
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- uses: actions/setup-python@v4 - uses: actions/setup-python@v2
with: with:
python-version: ${{ env.PYTHON_VERSION }} python-version: ${{ matrix.python-version }}
- name: Build wheels - name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: aarch64-apple-darwin
profile: minimal
default: true
- name: Build
run: cargo build --release
- name: Tests
run: cargo test --no-default-features --release
- name: Build wheels - x86_64
uses: messense/maturin-action@v1 uses: messense/maturin-action@v1
with: with:
target: ${{ matrix.target }} target: x86_64
manylinux: auto args: -i python --release --out dist --sdist
args: -i ${{ env.PYTHON_VERSION }} --release --out dist - name: Install built wheel - x86_64
maturin-version: "latest" run: |
pip install ruff --no-index --find-links dist --force-reinstall
- name: Build wheels - universal2
if: ${{ matrix.python-version >= '3.8' || matrix.python-version == '3.10' }}
uses: messense/maturin-action@v1
with:
args: -i python --release --universal2 --out dist
- name: Install built wheel - universal2
if: ${{ matrix.python-version >= '3.8' }}
run: |
pip install ruff --no-index --find-links dist --force-reinstall
- name: Upload wheels - name: Upload wheels
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: wheels name: wheels
path: dist path: dist
# musllinux: windows:
# runs-on: ubuntu-latest runs-on: windows-latest
# strategy: strategy:
# matrix: matrix:
# target: python-version: ['3.7', '3.8', '3.9', '3.10']
# - x86_64-unknown-linux-musl target: [x64, x86]
# - i686-unknown-linux-musl steps:
# steps: - uses: actions/checkout@v2
# - uses: actions/checkout@v3 - uses: actions/setup-python@v2
# - uses: actions/setup-python@v4 with:
# with: python-version: ${{ matrix.python-version }}
# python-version: ${{ env.PYTHON_VERSION }} architecture: ${{ matrix.target }}
# architecture: x64 - name: Update rustup
# - name: Build wheels run: rustup self update
# uses: messense/maturin-action@v1 - name: Install Rust toolchain
# with: uses: actions-rs/toolchain@v1
# target: ${{ matrix.target }} with:
# manylinux: musllinux_1_2 toolchain: stable
# args: -i ${{ env.PYTHON_VERSION }} --release --out dist profile: minimal
# maturin-version: "latest" default: true
# - name: Install built wheel - name: Build
# if: matrix.target == 'x86_64-unknown-linux-musl' if: matrix.target == 'x64'
# uses: addnab/docker-run-action@v3 run: cargo build --release
# with: - name: Tests
# image: alpine:latest if: matrix.target == 'x64'
# options: -v ${{ github.workspace }}:/io -w /io run: cargo test --no-default-features --release
# run: | - name: Build wheels
# apk add py3-pip uses: messense/maturin-action@v1
# pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links /io/dist/ --force-reinstall with:
# - name: Upload wheels target: ${{ matrix.target }}
# uses: actions/upload-artifact@v2 args: -i python --release --out dist
# with: - name: Install built wheel
# name: wheels run: |
# path: dist pip install ruff --no-index --find-links dist --force-reinstall
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist
# musllinux-cross: linux:
# runs-on: ubuntu-latest runs-on: ubuntu-latest
# strategy: strategy:
# matrix: matrix:
# platform: python-version: ['3.7', '3.8', '3.9', '3.10']
# - target: aarch64-unknown-linux-musl target: [x86_64, i686]
# arch: aarch64 steps:
# - target: armv7-unknown-linux-musleabihf - uses: actions/checkout@v2
# arch: armv7 - name: Install Rust toolchain
# steps: uses: actions-rs/toolchain@v1
# - uses: actions/checkout@v3 with:
# - uses: actions/setup-python@v4 toolchain: stable
# with: profile: minimal
# python-version: ${{ env.PYTHON_VERSION }} default: true
# - name: Build wheels - name: Build
# uses: messense/maturin-action@v1 run: cargo build --release
# with: - name: Tests
# target: ${{ matrix.platform.target }} run: cargo test --no-default-features --release
# manylinux: musllinux_1_2 - uses: actions/setup-python@v2
# args: -i ${{ env.PYTHON_VERSION }} --release --out dist with:
# maturin-version: "latest" python-version: ${{ matrix.python-version }}
# - uses: uraimo/run-on-arch-action@master - name: Build Wheels
# name: Install built wheel uses: messense/maturin-action@v1
# with: with:
# arch: ${{ matrix.platform.arch }} target: ${{ matrix.target }}
# distro: alpine_latest manylinux: auto
# githubToken: ${{ github.token }} args: -i ${{ matrix.python-version }} --release --out dist
# install: | - name: Install built wheel
# apk add py3-pip if: matrix.target == 'x86_64'
# run: | run: |
# pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links dist/ --force-reinstall pip install ruff --no-index --find-links dist --force-reinstall
# - name: Upload wheels - name: Upload wheels
# uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
# with: with:
# name: wheels name: wheels
# path: dist path: dist
linux-cross:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
target: [aarch64, armv7, s390x, ppc64le]
steps:
- uses: actions/checkout@v2
- name: Build Wheels
uses: messense/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: auto
args: -i ${{ matrix.python-version }} --release --out dist
- uses: uraimo/run-on-arch-action@v2.2.0
name: Install built wheel
with:
arch: ${{ matrix.target }}
distro: ubuntu20.04
githubToken: ${{ github.token }}
# Mount the dist directory as /artifacts in the container
dockerRunArgs: |
--volume "${PWD}/dist:/artifacts"
install: |
apt-get update
apt-get install -y --no-install-recommends python3 python3-venv software-properties-common
add-apt-repository ppa:deadsnakes/ppa
apt-get update
apt-get install -y curl python3.7-venv python3.9-venv python3.10-venv
run: |
ls -lrth /artifacts
PYTHON=python${{ matrix.python-version }}
$PYTHON -m venv venv
venv/bin/pip install -U pip
venv/bin/pip install ruff --no-index --find-links /artifacts --force-reinstall
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist
release: release:
name: Release name: Release
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: if: "startsWith(github.ref, 'refs/tags/')"
# - musllinux-cross needs: [ macos, windows, linux, linux-cross ]
- linux-cross
# - macos
# - windows
# - linux
# if: ${{ github.ref == 'refs/heads/main' }}
steps: steps:
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v2
with: with:
name: wheels name: wheels
- uses: actions/setup-python@v2 - uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Publish to PyPi - name: Publish to PyPi
env: env:
TWINE_USERNAME: __token__ TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: | run: |
pip install --upgrade twine pip install --upgrade wheel pip setuptools twine
twine upload --skip-existing * twine upload --skip-existing *

View File

@ -17,7 +17,7 @@ colored = { version = "2.0.0" }
common-path = { version = "1.0.0" } common-path = { version = "1.0.0" }
dirs = { version = "4.0.0" } dirs = { version = "4.0.0" }
fern = { version = "0.6.1" } fern = { version = "0.6.1" }
filetime = "0.2.17" filetime = { version = "0.2.17" }
log = { version = "0.4.17" } log = { version = "0.4.17" }
notify = { version = "4.0.17" } notify = { version = "4.0.17" }
pyo3 = { version = "0.17.1", features = ["auto-initialize"] } pyo3 = { version = "0.17.1", features = ["auto-initialize"] }

View File

@ -1,3 +0,0 @@
FROM python:3.10
RUN pip install -v ruff