Skip to content

Commit

Permalink
Run pnpm import and squash other changes to ease rebasing
Browse files Browse the repository at this point in the history
  • Loading branch information
sarayourfriend committed Feb 8, 2022
1 parent 96e3d2f commit ee56705
Show file tree
Hide file tree
Showing 20 changed files with 27,209 additions and 58,836 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

## Checklist:
- [ ] My code is tested.
- [ ] My code follows the WordPress code style. <!-- Check code: `npm run lint`, Guidelines: https://developer.wordpress.org/coding-standards/wordpress-coding-standards/javascript/ -->
- [ ] My code follows the WordPress code style. <!-- Check code: `pnpm run lint`, Guidelines: https://developer.wordpress.org/coding-standards/wordpress-coding-standards/javascript/ -->
- [ ] My code follows the accessibility standards. <!-- Guidelines: https://developer.wordpress.org/coding-standards/wordpress-coding-standards/accessibility/ -->
- [ ] I've tested my changes with keyboard and screen readers. <!-- Instructions: https://github.com/WordPress/gutenberg/blob/HEAD/docs/contributors/accessibility-testing.md -->
- [ ] My code has proper inline documentation. <!-- Guidelines: https://developer.wordpress.org/coding-standards/inline-documentation-standards/javascript/ -->
Expand Down
53 changes: 53 additions & 0 deletions .github/action/setup-node-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# this is a reusable workflow that will be called by the
# push_staging and push_production workflows
# more info: https://docs.github.com/en/actions/learn-github-actions/reusing-workflows

name: gutenberg/setup-node-env
description: Setup the Node.js environment including `pnpm` and dependencies

inputs:
install:
default: true
description: Whether to install dependencies.
install-working-directory:
required: false
description: Optional working directory to run installation in.
frozen-lockfile:
default: false
description: Whether to install dependencies using `--frozen-lockfile`.
node-version:
default: 14
description: The node version to use.
pnpm-version:
default: 6.29.1
description: The pnpm version to use.

runs:
using: 'composite'
steps:
- uses: pnpm/[email protected]
with:
version: ${{ inputs.pnpm-version }}

- name: Cache pnpm modules
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: actions/[email protected]
with:
node-version: ${{ inputs.node-version }}
cache: pnpm
cache-dependency-path: |
pnpm-workspace.yaml
pnpm-lock.yaml
.npmrc
- name: Install
if: inputs.install
shell: bash
run: "pnpm install ${{ inputs.frozen-lockfile && '--frozen-lockfile' || '' }}"
working-directory: ${{ inputs.install-working-directory }}
8 changes: 2 additions & 6 deletions .github/workflows/build-plugin-zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,7 @@ jobs:
with:
ref: ${{ needs.bump-version.outputs.release_branch || github.ref }}

- name: Use desired version of NodeJS
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
with:
node-version: 14
cache: npm
- uses: ./.github/action/setup-node-env

- name: Build Gutenberg plugin ZIP file
run: ./bin/build-plugin-zip.sh
Expand All @@ -192,7 +188,7 @@ jobs:
run: |
IFS='.' read -r -a VERSION_ARRAY <<< "${VERSION}"
MILESTONE="Gutenberg ${VERSION_ARRAY[0]}.${VERSION_ARRAY[1]}"
npm run changelog -- --milestone="$MILESTONE" --unreleased > release-notes.txt
pnpm run changelog -- --milestone="$MILESTONE" --unreleased > release-notes.txt
sed -ie '1,6d' release-notes.txt
if [[ ${{ needs.bump-version.outputs.new_version }} != *"rc"* ]]; then
# Include previous RCs' release notes, if any
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/bundle-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ jobs:
with:
fetch-depth: 1

- name: Use desired version of NodeJS
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
with:
node-version: ${{ matrix.node }}
cache: npm
- uses: ./.github/action/setup-node-env

- uses: preactjs/compressed-size-action@df6e03e187079aef959a2878311639c77b95ee2e # v2.2.0
with:
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/create-block.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,11 @@ jobs:
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4

- name: Use desired version of NodeJS
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
- uses: ./.github/action/setup-node-env
with:
node-version: ${{ matrix.node }}
cache: npm
node-version: ${{ matrix-node }}
frozen-lockfile: true

- name: npm install, build, format and lint
- name: build, format and lint
shell: bash
run: |
npm ci
bash ./bin/test-create-block.sh
run: bash ./bin/test-create-block.sh
13 changes: 5 additions & 8 deletions .github/workflows/end2end-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,17 @@ jobs:
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4

- name: Use desired version of NodeJS
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
- uses: ./.github/action/setup-node-env
with:
node-version: ${{ matrix.node }}
cache: npm
frozen-lockfile: true

- name: Npm install and build
run: |
npm ci
npm run build
- name: Build
run: pnpm run build

- name: Install WordPress
run: |
npm run wp-env start
pnpm run wp-env start
- name: Running the tests
run: |
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/flaky-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,9 @@ jobs:
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4

- name: Use desired version of NodeJS
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
- uses: ./.github/action/setup-node-env
with:
node-version: 14
cache: npm

- name: Npm install
run: |
npm ci
frozen-lockfile: true

