From 55ce932cb3146d3fee8fb5181613419baed92fe5 Mon Sep 17 00:00:00 2001 From: "David L. Day" Date: Sun, 11 Dec 2022 14:39:42 -0500 Subject: [PATCH] chore: use org ci and publish pipelines --- .github/workflows/pypi-publish.yml | 81 ++++-------------------------- .github/workflows/python-ci.yml | 58 ++------------------- 2 files changed, 15 insertions(+), 124 deletions(-) diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index eba8573..fea19ef 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -1,4 +1,4 @@ -name: Bump, Release, and Publish +name: Bump, Publish, and Release on: workflow_dispatch: @@ -19,74 +19,13 @@ on: default: false type: boolean -concurrency: - group: tag-and-release - cancel-in-progress: true - jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - persist-credentials: false - fetch-depth: 0 - submodules: true - - name: Set up Python - uses: actions/setup-python@v4 - - name: Install Poetry - uses: snok/install-poetry@v1 - with: - virtualenvs-create: true - virtualenvs-in-project: true - installer-parallel: true - - name: Bump Version - run: poetry version ${{ github.event.inputs.newversion }} - - name: Get New Version - id: get-new-version - run: | - echo "version=$(poetry version -s)" >> $GITHUB_OUTPUT - - name: Install dependencies - run: poetry install --with dev --no-interaction --no-root - - name: Install project - run: poetry install --with dev --no-interaction - - name: Run tests - run: | - source .venv/bin/activate - pytest tests/ - - name: Poetry Build - run: | - poetry build - - name: Poetry Publish to PyPi Test - if: ${{ 'true' == github.event.inputs.testpublish }} - run: | - poetry config repositories.testpypi https://test.pypi.org/legacy/ - poetry publish --repository testpypi --no-interaction --skip-existing - env: - POETRY_PYPI_TOKEN_TESTPYPI: ${{ secrets.TEST_PYPI_API_TOKEN }} - - name: Poetry Publish to PyPi - run: | - poetry publish --no-interaction - env: - POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }} - - name: Commit & Push changes - uses: actions-js/push@v1.3 - with: - author_email: david@davidlday.com - author_name: ${{ github.actor }} - message: - "[skip ci] bumped to ${{ steps.get-new-version.outputs.version }}" - github_token: ${{ secrets.VERSION_BUMP_TAG_TOKEN }} - - name: Tag version - id: tag-version - uses: mathieudutour/github-tag-action@v6.1 - with: - custom_tag: ${{ steps.get-new-version.outputs.version }} - create_annotated_tag: true - github_token: ${{ secrets.VERSION_BUMP_TAG_TOKEN }} - - name: Create a GitHub release - uses: ncipollo/release-action@v1 - with: - tag: ${{ steps.tag-version.outputs.new_tag }} - name: ${{ steps.tag-version.outputs.new_tag }} - body: ${{ steps.tag-version.outputs.changelog }} + publish: + uses: prosegrinder/.github/.github/workflows/python-poetry-publish.yaml@main + with: + newversion: ${{ github.event.inputs.newversion }} + testpublish: ${{ 'true' == github.event.inputs.testpublish }} + secrets: + TEST_PYPI_API_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }} + PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} + VERSION_BUMP_TAG_TOKEN: ${{ secrets.VERSION_BUMP_TAG_TOKEN }} diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index 7682f7c..4649deb 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -1,60 +1,12 @@ -name: Python CI +name: Python Poetry CI -on: pull_request +on: + pull_request: concurrency: group: ci-${{ github.ref }} cancel-in-progress: true jobs: - lint: - runs-on: ubuntu-latest - steps: - - name: Check Out - uses: actions/checkout@v3 - with: - submodules: true - - name: Setup Python - uses: actions/setup-python@v4 - - name: Load pip cache - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip - restore-keys: ${{ runner.os }}-pip - - name: Install linters - run: python -m pip install --upgrade black pylint - - name: Black - run: black . --check - - name: Pylint - run: pylint src/**/*.py - - test: - needs: lint - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] - steps: - - uses: actions/checkout@v3 - with: - submodules: true - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Install Poetry - uses: snok/install-poetry@v1 - with: - virtualenvs-create: true - virtualenvs-in-project: true - installer-parallel: true - - name: Install dependencies - run: poetry install --with dev --no-interaction --no-root - - name: Install project - run: poetry install --with dev --no-interaction - - name: Run tests - run: | - source .venv/bin/activate - pytest tests/ + python-poetry-ci: + uses: prosegrinder/.github/.github/workflows/python-poetry-ci.yaml@main