From 08b9303519645ca2507ce66b0af557ba3f8928a9 Mon Sep 17 00:00:00 2001 From: Stephen L Arnold Date: Wed, 23 Aug 2023 18:50:14 -0700 Subject: [PATCH] fix: dev: remove deprecation warnings, update python/action versions Signed-off-by: Stephen L Arnold --- .github/workflows/bandit.yml | 1 - .github/workflows/ci.yml | 4 +-- .github/workflows/conda.yml | 4 +-- .github/workflows/coverage.yml | 64 ++++++++++++++++++---------------- .github/workflows/pylint.yml | 29 +++++++-------- .github/workflows/sphinx.yml | 4 +-- 6 files changed, 52 insertions(+), 54 deletions(-) diff --git a/.github/workflows/bandit.yml b/.github/workflows/bandit.yml index 5b37e24e..5281aca1 100644 --- a/.github/workflows/bandit.yml +++ b/.github/workflows/bandit.yml @@ -12,7 +12,6 @@ jobs: - uses: actions/checkout@v3 - name: Run bandit - #uses: ioggstream/bandit-report-artifacts@v0.0.2 uses: VCTLabs/bandit-report-artifacts@master with: project_path: pystache diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44aac0f0..23cd9b0c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-20.04, macos-latest, windows-latest] - python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] + python-version: ['3.8', '3.9', '3.10', '3.11'] steps: - name: Set git crlf/eol run: | @@ -35,7 +35,7 @@ jobs: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/conda.yml b/.github/workflows/conda.yml index 96414b63..26b73eed 100644 --- a/.github/workflows/conda.yml +++ b/.github/workflows/conda.yml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: platform: [ubuntu-20.04, windows-latest, macos-latest] - python-version: [3.7, 3.9] + python-version: [3.8, 3.9] runs-on: ${{ matrix.platform }} @@ -28,7 +28,7 @@ jobs: fetch-depth: 0 - name: Cache conda - uses: actions/cache@v1 + uses: actions/cache@v3 with: path: ~/conda_pkgs_dir key: ${{matrix.os}}-conda-pkgs-${{hashFiles('**/conda/meta.yaml')}} diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index f38e9320..6a4d76be 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -1,12 +1,12 @@ -# internal coverage with PR comment and badge v0.0.4 -# Note this works for public orgs but probably only for "internal" -# pull requests. In the case of fork PRs, there needs to be org-level +# internal coverage with PR comment and badge v0.0.5 +# Note this works for public orgs but only for "internal" pull +# requests. In the case of fork PRs, there needs to be org-level # github app with private key => ACCESS_TOKEN, with more job isolation # and output passing in this workflow. # # This version has updated actions and coverage value regex, no fork isolation -# yet. Badge and comment job logic should be tuned for personal vs org use -# (fork PRs still needs the big refactor; see badge job comments below). +# yet. This version checks for both repo owner and author_association = MEMBER +# so PR comments *should* be more available. name: Coverage on: @@ -21,7 +21,7 @@ jobs: name: Prepare CI environment runs-on: ubuntu-20.04 outputs: - commit_message: ${{ steps.get_commit_message.outputs.commit_message }} + #commit_message: ${{ steps.get_commit_message.outputs.commit_message }} branch: ${{ steps.extract_branch.outputs.branch }} steps: @@ -35,13 +35,13 @@ jobs: run: | bash -c set - - name: "Get commit message" - id: get_commit_message - env: - COMMIT_PUSH: ${{ github.event.head_commit.message }} - run: | - COMMIT_MESSAGE="${COMMIT_PUSH:-$(git log --format=%B -n 1 HEAD^2)}" - echo "::set-output name=commit_message::${COMMIT_MESSAGE}" + #- name: "Get commit message" + #id: get_commit_message + #env: + #COMMIT_PUSH: ${{ github.event.head_commit.message }} + #run: | + #COMMIT_MESSAGE="${COMMIT_PUSH:-$(git log --format=%B -n 1 HEAD^2)}" + #echo "commit_message=${COMMIT_MESSAGE}" >> $GITHUB_OUTPUT - name: Extract branch name id: extract_branch @@ -56,7 +56,7 @@ jobs: else EXPORT_VALUE="${TMP_GITHUB_REF}" fi - echo "##[set-output name=branch;]${EXPORT_VALUE}" + echo "branch=${EXPORT_VALUE}" >> $GITHUB_OUTPUT base: name: Base coverage @@ -87,13 +87,13 @@ jobs: else EXPORT_VALUE="${TMP_GITHUB_REF}" fi - echo "##[set-output name=base_branch;]${EXPORT_VALUE}" + echo "base_branch=${EXPORT_VALUE}" >> $GITHUB_OUTPUT if [ -f "${EXPORT_VALUE}/${FILE}" ] then echo "Base coverage found on ${EXPORT_VALUE}" BASE_COV=$(cat "${EXPORT_VALUE}/${FILE}") echo "Base coverage is: ${BASE_COV}" - echo "##[set-output name=base_cov;]${BASE_COV}" + echo "base_cov=${BASE_COV}" >> $GITHUB_OUTPUT else echo "Base coverage NOT found on ${EXPORT_VALUE}!!" fi @@ -107,12 +107,12 @@ jobs: - name: Check github variables # NOTE base coverage env var may be empty here env: - COMMIT_MESSAGE: ${{ needs.pre_ci.outputs.commit_message }} + #COMMIT_MESSAGE: ${{ needs.pre_ci.outputs.commit_message }} EXPORT_VALUE: ${{ needs.pre_ci.outputs.branch }} BASE_BRANCH: ${{ needs.base.outputs.base_branch }} BASE_COVERAGE: ${{ needs.base.outputs.base_cov }} run: | - echo "Commit message: ${COMMIT_MESSAGE}" + #echo "Commit message: ${COMMIT_MESSAGE}" echo "Export value (head_ref): ${EXPORT_VALUE}" echo "Base value (base_ref): ${BASE_BRANCH}" echo "Base coverage (percent): ${{ env.BASE_COVERAGE }}" @@ -129,7 +129,7 @@ jobs: coverage-rounded-display: ${{ steps.coverage.outputs.coverage-rounded-display }} env: PLATFORM: ubuntu-20.04 - PYTHON: 3.9 + PYTHON: '3.11' PYTHONIOENCODING: utf-8 PIP_DOWNLOAD_CACHE: ${{ github.workspace }}/../.pip_download_cache @@ -138,7 +138,7 @@ jobs: with: fetch-depth: 0 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON }} @@ -152,12 +152,12 @@ jobs: tox -e py - name: Code Coverage Summary Report (data) - uses: irongut/CodeCoverageSummary@v1.2.0 + uses: irongut/CodeCoverageSummary@v1.3.0 with: filename: coverage.xml output: 'both' - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: src_coverage_rpts path: | @@ -171,12 +171,12 @@ jobs: VALUE: "Branch Rate" run: | COVERAGE=$( cat code-coverage-results.txt | grep -e ^Summary | grep -o -E "${VALUE} = .{3}" | egrep -o '([0-9]+)' ) - echo "##[set-output name=coverage;]${COVERAGE}" - echo "##[set-output name=coverage-rounded-display;]${COVERAGE}%" + echo "coverage=${COVERAGE}" >> $GITHUB_OUTPUT + echo "coverage-rounded-display=${COVERAGE}%" >> $GITHUB_OUTPUT echo "Current coverage is: ${COVERAGE}%" - name: Code Coverage Summary Report - uses: irongut/CodeCoverageSummary@v1.2.0 + uses: irongut/CodeCoverageSummary@v1.3.0 if: ${{ github.event_name == 'pull_request' }} with: filename: coverage.xml @@ -184,8 +184,8 @@ jobs: output: 'both' - name: Add Coverage PR Comment - uses: marocchino/sticky-pull-request-comment@v2.2.0 - if: ${{ github.event_name == 'pull_request' && github.actor == github.repository_owner }} + uses: marocchino/sticky-pull-request-comment@v2 + if: github.event_name == 'pull_request' && (github.event.pull_request.author_association == 'MEMBER' || github.actor == github.repository_owner) with: header: coverage recreate: true @@ -206,10 +206,12 @@ jobs: COVERAGE: ${{ needs.cov_data.outputs.coverage }} COVERAGE_ROUNDED: ${{ needs.cov_data.outputs.coverage-rounded-display }} BASE_COVERAGE: ${{ needs.base.outputs.base_cov }} + MEMBER: ${{ github.event.pull_request.author_association }} run: | echo "Coverage: ${COVERAGE}" echo "Coverage Rounded: ${COVERAGE_ROUNDED}" echo "Coverage on Base Branch: ${BASE_COVERAGE}" + echo "Author assoc: ${MEMBER}" comment_cov_change: name: Comment on PR with coverage delta @@ -273,8 +275,8 @@ jobs: fi - name: Comment PR with test coverage delta - uses: marocchino/sticky-pull-request-comment@v2.2.0 - if: env.HAVE_BASE_COVERAGE == 'true' && github.actor == github.repository_owner + uses: marocchino/sticky-pull-request-comment@v2 + if: env.HAVE_BASE_COVERAGE == 'true' && (github.event.pull_request.author_association == 'MEMBER' || github.actor == github.repository_owner) with: header: delta recreate: true @@ -293,7 +295,7 @@ jobs: name: Generate badge image with test coverage value runs-on: ubuntu-20.04 needs: [test, pre_ci] - if: ${{ github.event_name == 'push' }} + if: github.event_name == 'push' outputs: url: ${{ steps.url.outputs.url }} markdown: ${{ steps.url.outputs.markdown }} @@ -306,7 +308,7 @@ jobs: # Use the output from the `coverage` step - name: Generate the badge SVG image - uses: emibcn/badge-action@v1 + uses: emibcn/badge-action@v2.0.2 id: badge with: label: 'Branch Coverage' diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 90bd1b8b..facfd28e 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -3,6 +3,7 @@ name: Pylint on: workflow_dispatch: pull_request: + branches: [ master ] push: branches: [ master ] @@ -36,21 +37,17 @@ jobs: else EXPORT_VALUE="${TMP_GITHUB_REF}" fi - echo "##[set-output name=branch;]${EXPORT_VALUE}" + echo "branch=${EXPORT_VALUE}" >> $GITHUB_OUTPUT - - name: Set up Python 3.8 - uses: actions/setup-python@v2 + - name: Set up Python 3.9 + uses: actions/setup-python@v4 with: - python-version: 3.8 + python-version: 3.9 - name: Install tox run: | python -m pip install --upgrade pip wheel - pip install tox tox-gh-actions - - #- name: Run tox - #run: | - #bash -c 'tox -e lint' + pip install tox - name: Run pylint id: analyze @@ -59,19 +56,19 @@ jobs: run: | rating=$(bash -c 'tox -e lint' | grep 'Your code has been rated at' | cut -f7 -d " ") echo "Pylint score: ${rating}" - echo "##[set-output name=rating;]${rating}" - echo "##[set-output name=path;]${BADGE_PATH}" + echo "rating=${rating}" >> $GITHUB_OUTPUT + echo "path=${BADGE_PATH}" >> $GITHUB_OUTPUT badge: # Only generate and publish if these conditions are met: # - The previous job/analyze step ended successfully # - At least one of these is true: - # - This is a push event and the push event is on branch 'master' or 'develop' + # - This is a push event and the push event is on branch 'main' or 'develop' # Note: if this repo is personal (ie, not an org repo) then you can # use the following to change the scope of the next 2 jobs # instead of running on branch push as shown below: # - This is a pull request event and the pull actor is the same as the repo owner - # if: ${{ ( github.event_name == 'pull_request' && github.actor == github.repository_owner ) || github.ref == 'refs/heads/master' }} + # if: ${{ ( github.event_name == 'pull_request' && github.actor == github.repository_owner ) || github.ref == 'refs/heads/main' }} name: Generate badge image with pylint score runs-on: ubuntu-20.04 needs: [pylint] @@ -85,7 +82,7 @@ jobs: # Use the output from the `analyze` step - name: Create pylint badge - uses: emibcn/badge-action@v1 + uses: emibcn/badge-action@v2.0.2 id: badge with: label: 'Pylint score' @@ -99,8 +96,8 @@ jobs: FILE: 'pylint-score.svg' working-directory: ./badges run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" + git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" mkdir -p "${BRANCH}" mv "${FILE}" "${BRANCH}" git add "${BRANCH}/${FILE}" diff --git a/.github/workflows/sphinx.yml b/.github/workflows/sphinx.yml index b46728a3..014ec270 100644 --- a/.github/workflows/sphinx.yml +++ b/.github/workflows/sphinx.yml @@ -15,7 +15,7 @@ jobs: with: fetch-depth: 0 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 with: python-version: '3.9' @@ -29,7 +29,7 @@ jobs: #tox -e docs-lint tox -e docs - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: ApiDocsHTML path: "docs/_build/html/"