From 647f7a8f6f6146f35c6c4073ab8b56badb7dc3e2 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Wed, 21 Feb 2024 23:23:57 +0800 Subject: [PATCH 1/7] swith to reusable workflows --- .github/workflows/publish.yml | 42 +-------------------------- .github/workflows/release-drafter.yml | 9 ++---- .github/workflows/test.yml | 5 ++-- 3 files changed, 5 insertions(+), 51 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3d27202..68eab5c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,11 +1,3 @@ -# This workflow will upload a Python Package using Twine when a release is created -# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries - -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - name: Upload Python Package on: @@ -14,38 +6,6 @@ on: types: [published] workflow_dispatch: -permissions: - contents: read - jobs: deploy: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - # use fetch --all for setuptools_scm to work - with: - fetch-depth: 0 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - name: Install dependencies - run: python -m pip install --upgrade pip twine - - name: Build wheel - run: python -m pip wheel -w dist . - - name: Check distribution - run: twine check dist/cpp_linter_hooks* - - name: Publish package (to TestPyPI) - if: github.event_name == 'workflow_dispatch' && github.repository == 'cpp-linter/cpp-linter-hooks' - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }} - run: twine upload --repository testpypi dist/cpp_linter_hooks* - - name: Publish package (to PyPI) - if: github.event_name != 'workflow_dispatch' && github.repository == 'cpp-linter/cpp-linter-hooks' - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} - run: twine upload dist/cpp_linter_hooks* + uses: cpp-linter/.github/.github/workflows/py-publish.yml@main diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index fb8f44b..2250d38 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -7,10 +7,5 @@ on: workflow_dispatch: jobs: - update_release_draft: - runs-on: ubuntu-latest - steps: - # Draft your next Release notes as Pull Requests are merged into the default branch - - uses: release-drafter/release-drafter@v6 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + draft-release: + uses: cpp-linter/.github/.github/workflows/release-drafter.yml@main diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5abbdb0..d44bba9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,6 +8,8 @@ on: workflow_dispatch: jobs: + pre-commit: + uses: cpp-linter/.github/.github/workflows/pre-commit.yml@main test: runs-on: ubuntu-latest steps: @@ -23,9 +25,6 @@ jobs: pip install . pip install -r requirements-dev.txt - - name: Run pre-commit against all files - run: pre-commit run --all-files - - name: Run tests and collect coverage run: | coverage run --source=tests,cpp_linter_hooks -m pytest -vv From c0fee45f0daa9d3e6dd5cc8b23d5aba1252f4060 Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Thu, 22 Feb 2024 00:03:18 +0800 Subject: [PATCH 2/7] Update test.yml --- .github/workflows/test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d44bba9..0e85189 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,9 @@ on: jobs: pre-commit: - uses: cpp-linter/.github/.github/workflows/pre-commit.yml@main + uses: cpp-linter/.github/.github/workflows/pre-commit.yml@swith-to-reusable-workflows + with: + commands: pip install . && pytest -v tests test: runs-on: ubuntu-latest steps: From 0b2082b1d37f84730c39f626c13f4ecfcf876cc2 Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Thu, 22 Feb 2024 00:04:15 +0800 Subject: [PATCH 3/7] Update test.yml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0e85189..afc2408 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ on: jobs: pre-commit: - uses: cpp-linter/.github/.github/workflows/pre-commit.yml@swith-to-reusable-workflows + uses: cpp-linter/.github/.github/workflows/pre-commit.yml@run-command with: commands: pip install . && pytest -v tests test: From 47631f66da668845042abd62569bc65cb5fce694 Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Thu, 22 Feb 2024 09:20:40 +0800 Subject: [PATCH 4/7] Update test.yml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index afc2408..b1a4e31 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: pre-commit: uses: cpp-linter/.github/.github/workflows/pre-commit.yml@run-command with: - commands: pip install . && pytest -v tests + commands: pip install pytest -e . && pytest -v tests test: runs-on: ubuntu-latest steps: From 0e80f83565e84654e86abcf389c7e5682a858fef Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Thu, 22 Feb 2024 09:23:25 +0800 Subject: [PATCH 5/7] Update test.yml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b1a4e31..b44670b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ on: jobs: pre-commit: - uses: cpp-linter/.github/.github/workflows/pre-commit.yml@run-command + uses: cpp-linter/.github/.github/workflows/pre-commit.yml@main with: commands: pip install pytest -e . && pytest -v tests test: From dcd65dd59249850cb9be928915c753113ecf1a4a Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Thu, 22 Feb 2024 09:24:12 +0800 Subject: [PATCH 6/7] Update test.yml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b44670b..5e0b863 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: pre-commit: uses: cpp-linter/.github/.github/workflows/pre-commit.yml@main with: - commands: pip install pytest -e . && pytest -v tests + commands: pip install pytest -e . test: runs-on: ubuntu-latest steps: From 91ec5f4e3d315c42df15d21235e2e77d74308ca6 Mon Sep 17 00:00:00 2001 From: Peter Shen Date: Thu, 22 Feb 2024 09:27:03 +0800 Subject: [PATCH 7/7] Update test.yml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5e0b863..2358726 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: pre-commit: uses: cpp-linter/.github/.github/workflows/pre-commit.yml@main with: - commands: pip install pytest -e . + commands: pip install pytest test: runs-on: ubuntu-latest steps: