Skip to content

Commit

Permalink
Update build pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
adityagoel4512 committed Oct 14, 2024
1 parent 50ee759 commit 71b086d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 42 deletions.
53 changes: 24 additions & 29 deletions .github/workflows/build_and_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,41 @@ on:
- published

jobs:
build_sdist_and_wheel:
name: Build sdist and wheel on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0

- name: Build
run: |
pip install build
python -m build
- name: Test install and import
run: |
python -m venv ./env
. ./env/bin/activate
pip install dist/*.whl
python -c "import spox"
- uses: actions/upload-artifact@v4
- name: Set up pixi
uses: prefix-dev/setup-pixi@ba3bb36eb2066252b2363392b7739741bb777659
with:
environments: build
- name: Build project
run: pixi run -e build build-wheel
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: artifact
path: dist/*

upload_pypi:
name: Upload to PyPI
needs: [build_sdist_and_wheel]
publish:
name: Publish package
if: startsWith(github.ref, 'refs/tags/')
needs: [build]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
permissions:
id-token: write
environment: pypi
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@v1.10.3
- name: Publish package on TestPyPi
uses: pypa/gh-action-pypi-publish@897895f1e160c830e369f9779632ebc134688e1b
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
repository-url: https://test.pypi.org/legacy/
- name: Publish package on PyPi
uses: pypa/gh-action-pypi-publish@897895f1e160c830e369f9779632ebc134688e1b
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: CI
on: [push]
on: push

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -25,7 +25,7 @@ jobs:
timeout-minutes: 30
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
fail-fast: true
matrix:
os:
- ubuntu-latest
Expand All @@ -52,7 +52,7 @@ jobs:

opset-generation:
name: "Linux - opset generation"
runs-on: "ubuntu-latest"
runs-on: ubuntu-latest
env:
CI: True
steps:
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,10 @@ defaults:

jobs:
tests:
name: "Linux - weekly unit tests - ${{ matrix.OS }}"
runs-on: ${{ matrix.OS }}
name: "Linux - weekly unit tests - ubuntu-latest"
runs-on: ubuntu-latest
env:
CI: True
strategy:
fail-fast: true
matrix:
OS: ["ubuntu-latest"]
steps:
- name: Checkout branch
uses: actions/checkout@v4
Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ classifiers = [
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
dynamic = ["version"]

requires-python = ">=3.8"
requires-python = ">=3.9"

dependencies = ["numpy", "onnx>=1.13", "packaging"]

Expand All @@ -52,13 +51,13 @@ namespaces = false

[tool.ruff.lint]
# Enable the isort rules.
extend-select = ["I"]
extend-select = ["I", "UP"]

[tool.ruff.lint.isort]
known-first-party = ["spox"]

[tool.mypy]
python_version = "3.8"
python_version = "3.9"
ignore_missing_imports = true
no_implicit_optional = true
check_untyped_defs = true
Expand Down

0 comments on commit 71b086d

Please sign in to comment.