Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade actions #235

Merged
merged 5 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/actions/base-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ runs:
echo "DEPENDENCY_TYPE=$DEPENDENCY_TYPE" >> $GITHUB_ENV

- name: Install Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
allow-prereleases: true
Expand All @@ -54,15 +54,15 @@ runs:
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: Cache pip
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ env.CACHE_PREFIX }}-pip-${{ env.PYTHON_VERSION }}-${{ hashFiles('setup.cfg', 'setup.py', '**/requirements.txt') }}
restore-keys: |
${{ env.CACHE_PREFIX }}-pip-${{ env.PYTHON_VERSION }}

- name: Install node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

Expand All @@ -77,7 +77,7 @@ runs:
[[ "$CACHE_DIR" == "undefined" ]] && CACHE_DIR=$(yarn cache dir)
echo "dir=$CACHE_DIR" >> $GITHUB_OUTPUT
- name: Cache yarn
uses: actions/cache@v3
uses: actions/cache@v4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand All @@ -87,15 +87,15 @@ runs:

- name: Cache checked links
if: ${{ matrix.group == 'link_check' }}
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pytest-link-check
key: ${{ env.CACHE_PREFIX }}-linkcheck-${{ hashFiles('**/*.md', '**/*.rst') }}-links
restore-keys: |
${{ env.CACHE_PREFIX }}-linkcheck-

- name: Cache conda
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/conda_pkgs_dir
key: ${{ env.CACHE_PREFIX }}-conda-${{ env.CACHE_NUMBER }}-${{
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/make-sdist/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ runs:
run: |
pip install build
python -m build --sdist
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: "sdist"
path: dist/*.tar.gz
15 changes: 11 additions & 4 deletions .github/actions/report-coverage/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,28 @@ inputs:
fail_under:
description: "The coverage amount to fail under"
default: 80
artifact_pattern:
description: ""
required: false
default: coverage-data*

runs:
using: "composite"
steps:
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
# Use latest Python, so it understands all syntax.
python-version: "3.11"
python-version: "3.12"

- run: python -Im pip install --upgrade coverage[toml]
shell: bash

- uses: actions/download-artifact@v3
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: coverage-data
pattern: ${{ inputs.artifact_pattern }}
delete-merged: true

- name: Combine coverage & fail if it's <${{inputs.fail_under}}.
shell: bash
Expand All @@ -34,7 +41,7 @@ runs:
python -Iim coverage report --fail-under=${{inputs.fail_under}}

- name: Upload HTML report if check failed.
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: html-report
path: htmlcov
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/test-sdist/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ runs:
using: "composite"
steps:
- name: Download sdist
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
- name: Install From SDist
shell: bash
run: |
Expand Down
6 changes: 4 additions & 2 deletions .github/actions/update-snapshots/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ runs:
working-directory: ${{ inputs.test_folder }}
run: |
${{ inputs.npm_client }} install
# Force installing the dependencies
npx playwright install-deps || true
${{ inputs.npm_client }} run playwright install ${{ inputs.chromium }}

- name: Wait for the server
Expand Down Expand Up @@ -103,13 +105,13 @@ runs:
echo "::endgroup::"

- name: Upload snapshots as artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact_name }}
path: ${{ inputs.test_folder }}/**/*-snapshots/*.*

- name: Upload report as artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.report_name }}
path: ${{ inputs.test_folder }}/playwright-report
Expand Down
11 changes: 9 additions & 2 deletions .github/actions/upload-coverage/action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: "Upload Coverage"
description: "Upload the coverage report(s) for this job"

inputs:
# Optional inputs
artifact_name:
description: The artifact name - useful if multiple artifacts are created
required: false
default: coverage-data

runs:
using: "composite"
steps:
Expand All @@ -11,8 +18,8 @@ runs:
mv .coverage ".coverage.-$$-$RANDOM"
fi
- name: Upload coverage data
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-data
name: ${{ inputs.artifact_name }}
path: ".coverage.*"
if-no-files-found: ignore
5 changes: 4 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Base Setup
uses: ./.github/actions/base-setup
with:
node_version: 15.0
node_version: 18.0
- name: Check Hatch Version
run: hatch --version

Expand Down Expand Up @@ -189,6 +189,7 @@ jobs:
test_folder: ${{ env.TEST_FOLDER }}
server_url: https-get://playwright.dev
dry_run: yes
artifact_name: playwright-manual-snapshots

update_snapshots:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -265,6 +266,8 @@ jobs:
python -m coverage run -m pytest foobar.py
ls -a
- uses: ./.github/actions/upload-coverage
with:
artifact_name: coverage-data-${{ matrix.os }}

coverage_report:
name: Combine & check coverage
Expand Down
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ repos:
hooks:
- id: prettier
types_or: [yaml, html, json]
# Ignore package.json because its indentation is switched to 4 when upgrading the version
exclude: ^package.json$

- repo: https://github.com/adamchainz/blacken-docs
rev: "1.16.0"
Expand Down
Loading