From c3c1e01ad68b91f699ee07952dd5554876535f08 Mon Sep 17 00:00:00 2001 From: Aditya Goel Date: Mon, 14 Oct 2024 17:34:40 +0100 Subject: [PATCH] Update build pipeline --- .github/workflows/build_and_publish.yml | 54 +++++++++++-------------- .github/workflows/ci.yml | 6 +-- .github/workflows/weekly.yml | 8 +--- pyproject.toml | 2 +- 4 files changed, 30 insertions(+), 40 deletions(-) diff --git a/.github/workflows/build_and_publish.yml b/.github/workflows/build_and_publish.yml index db5deecf..405904a9 100644 --- a/.github/workflows/build_and_publish.yml +++ b/.github/workflows/build_and_publish.yml @@ -8,46 +8,40 @@ 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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe6dfd58..1f42676d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,5 @@ name: CI -on: [push] +on: push concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -25,7 +25,7 @@ jobs: timeout-minutes: 30 runs-on: ${{ matrix.os }} strategy: - fail-fast: false + fail-fast: true matrix: os: - ubuntu-latest @@ -52,7 +52,7 @@ jobs: opset-generation: name: "Linux - opset generation" - runs-on: "ubuntu-latest" + runs-on: ubuntu-latest env: CI: True steps: diff --git a/.github/workflows/weekly.yml b/.github/workflows/weekly.yml index 32cd617b..8975b422 100644 --- a/.github/workflows/weekly.yml +++ b/.github/workflows/weekly.yml @@ -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 diff --git a/pyproject.toml b/pyproject.toml index f1ee3749..1cb252af 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,7 +52,7 @@ namespaces = false [tool.ruff.lint] # Enable the isort rules. -extend-select = ["I"] +extend-select = ["I", "UP"] [tool.ruff.lint.isort] known-first-party = ["spox"]