Skip to content

Commit

Permalink
Upgrade GitHub Actions workflows to use Node.js v20.
Browse files Browse the repository at this point in the history
  • Loading branch information
eason9487 committed May 16, 2024
1 parent 35c41c7 commit f2ada27
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 44 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/backlog-automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,19 @@ on:
types:
- opened
- transferred
pull_request:
pull_request_target:
types:
- opened

# Leverage project write access for dependabot.
permissions:
repository-projects: write

jobs:
add-to-project:
name: Add issue/PR to project
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/add-to-project@v0.4.0
- uses: actions/add-to-project@v1.0.1
with:
project-url: https://github.com/orgs/woocommerce/projects/119
github-token: ${{ secrets.BOT_GH_TOKEN }}
8 changes: 6 additions & 2 deletions .github/workflows/branch-labels.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
name: Set PR Labels

on:
pull_request:
pull_request_target:
types: opened

jobs:
SetLabels:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Set Labels
uses: woocommerce/grow/branch-label@actions-v1
uses: woocommerce/grow/branch-label@actions-v2
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ jobs:
FORCE_COLOR: 2
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Prepare PHP
uses: woocommerce/grow/prepare-php@actions-v1
uses: woocommerce/grow/prepare-php@actions-v2
with:
install-deps: "no"

- name: Prepare node
uses: woocommerce/grow/prepare-node@actions-v1
uses: woocommerce/grow/prepare-node@actions-v2
with:
node-version-file: ".nvmrc"
ignore-scripts: "no"
Expand Down Expand Up @@ -69,13 +69,13 @@ jobs:

- name: Publish dev build to GitHub
if: ${{ github.event_name == 'push' && github.ref_name == 'develop' }}
uses: woocommerce/grow/publish-extension-dev-build@actions-v1
uses: woocommerce/grow/publish-extension-dev-build@actions-v2
with:
extension-asset-path: google-listings-and-ads.zip