- name: Report flaky tests
uses: ./.github/report-flaky-tests
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,10 @@ jobs:
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4

- name: Use desired version of NodeJS
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
- uses: ./.github/action/setup-node-env
with:
node-version: 14
cache: npm

- name: Npm install
run: |
npm ci
frozen-lockfile: true

- name: Compare performance with trunk
if: github.event_name == 'pull_request'
Expand Down
17 changes: 2 additions & 15 deletions .github/workflows/pull-request-automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,10 @@ jobs:
with:
ref: trunk

- name: Use desired version of NodeJS
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
- uses: ./.github/action/setup-node-env
with:
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`.
- name: Install NPM dependencies
run: npm install
working-directory: packages/project-management-automation
install-working-directory: packages/project-management-automation

- uses: ./packages/project-management-automation
with:
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/rnmobile-android-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,10 @@ jobs:
- name: checkout
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4

- name: Use desired version of NodeJS
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
- uses: ./.github/action/setup-node-env
with:
node-version: ${{ matrix.node }}
cache: npm

- run: npm ci
frozen-lockfile: true

- name: Restore Gradle cache
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6
Expand All @@ -44,7 +41,7 @@ jobs:
api-level: 28
emulator-build: 7425822 # https://git.io/JE3jX
profile: pixel_xl
script: npm run native test:e2e:android:local ${{ matrix.native-test-name }}
script: pnpm run native test:e2e:android:local ${{ matrix.native-test-name }}

- uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2
if: always()
Expand Down
19 changes: 8 additions & 11 deletions .github/workflows/rnmobile-ios-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,13 @@ jobs:
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4

- name: Use desired version of NodeJS
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
- uses: ./.github/action/setup-node-env
with:
node-version: ${{ matrix.node }}
cache: npm

- run: npm ci
frozen-lockfile: true

- 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
run: find pnpm-lock.yaml 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@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6
Expand All @@ -53,25 +50,25 @@ jobs:
~/Library/Caches/CocoaPods
~/.cocoapods/repos/trunk
packages/react-native-editor/ios/vendor
key: ${{ runner.os }}-pods-${{ hashFiles('packages/react-native-editor/ios/Gemfile.lock') }}-${{ hashFiles('packages/react-native-editor/ios/Podfile.lock') }}-${{ hashFiles('package-lock.json') }}
key: ${{ runner.os }}-pods-${{ hashFiles('packages/react-native-editor/ios/Gemfile.lock') }}-${{ hashFiles('packages/react-native-editor/ios/Podfile.lock') }}-${{ hashFiles('pnpm-lock.yaml') }}

- name: Bundle iOS
run: npm run native test:e2e:bundle:ios
run: pnpm run native test:e2e:bundle:ios

- name: Switch Xcode version to ${{ matrix.xcode }}
run: sudo xcode-select --switch /Applications/Xcode_${{ matrix.xcode }}.app

- name: Build (if needed)
run: test -e packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app/GutenbergDemo || npm run native test:e2e:build-app:ios
run: test -e packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app/GutenbergDemo || pnpm run native test:e2e:build-app:ios

- name: Build Web Driver Agent (if needed)
run: test -d packages/react-native-editor/ios/build/WDA || npm run native test:e2e:build-wda
run: test -d packages/react-native-editor/ios/build/WDA || pnpm run native test:e2e:build-wda

- name: Force update Launch Database to prevent issues when opening the Simulator app
run: /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer/Applications/Simulator.app

- name: Run iOS Device Tests
run: TEST_RN_PLATFORM=ios npm run native device-tests:local ${{ matrix.native-test-name }}
run: TEST_RN_PLATFORM=ios pnpm run native device-tests:local ${{ matrix.native-test-name }}

- name: Prepare build cache
run: |
Expand Down
21 changes: 5 additions & 16 deletions .github/workflows/static-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,16 @@ jobs:
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4

- name: Use desired version of NodeJS
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
with:
node-version: 14
cache: npm

- name: Npm install
# A "full" install is executed, since `npm ci` does not always exit
# with an error status code if the lock file is inaccurate.
#
# See: https://github.com/WordPress/gutenberg/issues/16157
run: npm install
- uses: ./.github/action/setup-node-env

- name: Lint JavaScript and Styles
run: npm run lint
run: pnpm run lint

- name: Type checking
run: npm run build:package-types
run: pnpm run build:package-types

- name: Check local changes
run: npm run check-local-changes
run: pnpm run check-local-changes

- name: License compatibility
run: npm run check-licenses
run: pnpm run check-licenses
10 changes: 3 additions & 7 deletions .github/workflows/storybook-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,13 @@ jobs:
with:
ref: trunk

- name: Use desired version of NodeJS
uses: actions/setup-node@38d90ce44d5275ad62cc48384b3d8a58c500bb5f # v2.2.2
- uses: ./.github/action/setup-node-env
with:
node-version: ${{ matrix.node }}
cache: npm

- name: Install Dependencies
run: npm ci
frozen-lockfile: true

- name: Build Storybook
run: npm run storybook:build
run: pnpm run storybook:build

- name: Deploy
uses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501 # v3.7.3
Expand Down
Loading

0 comments on commit ee56705

Please sign in to comment.