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

Update workflow to use latest checkout actions #45199

Merged
merged 8 commits into from
Feb 29, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
124 changes: 62 additions & 62 deletions .github/actions/setup-woocommerce-monorepo/action.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,66 @@
name: 'Setup WooCommerce Monorepo'
description: 'A composite action bundling together the setup of dependencies and optional installation and building of projects.'
inputs:
php-version:
description: 'The PHP version that should be installed. Use "false" to skip PHP installation.'
default: '7.4'
install:
description: 'Given a boolean or PNPM filter, runs the install command for monorepo project(s).'
default: false
build:
description: 'Given a boolean or PNPM filter, runs the build command for monorepo project(s).'
default: false
php-version:
description: 'The PHP version that should be installed. Use "false" to skip PHP installation.'
default: '7.4'
install:
description: 'Given a boolean or PNPM filter, runs the install command for monorepo project(s).'
default: false
build:
description: 'Given a boolean or PNPM filter, runs the build command for monorepo project(s).'
default: false
runs:
using: 'composite'
steps:
- name: 'Read PNPM Version'
id: 'read-pnpm-version'
shell: 'bash'
run: 'echo "version=$(./.github/actions/setup-woocommerce-monorepo/scripts/read-pnpm-version.sh package.json)" >> $GITHUB_OUTPUT'
- name: 'Setup PNPM'
uses: 'pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598'
with:
version: ${{ steps.read-pnpm-version.outputs.version }}
- name: 'Setup Node'
uses: 'actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65'
with:
node-version-file: '.nvmrc'
# We only want to use the cache if something is being installed.
cache: ${{ inputs.install != 'false' && 'pnpm' || '' }}
- name: 'Setup PHP'
if: ${{ inputs.php-version != 'false' }}
uses: 'shivammathur/setup-php@a36e1e52ff4a1c9e9c9be31551ee4712a6cb6bd0'
with:
php-version: '${{ inputs.php-version }}'
coverage: 'none'
- name: 'Cache Composer Dependencies'
if: ${{ inputs.php-version != 'false' }}
uses: 'actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84'
with:
path: '~/.cache/composer/files'
key: "${{ runner.os }}-composer-${{ hashFiles( '**/composer.lock' ) }}"
restore-keys: '${{ runner.os }}-composer-'
- name: 'Parse Project Filters'
id: 'project-filters'
shell: 'bash'
run: |
echo "install=$(node ./.github/actions/setup-woocommerce-monorepo/scripts/parse-input-filter.js '${{ inputs.install }}')" >> $GITHUB_OUTPUT
echo "build=$(node ./.github/actions/setup-woocommerce-monorepo/scripts/parse-input-filter.js '${{ inputs.build }}')" >> $GITHUB_OUTPUT
- name: 'Install Project Dependencies'
# Boolean inputs aren't parsed into filters so it'll either be "true" or there will be a filter.
if: ${{ inputs.install == 'true' || steps.project-filters.outputs.install != '' }}
shell: 'bash'
run: 'pnpm install'
# `pnpm install` filtering is broken: https://github.com/pnpm/pnpm/issues/6300
# run: 'pnpm install ${{ steps.project-filters.outputs.install }}'
# We want to include an option to build projects using this action so that we can make
# sure that the build cache is always used when building projects.
- name: 'Cache Build Output'
# Boolean inputs aren't parsed into filters so it'll either be "true" or there will be a filter.
if: ${{ inputs.build == 'true' || steps.project-filters.outputs.build != '' }}
uses: 'google/wireit@f3a3c79c553122e2fe5829eeac7d815326502903'
- name: 'Build'
# Boolean inputs aren't parsed into filters so it'll either be "true" or there will be a filter.
if: ${{ inputs.build == 'true' || steps.project-filters.outputs.build != '' }}
shell: 'bash'
run: 'pnpm ${{ steps.project-filters.outputs.build }} build'
using: 'composite'
steps:
- name: 'Read PNPM Version'
id: 'read-pnpm-version'
shell: 'bash'
run: 'echo "version=$(./.github/actions/setup-woocommerce-monorepo/scripts/read-pnpm-version.sh package.json)" >> $GITHUB_OUTPUT'
- name: 'Setup PNPM'
uses: 'pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d'
with:
version: ${{ steps.read-pnpm-version.outputs.version }}
- name: 'Setup Node'
uses: 'actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65'
with:
node-version-file: '.nvmrc'
# We only want to use the cache if something is being installed.
cache: ${{ inputs.install != 'false' && 'pnpm' || '' }}
- name: 'Setup PHP'
if: ${{ inputs.php-version != 'false' }}
uses: 'shivammathur/setup-php@a36e1e52ff4a1c9e9c9be31551ee4712a6cb6bd0'
with:
php-version: '${{ inputs.php-version }}'
coverage: 'none'
- name: 'Cache Composer Dependencies'
if: ${{ inputs.php-version != 'false' }}
uses: 'actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319'
with:
path: '~/.cache/composer/files'
key: "${{ runner.os }}-composer-${{ hashFiles( '**/composer.lock' ) }}"
restore-keys: '${{ runner.os }}-composer-'
- name: 'Parse Project Filters'
id: 'project-filters'
shell: 'bash'
run: |
echo "install=$(node ./.github/actions/setup-woocommerce-monorepo/scripts/parse-input-filter.js '${{ inputs.install }}')" >> $GITHUB_OUTPUT
echo "build=$(node ./.github/actions/setup-woocommerce-monorepo/scripts/parse-input-filter.js '${{ inputs.build }}')" >> $GITHUB_OUTPUT
- name: 'Install Project Dependencies'
# Boolean inputs aren't parsed into filters so it'll either be "true" or there will be a filter.
if: ${{ inputs.install == 'true' || steps.project-filters.outputs.install != '' }}
shell: 'bash'
run: 'pnpm install'
# `pnpm install` filtering is broken: https://github.com/pnpm/pnpm/issues/6300
# run: 'pnpm install ${{ steps.project-filters.outputs.install }}'
# We want to include an option to build projects using this action so that we can make
# sure that the build cache is always used when building projects.
- name: 'Cache Build Output'
# Boolean inputs aren't parsed into filters so it'll either be "true" or there will be a filter.
if: ${{ inputs.build == 'true' || steps.project-filters.outputs.build != '' }}
uses: 'google/wireit@4aad131006ea85c1e42af927534ebb13426dd730'
- name: 'Build'
# Boolean inputs aren't parsed into filters so it'll either be "true" or there will be a filter.
if: ${{ inputs.build == 'true' || steps.project-filters.outputs.build != '' }}
shell: 'bash'
run: 'pnpm ${{ steps.project-filters.outputs.build }} build'
22 changes: 11 additions & 11 deletions .github/workflows/non-cot-pr-build-and-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ permissions: {}
jobs:
non-hpos-e2e-tests-run:
name: Runs E2E tests with HPOS disabled.
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
Expand All @@ -31,7 +31,7 @@ jobs:
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/allure-results
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/allure-report
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup WooCommerce Monorepo
uses: ./.github/actions/setup-woocommerce-monorepo
Expand Down Expand Up @@ -73,12 +73,12 @@ jobs:
if: ${{ always() }}
steps:
- run: |
result="${{ needs.non-hpos-e2e-tests-run.result }}"
if [[ $result != "success" && $result != "skipped" ]]; then
echo "One or more e2e tests have failed!"
exit 1
fi
echo "e2e tests have completed successfully."
result="${{ needs.non-hpos-e2e-tests-run.result }}"
if [[ $result != "success" && $result != "skipped" ]]; then
echo "One or more e2e tests have failed!"
exit 1
fi
echo "e2e tests have completed successfully."

