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

Backport several GitHub Action workflow improvements to wp/trunk #33174

Merged
merged 7 commits into from
Jul 5, 2021
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
18 changes: 10 additions & 8 deletions .github/workflows/build-plugin-zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
name: Bump version
runs-on: ubuntu-latest
if: |
github.repository == 'WordPress/gutenberg' &&
github.event_name == 'workflow_dispatch' &&
github.ref == 'refs/heads/trunk' && (
github.event.inputs.version == 'rc' ||
Expand Down Expand Up @@ -110,26 +111,25 @@ jobs:
name: Build Release Artifact
runs-on: ubuntu-latest
needs: bump-version
if: always()
if: ${{ ( github.repository == 'WordPress/gutenberg' && always() ) || ( github.event_name == 'pull_request' && always() ) }}

steps:
- name: Checkout code
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
with:
ref: ${{ needs.bump-version.outputs.release_branch || github.ref }}

- name: Use Node.js 14.x
- name: Use desired version of NodeJS
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
with:
node-version: 14.x
node-version: 14

- name: Cache node modules
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
env:
cache-name: cache-node-modules
- name: Cache NPM packages
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-node-14-npm-cache-${{ hashFiles('**/package-lock.json') }}

- name: Build Gutenberg plugin ZIP file
run: ./bin/build-plugin-zip.sh
Expand Down Expand Up @@ -169,6 +169,8 @@ jobs:
name: Create Release Draft and Attach Asset
needs: [bump-version, build]
runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/gutenberg' }}

steps:
- name: Set Release Version
id: get_release_version
Expand Down
39 changes: 35 additions & 4 deletions .github/workflows/bundle-size.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
name: Compressed Size

on: [pull_request]
on:
pull_request:
paths:
# Any change to a CSS, Sass, or JavaScript file should run checks.
- '**.js'
- '**.css'
- '**.scss'
# Changes to any NPM related files could affect the outcome.
- '**package*.json'
# These files configures ESLint. Changes could affect the outcome.
- '**.eslint*'
# These files configures JSHint. Changes could affect the outcome.
- '**.jshint*'
# These files configures Prettier. Changes could affect the outcome.
- '**.prettier*'
# These files configures stylelint. Changes could affect the outcome.
- '**.stylelint*'
# These files configures TypeScript. Changes could affect the outcome.
- '**.tsconfig*'
# This file configures Webpack. Changes could affect the outcome.
- 'webpack.config.js'
# Changes to this workflow file should always verify the changes are successful.
- '.github/workflows/bundle-size.yml'

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
Expand All @@ -13,16 +35,25 @@ jobs:
build:
name: Check
runs-on: ubuntu-latest

strategy:
matrix:
node: ['14']
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
with:
fetch-depth: 1

- name: Use Node.js 14.x
- name: Use desired version of NodeJS
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
with:
node-version: 14.x
node-version: ${{ matrix.node }}

- name: Cache NPM packages
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-node-${{ matrix.node }}-npm-cache-${{ hashFiles('**/package-lock.json') }}

- uses: preactjs/compressed-size-action@7d87f60a6b0c7d193b8183ce859ed00b356ea92f # v2.1.0
with:
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/create-block.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,26 @@ jobs:
checks:
name: Checks
runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
strategy:
fail-fast: false
matrix:
node: [12, 14]
node: ['12', '14']

steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4

- name: Use Node.js ${{ matrix.node }}.x
- name: Use desired version of NodeJS
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
with:
node-version: ${{ matrix.node }}

- name: Cache node modules
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
env:
cache-name: cache-node-modules-${{ matrix.node }}
- name: Cache NPM packages
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-node-${{ matrix.node }}-npm-cache-${{ hashFiles('**/package-lock.json') }}

- name: npm install, build, format and lint
run: |
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/end2end-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,28 @@ concurrency:
jobs:
admin:
name: Admin - ${{ matrix.part }}

runs-on: ubuntu-latest

if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
strategy:
fail-fast: false
matrix:
part: [1, 2, 3, 4]
node: ['14']

steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4

- name: Use Node.js 14.x
- name: Use desired version of NodeJS
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
with:
node-version: 14.x
node-version: ${{ matrix.node }}

- name: Cache node modules
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
env:
cache-name: cache-node-modules
- name: Cache NPM packages
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-node-${{ matrix.node }}-npm-cache-${{ hashFiles('**/package-lock.json') }}

- name: Npm install and build
run: |
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,23 @@ concurrency:
jobs:
performance:
name: Run performance tests

runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/gutenberg' }}

steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4

- name: Use Node.js 14.x
- name: Use desired version of NodeJS
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
with:
node-version: 14.x
node-version: 14

- name: Cache node modules
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
env:
cache-name: cache-node-modules
- name: Cache NPM packages
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-node-14-npm-cache-${{ hashFiles('**/package-lock.json') }}

- name: Npm install
run: |
Expand Down
20 changes: 17 additions & 3 deletions .github/workflows/pull-request-automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,35 @@ name: Pull request automation
jobs:
pull-request-automation:
runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/gutenberg' }}
strategy:
matrix:
node: ['14']

steps:
# Checkout defaults to using the branch which triggered the event, which
# isn't necessarily `trunk` (e.g. in the case of a merge).
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
with:
ref: trunk

- name: Use Node.js 14.x
- name: Use desired version of NodeJS
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
with:
node-version: 14.x
node-version: ${{ matrix.node }}

- name: Cache NPM packages
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-node-${{ matrix.node }}-npm-pr-automation-cache-${{ hashFiles('**/package-lock.json') }}

# Changing into the action's directory and running `npm install` is much
# faster than a full project-wide `npm ci`.
- run: cd packages/project-management-automation && npm install
- name: Install NPM dependencies
run: npm install
working-directory: packages/project-management-automation

- uses: ./packages/project-management-automation
with:
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/rnmobile-android-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,28 @@ jobs:
strategy:
matrix:
native-test-name: [gutenberg-editor-initial-html]
node: ['14']

steps:
- name: checkout
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4

- name: Use Node.js 14.x
- name: Use desired version of NodeJS
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
with:
node-version: 14.x
node-version: ${{ matrix.node }}

- name: Restore npm cache
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
- name: Cache NPM packages
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
key: ${{ runner.os }}-node-${{ matrix.node }}-npm-cache-${{ hashFiles('**/package-lock.json') }}

- run: npm ci

- name: Restore Gradle cache
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/rnmobile-ios-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,40 +15,43 @@ concurrency:
jobs:
test:
runs-on: macos-latest
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}
strategy:
matrix:
xcode: [12.2]
native-test-name: [gutenberg-editor-initial-html]
node: ['14']

steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4

- name: Use Node.js 14.x
- name: Use desired version of NodeJS
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
with:
node-version: 14.x
node-version: ${{ matrix.node }}

- name: Restore npm cache
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
- name: Cache NPM packages
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
key: ${{ runner.os }}-node-${{ matrix.node }}-npm-cache-${{ hashFiles('**/package-lock.json') }}

- run: npm ci

- name: Prepare build cache key
run: find package-lock.json packages/react-native-editor/ios packages/react-native-aztec/ios packages/react-native-bridge/ios -type f -print0 | sort -z | xargs -0 shasum | tee ios-checksums.txt

- name: Restore build cache
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6
with:
path: |
packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app
packages/react-native-editor/ios/build/WDA
key: ${{ runner.os }}-ios-build-${{ matrix.xcode }}-${{ hashFiles('ios-checksums.txt') }}

- name: Restore pods cache
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6
with:
path: |
packages/react-native-editor/ios/Pods
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/stale-issue-add-needs-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
jobs:
stale:
runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/gutenberg' }}
steps:
- uses: actions/stale@996798eb71ef485dc4c7b4d3285842d714040c4a # v3.0.17
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/stale-issue-mark-stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
jobs:
stale:
runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/gutenberg' }}
steps:
- uses: actions/stale@996798eb71ef485dc4c7b4d3285842d714040c4a # v3.0.17
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/stale-issue-needs-info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
jobs:
stale:
runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/gutenberg' }}
steps:
- uses: actions/stale@996798eb71ef485dc4c7b4d3285842d714040c4a # v3.0.17
with:
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/static-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,23 @@ concurrency:
jobs:
check:
name: All

runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/gutenberg' || github.event_name == 'pull_request' }}

steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4

- name: Use Node.js 14.x
- name: Use desired version of NodeJS
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5
with:
node-version: 14.x
node-version: 14

- name: Cache node modules
uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4
env:
cache-name: cache-node-modules
- name: Cache NPM packages
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-node-14-npm-cache-${{ hashFiles('**/package-lock.json') }}

- name: Npm install and build
# A "full" install is executed, since `npm ci` does not always exit
Expand Down
Loading