- name: Publish build artifact
if: ${{ ! ( github.event_name == 'push' && github.ref_name == 'develop' ) }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: google-listings-and-ads.zip
path: ${{ github.workspace }}/google-listings-and-ads.zip
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ jobs:
FORCE_COLOR: 2
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Prepare PHP
uses: woocommerce/grow/prepare-php@actions-v1
uses: woocommerce/grow/prepare-php@actions-v2
with:
install-deps: "no"

- name: Prepare node
uses: woocommerce/grow/prepare-node@actions-v1
uses: woocommerce/grow/prepare-node@actions-v2
with:
node-version-file: ".nvmrc"
ignore-scripts: "no"
Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:

- name: Archive e2e failure screenshots
if: ${{ always() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: e2e-screenshots
path: tests/e2e/test-results/report/**/*.png
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/js-css-linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Prepare node
uses: woocommerce/grow/prepare-node@actions-v1
uses: woocommerce/grow/prepare-node@actions-v2
with:
node-version-file: ".nvmrc"

- name: Prepare annotation formatter
uses: woocommerce/grow/eslint-annotation@actions-v1
uses: woocommerce/grow/eslint-annotation@actions-v2

- name: Lint JavaScript and annotate linting errors
run: npm run lint:js -- --quiet --format ./eslintFormatter.cjs
Expand All @@ -46,15 +46,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Prepare node
uses: woocommerce/grow/prepare-node@actions-v1
uses: woocommerce/grow/prepare-node@actions-v2
with:
node-version-file: ".nvmrc"

- name: Prepare annotation formatter
uses: woocommerce/grow/stylelint-annotation@actions-v1
uses: woocommerce/grow/stylelint-annotation@actions-v2

- name: Lint CSS and annotate linting errors
run: npm run lint:css -- --custom-formatter ./stylelintFormatter.cjs
6 changes: 3 additions & 3 deletions .github/workflows/js-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ jobs:
FORCE_COLOR: 2
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Prepare node
uses: woocommerce/grow/prepare-node@actions-v1
uses: woocommerce/grow/prepare-node@actions-v2
with:
node-version-file: ".nvmrc"

- name: Run JavaScript unit tests
run: npm run test:js

- name: Upload JS unit coverage report
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
files: coverage/clover.xml
flags: js-unit-tests
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/php-coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Prepare PHP
uses: woocommerce/grow/prepare-php@actions-v1
uses: woocommerce/grow/prepare-php@actions-v2
with:
tools: cs2pr

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/php-hook-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# Checks out a branch instead of a commit in detached HEAD state
ref: ${{ github.head_ref }}

# This generates the documentation string. The `id` property is used to reference the output in the next step.
- name: Generate hook documentation
id: generate-hook-docs
uses: woocommerce/grow/hook-documentation@actions-v1
uses: woocommerce/grow/hook-documentation@actions-v2
with:
source-directories: src/,views/,google-listings-and-ads.php,uninstall.php

Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/php-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ jobs:
steps:
- name: Get Release versions from Wordpress
id: wp
uses: woocommerce/grow/get-plugin-releases@actions-v1
uses: woocommerce/grow/get-plugin-releases@actions-v2
with:
slug: wordpress
- name: Get Release versions from WooCommerce
id: wc
uses: woocommerce/grow/get-plugin-releases@actions-v1
uses: woocommerce/grow/get-plugin-releases@actions-v2
with:
slug: woocommerce

Expand Down Expand Up @@ -77,20 +77,20 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- if: matrix.wc-versions == needs.GetMatrix.outputs.latest-wc-version && matrix.php == 8.2
name: Set condition to generate coverage report (only on latest versions)
run: echo "generate_coverage=true" >> $GITHUB_ENV

- name: Prepare PHP
uses: woocommerce/grow/prepare-php@actions-v1
uses: woocommerce/grow/prepare-php@actions-v2
with:
php-version: "${{ matrix.php }}"
coverage: "${{ env.generate_coverage == 'true' && 'xdebug' || 'none' }}"

- name: Prepare MySQL
uses: woocommerce/grow/prepare-mysql@actions-v1
uses: woocommerce/grow/prepare-mysql@actions-v2

- name: Install WP tests
run: ./bin/install-wp-tests.sh wordpress_test root root localhost ${{ matrix.wp-version }} ${{ matrix.wc-versions }}
Expand All @@ -105,7 +105,7 @@ jobs:

- if: env.generate_coverage == 'true'
name: Upload PHP unit coverage report
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
files: tests/php-coverage/report.xml
flags: php-unit-tests
Expand All @@ -121,15 +121,15 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Prepare PHP
uses: woocommerce/grow/prepare-php@actions-v1
uses: woocommerce/grow/prepare-php@actions-v2
with:
php-version: "${{ inputs.php-version }}"

- name: Prepare MySQL
uses: woocommerce/grow/prepare-mysql@actions-v1
uses: woocommerce/grow/prepare-mysql@actions-v2

- name: Install WP tests
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/post-release-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
MergeTrunkDevelopPR:
runs-on: ubuntu-latest
steps:
- uses: woocommerce/grow/merge-trunk-develop-pr@actions-v1
- uses: woocommerce/grow/merge-trunk-develop-pr@actions-v2
4 changes: 2 additions & 2 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Create branch & PR
uses: woocommerce/grow/prepare-extension-release@actions-v1
uses: woocommerce/grow/prepare-extension-release@actions-v2
with:
version: ${{ github.event.inputs.version }}
type: ${{ github.event.inputs.type }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run-qit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ jobs:
needs: build
steps:
- name: Download artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: google-listings-and-ads.zip
- name: Run QIT Tests
# Update it with more stable path once merged.
uses: woocommerce/grow/run-qit-extension@actions-v1
uses: woocommerce/grow/run-qit-extension@actions-v2
with:
qit-partner-user: ${{ secrets.QIT_PARTNER_USER }}
qit-partner-secret: ${{ secrets.QIT_PARTNER_SECRET }}
Expand Down

0 comments on commit f2ada27

Please sign in to comment.