From 71212b1bcd9abf664af2154f98ad24deb680891c Mon Sep 17 00:00:00 2001 From: Forrest Williams Date: Mon, 8 Jan 2024 09:54:09 -0600 Subject: [PATCH] update actions --- .github/workflows/changelog.yml | 1 + .github/workflows/coverage-report.yml | 38 +++++++++++++++++++ .github/workflows/labeled-pr.yml | 1 + ...ment.yml => release-checklist-comment.yml} | 9 ++++- .github/workflows/release.yml | 3 +- .github/workflows/static-analysis.yml | 26 ++++--------- .github/workflows/tag-version.yml | 6 ++- .github/workflows/test-and-build.yml | 36 ++++++++++++++++++ .github/workflows/test.yml | 19 ---------- 9 files changed, 97 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/coverage-report.yml rename .github/workflows/{release-template-comment.yml => release-checklist-comment.yml} (60%) create mode 100644 .github/workflows/test-and-build.yml delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 1790266..7e0f5bb 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -13,6 +13,7 @@ on: jobs: call-changelog-check-workflow: + # Docs: https://github.com/ASFHyP3/actions uses: ASFHyP3/actions/.github/workflows/reusable-changelog-check.yml@v0.8.3 secrets: USER_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/coverage-report.yml b/.github/workflows/coverage-report.yml new file mode 100644 index 0000000..6562884 --- /dev/null +++ b/.github/workflows/coverage-report.yml @@ -0,0 +1,38 @@ +name: Generate Test Coverage Report and Badge + +on: pull_request + +jobs: + pytest: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.ref }} + + - uses: mamba-org/setup-micromamba@v1 + with: + environment-file: environment.yml + + - name: Generate Coverage Report and Badge + shell: bash -l {0} + run: | + python -m pip install --no-deps . + python -m pip install coverage-badge + pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=hypelib tests/ | tee pytest-coverage.txt + coverage-badge -fo images/coverage.svg + + - name: Commit Coverage Badge + uses: EndBug/add-and-commit@v9 + with: + default_author: github_actions + add: 'images/coverage.svg' + message: 'update coverage image' + + - name: PR Coverage Comment + uses: MishaKav/pytest-coverage-comment@main + with: + pytest-coverage-path: ./pytest-coverage.txt + junitxml-path: ./pytest.xml diff --git a/.github/workflows/labeled-pr.yml b/.github/workflows/labeled-pr.yml index 103ae29..dcb89f1 100644 --- a/.github/workflows/labeled-pr.yml +++ b/.github/workflows/labeled-pr.yml @@ -12,4 +12,5 @@ on: jobs: call-labeled-pr-check-workflow: + # Docs: https://github.com/ASFHyP3/actions uses: ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml@v0.8.3 diff --git a/.github/workflows/release-template-comment.yml b/.github/workflows/release-checklist-comment.yml similarity index 60% rename from .github/workflows/release-template-comment.yml rename to .github/workflows/release-checklist-comment.yml index 2b070b3..795b49f 100644 --- a/.github/workflows/release-template-comment.yml +++ b/.github/workflows/release-checklist-comment.yml @@ -1,12 +1,17 @@ +name: Create Release Comment + on: pull_request: types: - opened branches: - main - + jobs: - call-release-checklist-workflow: + call-release-workflow: + # Docs: https://github.com/ASFHyP3/actions uses: ASFHyP3/actions/.github/workflows/reusable-release-checklist-comment.yml@v0.8.3 + permissions: + pull-requests: write secrets: USER_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 005a1fb..b238ddf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Write release and finish +name: Create Release on: push: @@ -7,6 +7,7 @@ on: jobs: call-release-workflow: + # Docs: https://github.com/ASFHyP3/actions uses: ASFHyP3/actions/.github/workflows/reusable-release.yml@v0.8.3 with: release_prefix: HyP3-lib diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index beb1620..c18f2fd 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -3,24 +3,12 @@ name: Static analysis on: push jobs: - flake8: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-python@v4 - with: - python-version: 3.x - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install flake8 flake8-import-order flake8-blind-except flake8-builtins - - - name: Lint with flake8 - run: | - flake8 --max-line-length=120 --import-order-style=pycharm --statistics \ - --application-import-names hyp3lib --ignore=A,B,E,I,W,N8 - call-secrets-analysis-workflow: + # Docs: https://github.com/ASFHyP3/actions uses: ASFHyP3/actions/.github/workflows/reusable-secrets-analysis.yml@v0.8.3 + + call-flake8-workflow: + # Docs: https://github.com/ASFHyP3/actions + uses: ASFHyP3/actions/.github/workflows/reusable-flake8.yml@v0.8.3 + with: + local_package_names: hyp3lib diff --git a/.github/workflows/tag-version.yml b/.github/workflows/tag-version.yml index 5130be2..3ffa55c 100644 --- a/.github/workflows/tag-version.yml +++ b/.github/workflows/tag-version.yml @@ -1,4 +1,4 @@ -name: Tag version +name: Tag New Version on: push: @@ -7,6 +7,10 @@ on: jobs: call-bump-version-workflow: + # Docs: https://github.com/ASFHyP3/actions uses: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml@v0.8.3 + with: + user: tools-bot + email: UAF-asf-apd@alaska.edu secrets: USER_TOKEN: ${{ secrets.TOOLS_BOT_PAK }} diff --git a/.github/workflows/test-and-build.yml b/.github/workflows/test-and-build.yml new file mode 100644 index 0000000..81e6c29 --- /dev/null +++ b/.github/workflows/test-and-build.yml @@ -0,0 +1,36 @@ +name: Test and build + +on: + push: + branches: + - main + - develop + pull_request: + branches: + - main + - develop + +jobs: + call-pytest-workflow: + # Docs: https://github.com/ASFHyP3/actions + uses: ASFHyP3/actions/.github/workflows/reusable-pytest.yml@v0.8.3 + with: + local_package_name: hyp3lib + python_versions: >- + ["3.9", "3.10", "3.11", "3.12"] + + call-version-info-workflow: + # Docs: https://github.com/ASFHyP3/actions + uses: ASFHyP3/actions/.github/workflows/reusable-version-info.yml@v0.8.3 + + call-docker-ghcr-workflow: + needs: call-version-info-workflow + # Docs: https://github.com/ASFHyP3/actions + uses: ASFHyP3/actions/.github/workflows/reusable-docker-ghcr.yml@v0.8.3 + with: + version_tag: ${{ needs.call-version-info-workflow.outputs.version_tag }} + release_branch: main + develop_branch: develop + user: tools-bot + secrets: + USER_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 00a41f2..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Test with Pytest - -on: - push: - branches: - - main - - develop - pull_request: - branches: - - main - - develop - -jobs: - call-pytest-workflow: - uses: ASFHyP3/actions/.github/workflows/reusable-pytest.yml@v0.8.3 - with: - local_package_name: hyp3lib - python_versions: >- - ['3.7', '3.8', '3.9', '3.10']