From a030186c70ba4d6c8bd91de40d3fea37b2865eac Mon Sep 17 00:00:00 2001 From: Pierre-antoine Comby Date: Fri, 29 Mar 2024 10:48:08 +0100 Subject: [PATCH] add workflows. --- .github/workflows/tags-release.yaml | 49 +++++++++++++++++++++++++++++ .github/workflows/test.yaml | 32 +++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 .github/workflows/tags-release.yaml create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/tags-release.yaml b/.github/workflows/tags-release.yaml new file mode 100644 index 0000000..8433a60 --- /dev/null +++ b/.github/workflows/tags-release.yaml @@ -0,0 +1,49 @@ +name: Release on PyPi + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' +jobs: + build-n-publish: + name: Build and publish to PyPI + runs-on: ubuntu-latest + environment: pypi-release + permissions: + id-token: write + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Get history and tags for SCM versioning to work + run: | + git fetch --prune --unshallow + git fetch --depth=1 origin +refs/tags/*:refs/tags/* + - name: Set up Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Install pypa/build + run: | + python -m pip install build + python -m pip install . + + - name: Build a binary wheel and a source tarball + run: | + python -m build --sdist --wheel --outdir dist/ . + + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + gh-release: + name: Create release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 100 + - name: Create Relase + run: gh release create "$GITHUB_REF_NAME" --generate-notes -d diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..a98b599 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,32 @@ +# this file is *not* meant to cover or endorse the use of GitHub Actions, but rather to +# help test this project + +name: Test + +on: [push, pull_request] + +jobs: + test: + strategy: + matrix: + python: ['3.10'] + platform: [ubuntu-latest] + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + cache: 'pip' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e .[test,dev] + - name: Linter + run: | + black --check src tests + ruff . + - name: Test + run: | + pytest