-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce initial project code standards
Added and applied code standards for both Rust and Python. pre-commit hooks are now available and will be enforced in pull requests.
- Loading branch information
1 parent
a4105a8
commit 6cb1534
Showing
12 changed files
with
207 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# This file was initially autogenerated by maturin v1.5.0 | ||
name: Build and Test | ||
|
||
on: | ||
|
@@ -16,7 +15,36 @@ permissions: | |
contents: read | ||
|
||
jobs: | ||
code_checks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
- name: Run pre-commit checks | ||
run: | | ||
pip install pre-commit | ||
pre-commit run --all-files | ||
sdist: | ||
needs: [code_checks] | ||
runs-on: ubuntu-latest | ||
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 | ||
|
||
linux: | ||
needs: [code_checks] | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
|
@@ -49,37 +77,16 @@ jobs: | |
with: | ||
name: wheels-linux-${{ matrix.target }} | ||
path: dist | ||
# - name: Setup Docker | ||
# run: | | ||
# sudo apt-get install apt-transport-https ca-certificates curl software-properties-common | ||
# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | ||
# sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | ||
# sudo apt-get install docker-ce | ||
- name: Install and Test | ||
if: ${{ startsWith(matrix.target, 'x86_64') }} | ||
# if: ${{ startsWith(matrix.target, 'x86_64') }} | ||
shell: bash | ||
run: | | ||
set -e | ||
pip install .[dev] --find-links dist --force-reinstall | ||
pytest -v tests/ | ||
# - name: Install and Test | ||
# if: ${{ !startsWith(matrix.target, 'x86') && matrix.target != 'ppc64' }} | ||
# uses: uraimo/[email protected] | ||
# with: | ||
# arch: ${{ matrix.target }} | ||
# distro: ubuntu22.04 | ||
# githubToken: ${{ github.token }} | ||
# install: | | ||
# apt-get update | ||
# apt-get install -y --no-install-recommends python3 python3-pip | ||
# pip3 install -U pip pytest | ||
# run: | | ||
# set -e | ||
# pip3 install .[dev] --find-links dist --force-reinstall | ||
# pip3 install pytest docker | ||
# pytest -v tests/ | ||
windows: | ||
needs: [code_checks] | ||
runs-on: windows-latest | ||
strategy: | ||
matrix: | ||
|
@@ -90,6 +97,12 @@ jobs: | |
with: | ||
python-version: '3.10' | ||
architecture: ${{ matrix.target }} | ||
- name: Set Perl environment variables | ||
run: | | ||
echo "PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 | ||
echo "OPENSSL_SRC_PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 | ||
- name: Remove wincred from docker config | ||
run: sed -i '/wincred/d' ~/.docker/config.json | ||
- name: Build wheels | ||
uses: PyO3/maturin-action@v1 | ||
with: | ||
|
@@ -101,24 +114,23 @@ jobs: | |
with: | ||
name: wheels-windows-${{ matrix.target }} | ||
path: dist | ||
# - name: Set up Docker Buildx | ||
# uses: docker/setup-buildx-action@v3 | ||
# - name: Install and Test | ||
# if: ${{ !startsWith(matrix.target, 'aarch64') }} | ||
# shell: bash | ||
# run: | | ||
# set -e | ||
# pip install .[dev] --find-links dist --force-reinstall | ||
# pip install pytest docker | ||
# pytest -v tests/ | ||
- name: Install and Test | ||
if: ${{ !startsWith(matrix.target, 'aarch64') }} | ||
shell: bash | ||
run: | | ||
set -e | ||
pip install .[dev] --find-links dist --force-reinstall | ||
pytest -v tests/ | ||
macos: | ||
runs-on: macos-latest | ||
needs: [code_checks] | ||
runs-on: [macos-13, macos-14] | ||
strategy: | ||
matrix: | ||
target: [x86_64, aarch64] | ||
env: | ||
OPENSSL_NO_VENDOR: 1 | ||
DOCKER_HOST: unix:///var/run/docker.sock | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
|
@@ -137,27 +149,15 @@ jobs: | |
with: | ||
name: wheels-macos-${{ matrix.target }} | ||
path: dist | ||
# - name: Install and Test | ||
# if: ${{ !startsWith(matrix.target, 'aarch64') }} | ||
# shell: bash | ||
# run: | | ||
# set -e | ||
# pip install .[dev] --find-links dist --force-reinstall | ||
# pip install pytest docker pexpect | ||
# pytest -v tests/ | ||
|
||
sdist: | ||
runs-on: ubuntu-latest | ||
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 | ||
|
||
- name: setup-docker | ||
# if: ${{ !startsWith(matrix.target, 'aarch64') }} | ||
run: | | ||
brew install docker | ||
colima start | ||
- name: Install and Test | ||
# if: ${{ !startsWith(matrix.target, 'aarch64') }} | ||
shell: bash | ||
run: | | ||
set -e | ||
pip install .[dev] --find-links dist --force-reinstall | ||
pytest -v tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# checks and formatting for rust code | ||
repos: | ||
- repo: local | ||
hooks: | ||
- id: cargo-fmt | ||
name: cargo fmt | ||
entry: cargo fmt -- | ||
language: system | ||
types: [rust] | ||
pass_filenames: false | ||
- repo: https://github.com/doublify/pre-commit-rust | ||
rev: v1.0 | ||
hooks: | ||
- id: clippy | ||
|
||
# checks and formatting for python code | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
# Ruff version. | ||
rev: v0.3.4 | ||
hooks: | ||
- id: ruff-format # Formatter | ||
- id: ruff # Linter | ||
args: [--fix, --exit-non-zero-on-fix] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.