Skip to content

Commit

Permalink
General internal project improvements (#10)
Browse files Browse the repository at this point in the history
* General internal project improvements

* Update
  • Loading branch information
zakstucke authored Feb 8, 2024
1 parent a2ec7e0 commit d3535f7
Show file tree
Hide file tree
Showing 47 changed files with 857 additions and 905 deletions.
26 changes: 13 additions & 13 deletions .github/actions/install-pre-commit/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
name: install pre-commit
description: "install pre-commit but don't run it"
runs:
using: composite
steps:
- run: python -m pip install pre-commit
shell: bash
- run: python -m pip freeze --local
shell: bash
- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Make sure pre-commit installed and up to date
shell: bash
run: pre-commit install --install-hooks
using: composite
steps:
- run: python -m pip install pre-commit
shell: bash
- run: python -m pip freeze --local
shell: bash
- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Make sure pre-commit installed and up to date
shell: bash
run: pre-commit install --install-hooks
1 change: 0 additions & 1 deletion .github/labels.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
# Labels names are important as they are used by Release Drafter to decide
# regarding where to record them in changelog or if to skip them.
#
Expand Down
52 changes: 26 additions & 26 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
categories:
- title: ":boom: Breaking Changes"
label: "breaking"
- title: ":rocket: Features"
label: "enhancement"
- title: ":fire: Removals and Deprecations"
label: "removal"
- title: ":beetle: Fixes"
label: "bug"
- title: ":racehorse: Performance"
label: "performance"
- title: ":rotating_light: Testing"
label: "testing"
- title: ":construction_worker: Continuous Integration"
label: "ci"
- title: ":books: Documentation"
label: "documentation"
- title: ":hammer: Refactoring"
label: "refactoring"
- title: ":lipstick: Style"
label: "style"
- title: ":package: Dependencies"
labels:
- "dependencies"
- "build"
- title: ":boom: Breaking Changes"
label: "breaking"
- title: ":rocket: Features"
label: "enhancement"
- title: ":fire: Removals and Deprecations"
label: "removal"
- title: ":beetle: Fixes"
label: "bug"
- title: ":racehorse: Performance"
label: "performance"
- title: ":rotating_light: Testing"
label: "testing"
- title: ":construction_worker: Continuous Integration"
label: "ci"
- title: ":books: Documentation"
label: "documentation"
- title: ":hammer: Refactoring"
label: "refactoring"
- title: ":lipstick: Style"
label: "style"
- title: ":package: Dependencies"
labels:
- "dependencies"
- "build"
template: |
## Changes
## Changes
$CHANGES
$CHANGES
40 changes: 20 additions & 20 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@ name: Labeler

# Run when the main branch is updated: (i.e. PR merged)
on:
push:
branches:
- "main"
paths:
- ".github/labels.yml"
- ".github/workflows/labeler.yml"
push:
branches:
- "main"
paths:
- ".github/labels.yml"
- ".github/workflows/labeler.yml"

jobs:
labeler:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- name: Check out the repository
uses: actions/checkout@v4
labeler:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- name: Check out the repository
uses: actions/checkout@v4

- name: Run Labeler
uses: crazy-max/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
yaml-file: .github/labels.yml
skip-delete: true
- name: Run Labeler
uses: crazy-max/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
yaml-file: .github/labels.yml
skip-delete: true
154 changes: 78 additions & 76 deletions .github/workflows/py-rust-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,91 +3,93 @@ name: "Py-Rust Build"
# Originally derived from https://github.com/samuelcolvin/watchfiles/blob/main/.github/workflows/ci.yml

on:
workflow_call:
inputs:
new-sha:
required: true
type: string
workflow_call:
inputs:
new-sha:
required: true
type: string

jobs:
build:
name: build on ${{ matrix.os }} (${{ matrix.target }} - ${{ matrix.interpreter || 'all' }}${{ matrix.os == 'linux' && format(' - {0}', matrix.manylinux == 'auto' && 'manylinux' || matrix.manylinux) || '' }})
build:
name: build on ${{ matrix.os }} (${{ matrix.target }} - ${{ matrix.interpreter || 'all' }}${{ matrix.os
== 'linux' && format(' - {0}', matrix.manylinux == 'auto' && 'manylinux' || matrix.manylinux) ||
'' }})

strategy:
fail-fast: true # Want release to cancel if any fail, so may as well fail fast to save some minutes
matrix:
os: [linux, macos, windows]
target: [x86_64, aarch64]
manylinux: [auto]
include:
# manylinux for various platforms:
- os: linux
manylinux: auto
target: i686
- os: linux
manylinux: auto
target: aarch64
- os: linux
manylinux: auto
target: armv7
- os: linux
manylinux: auto
target: ppc64le
- os: linux
manylinux: auto
target: s390x
strategy:
fail-fast: true # Want release to cancel if any fail, so may as well fail fast to save some minutes
matrix:
os: [linux, macos, windows]
target: [x86_64, aarch64]
manylinux: [auto]
include:
# manylinux for various platforms:
- os: linux
manylinux: auto
target: i686
- os: linux
manylinux: auto
target: aarch64
- os: linux
manylinux: auto
target: armv7
- os: linux
manylinux: auto
target: ppc64le
- os: linux
manylinux: auto
target: s390x

# musllinux
- os: linux
manylinux: musllinux_1_1
target: x86_64
- os: linux
manylinux: musllinux_1_1
target: aarch64
# musllinux
- os: linux
manylinux: musllinux_1_1
target: x86_64
- os: linux
manylinux: musllinux_1_1
target: aarch64

# macos;
- os: macos
target: x86_64
- os: macos
target: aarch64
# macos;
- os: macos
target: x86_64
- os: macos
target: aarch64

# windows;
- os: windows
target: i686
python-architecture: x86
- os: windows
target: aarch64
# Windows arm only supports python 3.11 and up:
interpreter: 3.11 3.12
# windows;
- os: windows
target: i686
python-architecture: x86
# Windows arm only supports python 3.11 and up:
- os: windows
target: aarch64
interpreter: 3.11 3.12
runs-on: ${{ (matrix.os == 'linux' && 'ubuntu') || matrix.os }}-latest

runs-on: ${{ (matrix.os == 'linux' && 'ubuntu') || matrix.os }}-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.new-sha }}

steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.new-sha }}
- uses: actions/setup-python@v4
with:
python-version: "3.12"
architecture: ${{ matrix.python-architecture || 'x64' }}

- uses: actions/setup-python@v4
with:
python-version: "3.12"
architecture: ${{ matrix.python-architecture || 'x64' }}
- name: copy in README and LICENSE from root
run: cp README.md py_rust/README.md && cp LICENSE.md py_rust/LICENSE.md

- name: copy in README and LICENSE from root
run: cp README.md ./py_rust/README.md && cp LICENSE.md ./py_rust/LICENSE.md
- name: build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: ${{ matrix.manylinux || 'auto' }}
args: --manifest-path py_rust/Cargo.toml --release --out py_rust/dist --interpreter ${{ matrix.interpreter
|| '3.8 3.9 3.10 3.11 3.12' }}
rust-toolchain: stable
docker-options: -e CI
sccache: true

- name: build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: ${{ matrix.manylinux || 'auto' }}
args: --manifest-path py_rust/Cargo.toml --release --out py_rust/dist --interpreter ${{ matrix.interpreter || '3.8 3.9 3.10 3.11 3.12' }}
rust-toolchain: stable
docker-options: -e CI
sccache: true
- run: ${{ (matrix.os == 'windows' && 'dir') || 'ls -lh' }} py_rust/dist/

- run: ${{ (matrix.os == 'windows' && 'dir') || 'ls -lh' }} py_rust/dist/

- uses: actions/upload-artifact@v3
with:
name: py_rust_build_files
path: py_rust/dist
- uses: actions/upload-artifact@v3
with:
name: py_rust_build_files
path: py_rust/dist
17 changes: 9 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ on:
required: false
default: false
py_rust_version:
description: "Rust-backed Python Version (now 0.0.10)"
default: "0.0.10"


description: "Rust-backed Python Version"
default: "0.0.0"

jobs:
commit_versions:
Expand All @@ -34,8 +32,12 @@ jobs:
- uses: actions/setup-python@v4
- uses: ./.github/actions/install-pre-commit

- name: Install zetch
run: pip install zetch



# Formatting and checking uses nightly rather than stable:
- uses: dtolnay/rust-toolchain@nightly
if: ${{ inputs.py_rust_release }} || ${{ inputs.rust_release }}
with:
Expand All @@ -44,7 +46,7 @@ jobs:
- name: Update Rust-backed Python version
if: ${{ inputs.py_rust_release }}
run: |
./dev_scripts/pkg.sh ver_py_rust_update ${{ inputs.py_rust_version }}
zetch put zetch.config.toml context.static.PY_RUST_VERSION.value ${{ inputs.py_rust_version }}
- name: add and format added files with pre-commit
Expand All @@ -69,8 +71,7 @@ jobs:
echo $sha_new
echo "::set-output name=SHA::$sha_new"
- run:
echo ${{ steps.sha.outputs.SHA }}
- run: echo ${{ steps.sha.outputs.SHA }}

# Rebuild docs each time this is run, note there is currently no versioning in the docs for each of the individually packages, will need to be added when a public package is being properly released
docs:
Expand All @@ -88,7 +89,7 @@ jobs:
- name: Set up PDM
uses: pdm-project/setup-pdm@v3
with:
python-version: "3.12"
python-version: "3.12"
cache: true
cache-dependency-path: 'docs/pdm.lock'

Expand Down
Loading

0 comments on commit d3535f7

Please sign in to comment.