From abc504f14c79aab892759068d69408e9a4b0ac29 Mon Sep 17 00:00:00 2001 From: Joris Conijn Date: Wed, 21 Jun 2023 13:07:31 +0200 Subject: [PATCH] 0.5.1 --- .github/workflows/ci.yml | 61 ++++++++++++-------------- .github/workflows/release-drafter.yml | 17 -------- .github/workflows/release.yml | 63 --------------------------- 3 files changed, 29 insertions(+), 112 deletions(-) delete mode 100644 .github/workflows/release-drafter.yml delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 609f160..1cd9426 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,18 +1,16 @@ name: Continuous Integration - on: push: branches: - main pull_request: branches: - - develop + - main jobs: - - ci: + Quality: strategy: - fail-fast: false + fail-fast: true matrix: python-version: [3.8, 3.9] os: [ubuntu-latest] @@ -22,36 +20,35 @@ jobs: - uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - - uses: Gr1N/setup-poetry@v8 - with: - poetry-version: "1.4.0" - - uses: actions/cache@v2 + - name: Install Python Poetry + uses: abatilo/actions-poetry@v2.1.0 with: - path: ~/.cache/pypoetry/virtualenvs - key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} - - run: poetry --version - - name: Prepare variables - id: vars - run: | - echo "version=$(awk '/version/{print $NF}' pyproject.toml | sed 's/\"//g')" >> $GITHUB_OUTPUT + poetry-version: 1.4.0 + - name: Configure poetry + shell: bash + run: python -m poetry config virtualenvs.in-project true + - name: View poetry version + run: poetry --version - name: Install dependencies - run: make install + run: | + python -m poetry install - name: Run check run: make test - - name: Run complexity-baseline - run: make complexity-baseline - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 + - name: Run complexity baseline + run: make complexity + + Release: + needs: Quality + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore(release):') + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 with: - fail_ci_if_error: true - token: ${{ secrets.CODECOV_TOKEN }} - files: ./reports/coverage.xml - - name: Code Coverage Summary Report - uses: irongut/CodeCoverageSummary@v1.1.0 + fetch-depth: 0 + - name: Python Semantic Release + uses: relekang/python-semantic-release@master with: - filename: reports/coverage.xml - badge: true - fail_below_min: true - format: markdown - output: both - thresholds: 95 100 + github_token: ${{ secrets.GITHUB_TOKEN }} + repository_username: __token__ + repository_password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml deleted file mode 100644 index 23b707a..0000000 --- a/.github/workflows/release-drafter.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Release Drafter - -on: - push: - branches: - - develop - - pull_request: - types: [opened, reopened, synchronize] - -jobs: - update_release_draft: - runs-on: ubuntu-latest - steps: - - uses: release-drafter/release-drafter@v5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 942443a..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: Create Release -on: - push: - branches: - - main - -jobs: - build: - name: Create Release - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Install python - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - uses: Gr1N/setup-poetry@v8 - with: - poetry-version: 1.4.0 - - uses: actions/cache@v2 - with: - path: ~/.cache/pypoetry/virtualenvs - key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} - - run: poetry --version - - name: Prepare variables - id: vars - run: | - echo "version=$(awk '/version/{print $NF}' pyproject.toml | sed 's/\"//g')" >> $GITHUB_OUTPUT - - name: Install dependencies - run: make install - - name: Run check - run: make build - - uses: release-drafter/release-drafter@v5 - id: release_notes - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: v${{ steps.vars.outputs.version }} - release_name: Release v${{ steps.vars.outputs.version }} - body: ${{ steps.release_notes.outputs.body }} - draft: false - prerelease: false - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./dist/pull-request-codecommit-${{ steps.vars.outputs.version }}.tar.gz - asset_name: pull-request-codecommit-${{ steps.vars.outputs.version }}.tar.gz - asset_content_type: application/tar+gzip - - name: Publish a Python distribution to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }}