Skip to content

Commit

Permalink
fix: dev: remove deprecation warnings, update python/action versions
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen L Arnold <[email protected]>
  • Loading branch information
sarnold committed Aug 24, 2023
1 parent 5d888af commit 08b9303
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 54 deletions.
1 change: 0 additions & 1 deletion .github/workflows/bandit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ jobs:
- uses: actions/checkout@v3

- name: Run bandit
#uses: ioggstream/[email protected]
uses: VCTLabs/bandit-report-artifacts@master
with:
project_path: pystache
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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 }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand All @@ -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')}}
Expand Down
64 changes: 33 additions & 31 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 }}"
Expand All @@ -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

Expand All @@ -138,7 +138,7 @@ jobs:
with:
fetch-depth: 0

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON }}

Expand All @@ -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: |
Expand All @@ -171,21 +171,21 @@ 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
format: 'markdown'
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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 }}
Expand All @@ -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'
Expand Down
29 changes: 13 additions & 16 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Pylint
on:
workflow_dispatch:
pull_request:
branches: [ master ]
push:
branches: [ master ]

Expand Down Expand Up @@ -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
Expand All @@ -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]
Expand All @@ -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'
Expand All @@ -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}"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sphinx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
with:
fetch-depth: 0

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
with:
python-version: '3.9'

Expand All @@ -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/"
Expand Down

0 comments on commit 08b9303

Please sign in to comment.