merge-reports:
name: Merge e2e test reports
Expand All @@ -91,7 +91,7 @@ jobs:
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-results
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-report
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup WooCommerce Monorepo
uses: ./.github/actions/setup-woocommerce-monorepo
with:
Expand Down Expand Up @@ -126,14 +126,14 @@ jobs:

non-hpos-api-tests-run:
name: Runs API tests with HPOS disabled.
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
permissions:
contents: read
env:
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/api-test-report/allure-results
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/api-test-report/allure-report
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup WooCommerce Monorepo
uses: ./.github/actions/setup-woocommerce-monorepo
Expand Down
36 changes: 18 additions & 18 deletions .github/workflows/pr-build-and-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
outputs:
E2E_GRAND_TOTAL: ${{ steps.count_e2e_total.outputs.E2E_GRAND_TOTAL }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup WooCommerce Monorepo
uses: ./.github/actions/setup-woocommerce-monorepo
Expand Down Expand Up @@ -87,12 +87,12 @@ jobs:
if: ${{ always() }}
steps:
- run: |
result="${{ needs.e2e-tests-run.result }}"
if [[ $result != "success" && $result != "skipped" ]]; then
echo "One or more e2e tests have failed!"
exit 1
fi
echo "e2e tests have completed successfully."
result="${{ needs.e2e-tests-run.result }}"
if [[ $result != "success" && $result != "skipped" ]]; then
echo "One or more e2e tests have failed!"
exit 1
fi
echo "e2e tests have completed successfully."

merge-reports:
name: Merge e2e test reports
Expand All @@ -105,7 +105,7 @@ jobs:
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-results
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/e2e-pw/test-results/allure-report
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup WooCommerce Monorepo
uses: ./.github/actions/setup-woocommerce-monorepo
with:
Expand Down Expand Up @@ -140,14 +140,14 @@ jobs:

api-tests-run:
name: Runs API tests.
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
permissions:
contents: read
env:
ALLURE_RESULTS_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/test-results/allure-results
ALLURE_REPORT_DIR: ${{ github.workspace }}/plugins/woocommerce/tests/api-core-tests/test-results/allure-report
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup WooCommerce Monorepo
uses: ./.github/actions/setup-woocommerce-monorepo
Expand Down Expand Up @@ -196,11 +196,11 @@ jobs:
k6-tests-run:
name: Runs k6 Performance tests
if: github.event.pull_request.user.login != 'github-actions[bot]'
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup WooCommerce Monorepo
uses: ./.github/actions/setup-woocommerce-monorepo
Expand Down Expand Up @@ -234,7 +234,7 @@ jobs:
contains( needs.*.result, 'success' ) ||
contains( needs.*.result, 'failure' )
)
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
needs: [api-tests-run, merge-reports]
permissions:
contents: read
Expand All @@ -251,7 +251,7 @@ jobs:
mkdir -p output

- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: repo

Expand All @@ -269,7 +269,7 @@ jobs:

- name: Prepare test summary
id: prepare-test-summary
uses: actions/github-script@v6
uses: actions/github-script@v7
env:
API_SUMMARY_PATH: ${{ github.workspace }}/artifacts/api/allure-report/widgets/summary.json
E2E_PW_SUMMARY_PATH: ${{ github.workspace }}/artifacts/e2e/allure-report/widgets/summary.json
Expand All @@ -282,15 +282,15 @@ jobs:
return await script( { core } )

- name: Find PR comment by github-actions[bot]
uses: peter-evans/find-comment@034abe94d3191f9c89d870519735beae326f2bdb
uses: peter-evans/find-comment@d5fe37641ad8451bdd80312415672ba26c86575e
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Test Results Summary

- name: Create or update PR comment
uses: peter-evans/create-or-update-comment@67dcc547d311b736a8e6c5c236542148a47adc3d
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
Expand All @@ -307,7 +307,7 @@ jobs:
contains( needs.*.result, 'success' ) ||
contains( needs.*.result, 'failure' )
)
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
needs: [api-tests-run, merge-reports, k6-tests-run]
env:
GITHUB_TOKEN: ${{ secrets.REPORTS_TOKEN }}
Expand Down
4 changes: 4 additions & 0 deletions plugins/woocommerce/changelog/dev-update-workflow-node-20
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Updates the PR testing workflow to use checkout v4 to eliminate GH node 16 warning
1 change: 1 addition & 0 deletions plugins/woocommerce/tests/e2e-pw/playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const config = {
retries: CI ? 2 : 0,
repeatEach: REPEAT_EACH ? Number( REPEAT_EACH ) : 1,
workers: 1,
reportSlowTests: { max: 5, threshold: 30 * 1000 }, // 30 seconds threshold
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I picked some somewhat arbitrary numbers here, we can adjust. What this says is that a test will be reported as slow if it takes longer than 30 seconds. The max number is that it's reporting the 5 slowest tests per shard... having a list of more than 25 tests probably isn't super productive.

reporter: [
[ 'list' ],
[
Expand Down