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
on:
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
PACKAGE_NAME: ruff
PYTHON_VERSION: "3.10"
create:
tags:
- v*
jobs:
# macos:
# 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
macos:
runs-on: macos-latest
strategy:
matrix:
target: [aarch64, armv7]
python-version: ['3.7', '3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Build wheels
python-version: ${{ matrix.python-version }}
- 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
with:
target: ${{ matrix.target }}
manylinux: auto
args: -i ${{ env.PYTHON_VERSION }} --release --out dist
maturin-version: "latest"
target: x86_64
args: -i python --release --out dist --sdist
- name: Install built wheel - x86_64
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
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist
# musllinux:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# target:
# - x86_64-unknown-linux-musl
# - i686-unknown-linux-musl
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-python@v4
# with:
# python-version: ${{ env.PYTHON_VERSION }}
# architecture: x64
# - name: Build wheels
# uses: messense/maturin-action@v1
# with:
# target: ${{ matrix.target }}
# manylinux: musllinux_1_2
# args: -i ${{ env.PYTHON_VERSION }} --release --out dist
# maturin-version: "latest"
# - name: Install built wheel
# if: matrix.target == 'x86_64-unknown-linux-musl'
# uses: addnab/docker-run-action@v3
# with:
# image: alpine:latest
# options: -v ${{ github.workspace }}:/io -w /io
# run: |
# apk add py3-pip
# pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links /io/dist/ --force-reinstall
# - name: Upload wheels
# uses: actions/upload-artifact@v2
# with:
# name: wheels
# path: dist
windows:
runs-on: windows-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
target: [x64, x86]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.target }}
- name: Update rustup
run: rustup self update
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- name: Build
if: matrix.target == 'x64'
run: cargo build --release
- name: Tests
if: matrix.target == 'x64'
run: cargo test --no-default-features --release
- name: Build wheels
uses: messense/maturin-action@v1
with:
target: ${{ matrix.target }}
args: -i python --release --out dist
- name: Install built wheel
run: |
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:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# platform:
# - target: aarch64-unknown-linux-musl
# arch: aarch64
# - target: armv7-unknown-linux-musleabihf
# arch: armv7
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-python@v4
# with:
# python-version: ${{ env.PYTHON_VERSION }}
# - name: Build wheels
# uses: messense/maturin-action@v1
# with:
# target: ${{ matrix.platform.target }}
# manylinux: musllinux_1_2
# args: -i ${{ env.PYTHON_VERSION }} --release --out dist
# maturin-version: "latest"
# - uses: uraimo/run-on-arch-action@master
# name: Install built wheel
# with:
# arch: ${{ matrix.platform.arch }}
# distro: alpine_latest
# githubToken: ${{ github.token }}
# install: |
# apk add py3-pip
# run: |
# pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links dist/ --force-reinstall
# - name: Upload wheels
# uses: actions/upload-artifact@v2
# with:
# name: wheels
# path: dist
linux:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
target: [x86_64, i686]
steps:
- uses: actions/checkout@v2
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- name: Build
run: cargo build --release
- name: Tests
run: cargo test --no-default-features --release
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Build Wheels
uses: messense/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: auto
args: -i ${{ matrix.python-version }} --release --out dist
- name: Install built wheel
if: matrix.target == 'x86_64'
run: |
pip install ruff --no-index --find-links dist --force-reinstall
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
name: wheels
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:
name: Release
runs-on: ubuntu-latest
needs:
# - musllinux-cross
- linux-cross
# - macos
# - windows
# - linux
# if: ${{ github.ref == 'refs/heads/main' }}
if: "startsWith(github.ref, 'refs/tags/')"
needs: [ macos, windows, linux, linux-cross ]
steps:
- uses: actions/download-artifact@v2
with:
name: wheels
- uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Publish to PyPi
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
pip install --upgrade twine
pip install --upgrade wheel pip setuptools twine
twine upload --skip-existing *

View File

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

View File

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