From a30c2dfa7d7b5c0c2b95a3f40c4048dac9334f7a Mon Sep 17 00:00:00 2001 From: YisusChrist Date: Sun, 6 Oct 2024 19:56:10 +0200 Subject: [PATCH] chore: update github files --- .../workflows/automerge-dependabot-prs.yml | 15 +- .github/workflows/labeler.yml | 11 +- .github/workflows/release.yml | 73 +-------- .github/workflows/tests.yml | 150 +----------------- 4 files changed, 12 insertions(+), 237 deletions(-) diff --git a/.github/workflows/automerge-dependabot-prs.yml b/.github/workflows/automerge-dependabot-prs.yml index 5b24730..3a3aa3f 100644 --- a/.github/workflows/automerge-dependabot-prs.yml +++ b/.github/workflows/automerge-dependabot-prs.yml @@ -8,16 +8,5 @@ permissions: jobs: dependabot: - runs-on: ubuntu-latest - if: ${{ github.actor == 'dependabot[bot]' }} - steps: - - name: Approve a PR - run: gh pr review --approve "$PR_URL" - env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - - name: Enable auto-merge for Dependabot PRs - run: gh pr merge --auto --rebase "$PR_URL" - env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + uses: YisusChrist/github-actions-workflows/.github/workflows/automerge-dependabot-prs.yml@main + secrets: inherit diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 173926f..618772d 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -8,12 +8,5 @@ on: jobs: labeler: - runs-on: ubuntu-latest - steps: - - name: Check out the repository - uses: actions/checkout@v4 - - - name: Run Labeler - uses: crazy-max/ghaction-github-labeler@v5.0.0 - with: - skip-delete: true + uses: YisusChrist/github-actions-workflows/.github/workflows/labeler.yml@main + secrets: inherit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 65fa6bb..53c6145 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,72 +8,7 @@ on: jobs: release: - name: Release - runs-on: ubuntu-latest - steps: - - name: Check out the repository - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - - name: Upgrade pip - run: | - pip install --constraint=.github/workflows/constraints.txt pip - pip --version - - - name: Install Poetry - run: | - pip install --constraint=.github/workflows/constraints.txt poetry - poetry --version - - - name: Check if there is a parent commit - id: check-parent-commit - run: | - echo "::set-output name=sha::$(git rev-parse --verify --quiet HEAD^)" - - - name: Detect and tag new version - id: check-version - if: steps.check-parent-commit.outputs.sha - uses: salsify/action-detect-and-tag-new-version@v2.0.3 - with: - version-command: | - bash -o pipefail -c "poetry version | awk '{ print \$2 }'" - - - name: Bump version for developmental release - if: "! steps.check-version.outputs.tag" - run: | - poetry version patch && - version=$(poetry version | awk '{ print $2 }') && - poetry version $version.dev.$(date +%s) - - - name: Build package - run: | - poetry build --ansi - - - name: Publish package on PyPI - if: steps.check-version.outputs.tag - uses: pypa/gh-action-pypi-publish@v1.10.3 - with: - user: __token__ - password: ${{ secrets.PYPI_TOKEN }} - - - name: Publish package on TestPyPI - if: "! steps.check-version.outputs.tag" - uses: pypa/gh-action-pypi-publish@v1.10.3 - with: - user: __token__ - password: ${{ secrets.TEST_PYPI_TOKEN }} - repository_url: https://test.pypi.org/legacy/ - - - name: Publish the release notes - uses: release-drafter/release-drafter@v6.0.0 - with: - publish: ${{ steps.check-version.outputs.tag != '' }} - tag: ${{ steps.check-version.outputs.tag }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: YisusChrist/github-actions-workflows/.github/workflows/release.yml@main + with: + python-version: "3.12" + secrets: inherit diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 66d4e74..3364235 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,149 +6,7 @@ on: jobs: tests: - name: ${{ matrix.session }} ${{ matrix.python }} / ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - include: - - { python: "3.10", os: "ubuntu-latest", session: "pre-commit" } - - { python: "3.10", os: "ubuntu-latest", session: "safety" } - - { python: "3.10", os: "ubuntu-latest", session: "mypy" } - - { python: "3.9", os: "ubuntu-latest", session: "mypy" } - - { python: "3.8", os: "ubuntu-latest", session: "mypy" } - - { python: "3.7", os: "ubuntu-latest", session: "mypy" } - - { python: "3.10", os: "ubuntu-latest", session: "tests" } - - { python: "3.9", os: "ubuntu-latest", session: "tests" } - - { python: "3.8", os: "ubuntu-latest", session: "tests" } - - { python: "3.7", os: "ubuntu-latest", session: "tests" } - - { python: "3.10", os: "windows-latest", session: "tests" } - - { python: "3.10", os: "macos-latest", session: "tests" } - - { python: "3.10", os: "ubuntu-latest", session: "typeguard" } - - { python: "3.10", os: "ubuntu-latest", session: "xdoctest" } - - { python: "3.10", os: "ubuntu-latest", session: "docs-build" } - - env: - NOXSESSION: ${{ matrix.session }} - FORCE_COLOR: "1" - PRE_COMMIT_COLOR: "always" - - steps: - - name: Check out the repository - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python }} - - - name: Upgrade pip - run: | - pip install --constraint=.github/workflows/constraints.txt pip - pip --version - - - name: Upgrade pip in virtual environments - shell: python - run: | - import os - import pip - - with open(os.environ["GITHUB_ENV"], mode="a") as io: - print(f"VIRTUALENV_PIP={pip.__version__}", file=io) - - - name: Install Poetry - run: | - pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry - poetry --version - - - name: Install Nox - run: | - pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox - pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry - nox --version - - - name: Compute pre-commit cache key - if: matrix.session == 'pre-commit' - id: pre-commit-cache - shell: python - run: | - import hashlib - import sys - - python = "py{}.{}".format(*sys.version_info[:2]) - payload = sys.version.encode() + sys.executable.encode() - digest = hashlib.sha256(payload).hexdigest() - result = "${{ runner.os }}-{}-{}-pre-commit".format(python, digest[:8]) - - print("::set-output name=result::{}".format(result)) - - - name: Restore pre-commit cache - uses: actions/cache@v4 - if: matrix.session == 'pre-commit' - with: - path: ~/.cache/pre-commit - key: ${{ steps.pre-commit-cache.outputs.result }}-${{ hashFiles('.pre-commit-config.yaml') }} - restore-keys: | - ${{ steps.pre-commit-cache.outputs.result }}- - - - name: Run Nox - run: | - nox --python=${{ matrix.python }} - - - name: Upload coverage data - if: always() && matrix.session == 'tests' - uses: "actions/upload-artifact@v4" - with: - name: coverage-data - path: ".coverage.*" - - - name: Upload documentation - if: matrix.session == 'docs-build' - uses: actions/upload-artifact@v4 - with: - name: docs - path: docs/_build - - coverage: - runs-on: ubuntu-latest - needs: tests - steps: - - name: Check out the repository - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - - name: Upgrade pip - run: | - pip install --constraint=.github/workflows/constraints.txt pip - pip --version - - - name: Install Poetry - run: | - pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry - poetry --version - - - name: Install Nox - run: | - pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox - pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry - nox --version - - - name: Download coverage data - uses: actions/download-artifact@v4 - with: - name: coverage-data - - - name: Combine coverage data and display human readable report - run: | - nox --session=coverage - - - name: Create coverage report - run: | - nox --session=coverage -- xml - - - name: Upload coverage report - uses: codecov/codecov-action@v4.6.0 + uses: YisusChrist/github-actions-workflows/.github/workflows/tests.yml@main + with: + python-version: "3.12" + secrets: inherit