Skip to content
This repository has been archived by the owner on Jan 3, 2025. It is now read-only.

Commit

Permalink
👷 Update CI workflow to use PDM for dependency management and publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
mnixry committed Jan 2, 2025
1 parent 6cc98f5 commit dfcf473
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,10 @@ jobs:
name: opencv-${{ matrix.os }}
path: ./opencv

- uses: actions/setup-python@main
- uses: pdm-project/setup-pdm@main
with:
python-version: ${{ matrix.python }}
cache: true

- uses: ilammy/msvc-dev-cmd@v1
id: msvc-env
Expand All @@ -143,12 +144,11 @@ jobs:
echo "OpenCV_DIR=$(pwd)/opencv/lib/cmake/opencv4" >> $GITHUB_ENV
echo "OpenCV_STATIC=ON" >> $GITHUB_ENV
- name: Install dependencies
run: pdm install -G :all

- name: Build wheel
env:
VERBOSE: 1
run: |
pip install poetry
poetry build --format wheel
run: pdm build -v

- uses: actions/upload-artifact@main
with:
Expand Down Expand Up @@ -195,26 +195,18 @@ jobs:
name: wheel-${{matrix.os}}-${{matrix.python}}
path: ./dist

- uses: actions/setup-python@main
- uses: pdm-project/setup-pdm@main
with:
python-version: ${{ matrix.python }}

- uses: ilammy/msvc-dev-cmd@v1
id: msvc-env
if: startsWith(matrix.os, 'windows')

- name: Install Poetry
run: |
pip install poetry
cache: true

- name: Install dependencies
run: |
poetry install --no-root --only=test
poetry run pip install dist/*.whl
pdm install -G :all
- name: Run tests
run: |
poetry run pytest
pdm run pytest
cleanup:
name: Cleanup artifacts
Expand Down Expand Up @@ -244,6 +236,12 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v') && github.head_ref == ''
runs-on: ubuntu-latest

permissions:
# This permission is needed for private repositories.
contents: read
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write

steps:
- uses: actions/checkout@main

Expand All @@ -252,13 +250,15 @@ jobs:
name: wheel-all
path: ./dist

- name: Install Poetry
run: |
pipx install poetry
- uses: pdm-project/setup-pdm@main
with:
python-version: "3"
cache: true

- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
PDM_PUBLISH_USERNAME: __token__
PDM_PUBLISH_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
poetry build --format sdist
poetry publish --skip-existing
pdm build --no-wheel
pdm publish --skip-existing --no-build

0 comments on commit dfcf473

Please sign in to comment.