diff --git a/.github/workflows/build-plugin-zip.yml b/.github/workflows/build-plugin-zip.yml index 6324a0195d9b3..ac6dcfebc0a83 100644 --- a/.github/workflows/build-plugin-zip.yml +++ b/.github/workflows/build-plugin-zip.yml @@ -1,102 +1,102 @@ name: Build Gutenberg Plugin Zip on: - pull_request: - paths-ignore: - - '**.md' - push: - branches: [trunk] - tags: - - 'v*' - paths-ignore: - - '**.md' + pull_request: + paths-ignore: + - '**.md' + push: + branches: [trunk] + tags: + - 'v*' + paths-ignore: + - '**.md' jobs: - build: - name: Build Release Artifact - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + build: + name: Build Release Artifact + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - - name: Cache node modules - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- + - name: Cache node modules + uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- - - name: Use Node.js 14.x - uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 - with: - node-version: 14.x + - name: Use Node.js 14.x + uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 + with: + node-version: 14.x - - name: Build Gutenberg plugin ZIP file - run: ./bin/build-plugin-zip.sh - env: - NO_CHECKS: 'true' + - name: Build Gutenberg plugin ZIP file + run: ./bin/build-plugin-zip.sh + env: + NO_CHECKS: 'true' - - name: Upload artifact - uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2 - with: - name: gutenberg-plugin - path: ./gutenberg.zip + - name: Upload artifact + uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2 + with: + name: gutenberg-plugin + path: ./gutenberg.zip - create-release: - name: Create Release Draft and Attach Asset - needs: build - runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/v') - steps: - - name: Set Release Version - id: get_release_version - run: echo ::set-output name=version::$(echo $GITHUB_REF | cut -d / -f 3 | sed s/^v// | sed 's/-rc./ RC/' ) + create-release: + name: Create Release Draft and Attach Asset + needs: build + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + steps: + - name: Set Release Version + id: get_release_version + run: echo ::set-output name=version::$(echo $GITHUB_REF | cut -d / -f 3 | sed s/^v// | sed 's/-rc./ RC/' ) - - name: Download Plugin Zip Artifact - uses: actions/download-artifact@4a7a711286f30c025902c28b541c10e147a9b843 # v2.0.8 - with: - name: gutenberg-plugin + - name: Download Plugin Zip Artifact + uses: actions/download-artifact@4a7a711286f30c025902c28b541c10e147a9b843 # v2.0.8 + with: + name: gutenberg-plugin - - name: Extract Changelog for Release - run: | - unzip gutenberg.zip changelog.txt - CHANGELOG_REGEX="/=\s[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?\s=/" - awk -i inplace "$CHANGELOG_REGEX"'{p++;next} p==2{exit} p>=1' changelog.txt + - name: Extract Changelog for Release + run: | + unzip gutenberg.zip changelog.txt + CHANGELOG_REGEX="/=\s[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)?\s=/" + awk -i inplace "$CHANGELOG_REGEX"'{p++;next} p==2{exit} p>=1' changelog.txt - - name: Create Release Draft - id: create_release - uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1.1.4 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: ${{ steps.get_release_version.outputs.version }} - draft: true - prerelease: ${{ contains(github.ref, 'rc') }} - body_path: changelog.txt + - name: Create Release Draft + id: create_release + uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1.1.4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ steps.get_release_version.outputs.version }} + draft: true + prerelease: ${{ contains(github.ref, 'rc') }} + body_path: changelog.txt - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./gutenberg.zip - asset_name: gutenberg.zip - asset_content_type: application/zip + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./gutenberg.zip + asset_name: gutenberg.zip + asset_content_type: application/zip - - name: Publish Release - run: | - curl \ - --request PATCH \ - --url https://api.github.com/repos/${{ github.repository }}/releases/${{ steps.create_release.outputs.id }} \ - --header 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' \ - --header "Accept: application/vnd.github.v3+json" \ - --data-raw '{"draft":false}' \ No newline at end of file + - name: Publish Release + run: | + curl \ + --request PATCH \ + --url https://api.github.com/repos/${{ github.repository }}/releases/${{ steps.create_release.outputs.id }} \ + --header 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' \ + --header "Accept: application/vnd.github.v3+json" \ + --data-raw '{"draft":false}' diff --git a/.github/workflows/bundle-size.yml b/.github/workflows/bundle-size.yml index 1b85fa623e23f..2253ff9941d23 100644 --- a/.github/workflows/bundle-size.yml +++ b/.github/workflows/bundle-size.yml @@ -3,16 +3,16 @@ name: Compressed Size on: [pull_request] jobs: - build: - name: Check - runs-on: ubuntu-latest + build: + name: Check + runs-on: ubuntu-latest - steps: - - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - with: - fetch-depth: 1 + steps: + - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + with: + fetch-depth: 1 - - uses: preactjs/compressed-size-action@7d87f60a6b0c7d193b8183ce859ed00b356ea92f # v2.1.0 - with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" - pattern: "{build/**/*.js,build/**/*.css}" + - uses: preactjs/compressed-size-action@7d87f60a6b0c7d193b8183ce859ed00b356ea92f # v2.1.0 + with: + repo-token: '${{ secrets.GITHUB_TOKEN }}' + pattern: '{build/**/*.js,build/**/*.css}' diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml index 6c8cc20fe1135..919a8a4691db8 100644 --- a/.github/workflows/cancel.yml +++ b/.github/workflows/cancel.yml @@ -1,15 +1,15 @@ name: Cancel on: pull_request jobs: - cancel: - name: 'Cancel Previous Runs' - runs-on: ubuntu-latest - timeout-minutes: 3 - steps: - - name: Get all workflow ids and set to env variable - run: echo "WORKFLOW_IDS_TO_CANCEL=$(curl https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/workflows -s | jq -r '.workflows | map(.id|tostring) | join(",")')" >> $GITHUB_ENV + cancel: + name: 'Cancel Previous Runs' + runs-on: ubuntu-latest + timeout-minutes: 3 + steps: + - name: Get all workflow ids and set to env variable + run: echo "WORKFLOW_IDS_TO_CANCEL=$(curl https://api.github.com/repos/${GITHUB_REPOSITORY}/actions/workflows -s | jq -r '.workflows | map(.id|tostring) | join(",")')" >> $GITHUB_ENV - - uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # v0.8.0 - with: - workflow_id: ${{ env.WORKFLOW_IDS_TO_CANCEL }} - access_token: ${{ secrets.GITHUB_TOKEN }} + - uses: styfle/cancel-workflow-action@3d86a7cc43670094ac248017207be0295edbc31d # v0.8.0 + with: + workflow_id: ${{ env.WORKFLOW_IDS_TO_CANCEL }} + access_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/create-block.yml b/.github/workflows/create-block.yml index 4bff464420313..e7d4a8e0ad302 100644 --- a/.github/workflows/create-block.yml +++ b/.github/workflows/create-block.yml @@ -1,49 +1,49 @@ name: Create Block on: - pull_request: - paths: - - 'packages/**' - - '!packages/**/test/**' - - '!packages/**/*.md' - push: - branches: [trunk, wp/trunk] - paths: - - 'packages/**' - - '!packages/**/test/**' - - '!packages/**/*.md' + pull_request: + paths: + - 'packages/**' + - '!packages/**/test/**' + - '!packages/**/*.md' + push: + branches: [trunk, wp/trunk] + paths: + - 'packages/**' + - '!packages/**/test/**' + - '!packages/**/*.md' jobs: - checks: - name: Checks - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - node: [12, 14] + checks: + name: Checks + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node: [12, 14] - steps: - - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + steps: + - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - - name: Cache node modules - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- + - name: Cache node modules + uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- - - name: Use Node.js ${{ matrix.node }}.x - uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 - with: - node-version: ${{ matrix.node }} + - name: Use Node.js ${{ matrix.node }}.x + uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 + with: + node-version: ${{ matrix.node }} - - name: npm install, build, format and lint - run: | - npm ci - npm run test:create-block + - name: npm install, build, format and lint + run: | + npm ci + npm run test:create-block diff --git a/.github/workflows/end2end-test.yml b/.github/workflows/end2end-test.yml index dc10ffe7a12ab..0580db1b3948e 100644 --- a/.github/workflows/end2end-test.yml +++ b/.github/workflows/end2end-test.yml @@ -1,67 +1,66 @@ name: End-to-End Tests on: - pull_request: - paths-ignore: - - '**.md' - push: - branches: - - trunk - - 'wp/**' - paths-ignore: - - '**.md' + pull_request: + paths-ignore: + - '**.md' + push: + branches: + - trunk + - 'wp/**' + paths-ignore: + - '**.md' jobs: - admin: - name: Admin - ${{ matrix.part }} + admin: + name: Admin - ${{ matrix.part }} - runs-on: ubuntu-latest + runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - part: [1, 2, 3, 4] + strategy: + fail-fast: false + matrix: + part: [1, 2, 3, 4] + steps: + - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - steps: - - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + - name: Cache node modules + uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- - - name: Cache node modules - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- + - name: Use Node.js 14.x + uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 + with: + node-version: 14.x - - name: Use Node.js 14.x - uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 - with: - node-version: 14.x + - name: Npm install and build + run: | + npm ci + FORCE_REDUCED_MOTION=true npm run build - - name: Npm install and build - run: | - npm ci - FORCE_REDUCED_MOTION=true npm run build + - name: Install WordPress + run: | + chmod -R 767 ./ # TODO: Possibly integrate in wp-env + npm run wp-env start - - name: Install WordPress - run: | - chmod -R 767 ./ # TODO: Possibly integrate in wp-env - npm run wp-env start + - name: Running the tests + run: | + $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests + $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == ${{ matrix.part }} - 1' < ~/.jest-e2e-tests ) - - name: Running the tests - run: | - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --listTests > ~/.jest-e2e-tests - $( npm bin )/wp-scripts test-e2e --config=./packages/e2e-tests/jest.config.js --cacheDirectory="$HOME/.jest-cache" --runTestsByPath $( awk 'NR % 4 == ${{ matrix.part }} - 1' < ~/.jest-e2e-tests ) - - - name: Archive debug artifacts (screenshots, HTML snapshots) - uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2 - if: always() - with: - name: failures-artifacts - path: artifacts + - name: Archive debug artifacts (screenshots, HTML snapshots) + uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2 + if: always() + with: + name: failures-artifacts + path: artifacts diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index 857bed9849def..fcfdd4e66cae2 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -1,60 +1,58 @@ name: Performances Tests on: - pull_request: - paths-ignore: - - '**.md' - release: - types: [created] + pull_request: + paths-ignore: + - '**.md' + release: + types: [created] jobs: - performance: - name: Run performance tests - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - - - name: Cache node modules - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Use Node.js 14.x - uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 - with: - node-version: 14.x - - - name: Npm install - run: | - npm ci - - - name: Compare performance with trunk - if: github.event_name == 'pull_request' - run: ./bin/plugin/cli.js perf --ci $GITHUB_SHA trunk --tests-branch $GITHUB_SHA - - - name: Compare performance with current WordPress Core and previous Gutenberg versions - if: github.event_name == 'release' - env: - PLUGIN_VERSION: ${{ github.event.release.name }} - run: | - IFS='.' read -r -a PLUGIN_VERSION_ARRAY <<< "$PLUGIN_VERSION" - CURRENT_RELEASE_BRANCH="release/${PLUGIN_VERSION_ARRAY[0]}.${PLUGIN_VERSION_ARRAY[1]}" - PREVIOUS_VERSION_BASE_10=$(expr ${PLUGIN_VERSION_ARRAY[0]} \* 10 + ${PLUGIN_VERSION_ARRAY[1]} - 1) - PREVIOUS_RELEASE_BRANCH="release/$(expr $PREVIOUS_VERSION_BASE_10 / 10).$(expr $PREVIOUS_VERSION_BASE_10 % 10)" - TESTED_UP_TO_REGEX="Tested up to: \K([0-9]+)\.([0-9]+)\.?([0-9]?)" - WP_VERSION=$(grep -oP "$TESTED_UP_TO_REGEX" ./readme.txt) - IFS='.' read -r -a WP_VERSION_ARRAY <<< "$WP_VERSION" - WP_BRANCH="wp/${WP_VERSION_ARRAY[0]}.${WP_VERSION_ARRAY[1]}" - ./bin/plugin/cli.js perf --ci $WP_BRANCH $PREVIOUS_RELEASE_BRANCH $CURRENT_RELEASE_BRANCH - - + performance: + name: Run performance tests + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + + - name: Cache node modules + uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Use Node.js 14.x + uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 + with: + node-version: 14.x + + - name: Npm install + run: | + npm ci + + - name: Compare performance with trunk + if: github.event_name == 'pull_request' + run: ./bin/plugin/cli.js perf --ci $GITHUB_SHA trunk --tests-branch $GITHUB_SHA + + - name: Compare performance with current WordPress Core and previous Gutenberg versions + if: github.event_name == 'release' + env: + PLUGIN_VERSION: ${{ github.event.release.name }} + run: | + IFS='.' read -r -a PLUGIN_VERSION_ARRAY <<< "$PLUGIN_VERSION" + CURRENT_RELEASE_BRANCH="release/${PLUGIN_VERSION_ARRAY[0]}.${PLUGIN_VERSION_ARRAY[1]}" + PREVIOUS_VERSION_BASE_10=$(expr ${PLUGIN_VERSION_ARRAY[0]} \* 10 + ${PLUGIN_VERSION_ARRAY[1]} - 1) + PREVIOUS_RELEASE_BRANCH="release/$(expr $PREVIOUS_VERSION_BASE_10 / 10).$(expr $PREVIOUS_VERSION_BASE_10 % 10)" + TESTED_UP_TO_REGEX="Tested up to: \K([0-9]+)\.([0-9]+)\.?([0-9]?)" + WP_VERSION=$(grep -oP "$TESTED_UP_TO_REGEX" ./readme.txt) + IFS='.' read -r -a WP_VERSION_ARRAY <<< "$WP_VERSION" + WP_BRANCH="wp/${WP_VERSION_ARRAY[0]}.${WP_VERSION_ARRAY[1]}" + ./bin/plugin/cli.js perf --ci $WP_BRANCH $PREVIOUS_RELEASE_BRANCH $CURRENT_RELEASE_BRANCH diff --git a/.github/workflows/pull-request-automation.yml b/.github/workflows/pull-request-automation.yml index b3fe89023d2bf..f97e9c28ec7e9 100644 --- a/.github/workflows/pull-request-automation.yml +++ b/.github/workflows/pull-request-automation.yml @@ -1,23 +1,23 @@ on: - pull_request_target: - types: [opened] - push: + pull_request_target: + types: [opened] + push: name: Pull request automation jobs: - pull-request-automation: - runs-on: ubuntu-latest - 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 + pull-request-automation: + runs-on: ubuntu-latest + 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 - # 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 + # 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 - - uses: ./packages/project-management-automation - with: - github_token: ${{ secrets.GITHUB_TOKEN }} + - uses: ./packages/project-management-automation + with: + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/rnmobile-android-runner.yml b/.github/workflows/rnmobile-android-runner.yml index d3e47a1bc593a..60ee2d8877fbf 100644 --- a/.github/workflows/rnmobile-android-runner.yml +++ b/.github/workflows/rnmobile-android-runner.yml @@ -1,52 +1,50 @@ name: React Native E2E Tests (Android) on: - pull_request: - paths-ignore: - - '**.md' - push: - branches: [trunk] - paths-ignore: - - '**.md' + pull_request: + paths-ignore: + - '**.md' + push: + branches: [trunk] + paths-ignore: + - '**.md' jobs: - test: - runs-on: macos-latest - strategy: - matrix: - native-test-name: [ - gutenberg-editor-gallery - ] - - steps: - - name: checkout - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - - - name: Restore npm cache - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - with: - path: ~/.npm - key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }} - restore-keys: | - ${{ runner.os }}-npm- - - - run: npm ci - - - name: Restore Gradle cache - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - with: - path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} - restore-keys: ${{ runner.os }}-gradle - - - uses: reactivecircus/android-emulator-runner@08b092e904025fada32a01b711af1e7ff7b7a4a3 # v2.14.3 - with: - api-level: 28 - profile: pixel_xl - script: npm run native test:e2e:android:local ${{ matrix.native-test-name }} - - - uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2 - if: always() - with: - name: android-screen-recordings - path: packages/react-native-editor/android-screen-recordings + test: + runs-on: macos-latest + strategy: + matrix: + native-test-name: [gutenberg-editor-gallery] + + steps: + - name: checkout + uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + + - name: Restore npm cache + uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 + with: + path: ~/.npm + key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }} + restore-keys: | + ${{ runner.os }}-npm- + + - run: npm ci + + - name: Restore Gradle cache + uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle + + - uses: reactivecircus/android-emulator-runner@08b092e904025fada32a01b711af1e7ff7b7a4a3 # v2.14.3 + with: + api-level: 28 + profile: pixel_xl + script: npm run native test:e2e:android:local ${{ matrix.native-test-name }} + + - uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2 + if: always() + with: + name: android-screen-recordings + path: packages/react-native-editor/android-screen-recordings diff --git a/.github/workflows/rnmobile-ios-runner.yml b/.github/workflows/rnmobile-ios-runner.yml index cb64467a25f6e..66f7dd0c5f2c3 100644 --- a/.github/workflows/rnmobile-ios-runner.yml +++ b/.github/workflows/rnmobile-ios-runner.yml @@ -1,77 +1,75 @@ name: React Native E2E Tests (iOS) on: - pull_request: - paths-ignore: - - '**.md' - push: - branches: [trunk] - paths-ignore: - - '**.md' + pull_request: + paths-ignore: + - '**.md' + push: + branches: [trunk] + paths-ignore: + - '**.md' jobs: - test: - runs-on: macos-latest - strategy: - matrix: - native-test-name: [ - gutenberg-editor-gallery - ] + test: + runs-on: macos-latest + strategy: + matrix: + native-test-name: [gutenberg-editor-gallery] - steps: - - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + steps: + - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - - name: Restore npm cache - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - with: - path: ~/.npm - key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }} - restore-keys: | - ${{ runner.os }}-npm- + - name: Restore npm cache + uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 + with: + path: ~/.npm + key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }} + restore-keys: | + ${{ runner.os }}-npm- - - run: npm ci + - 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: 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 - with: - path: packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app - key: ${{ runner.os }}-ios-build-${{ hashFiles('ios-checksums.txt') }} + - name: Restore build cache + uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 + with: + path: packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app + key: ${{ runner.os }}-ios-build-${{ hashFiles('ios-checksums.txt') }} - - name: Restore pods cache - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - with: - path: | - packages/react-native-editor/ios/Pods - ~/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') }} - restore-keys: | - ${{ runner.os }}-pods-${{ hashFiles('packages/react-native-editor/ios/Gemfile.lock') }}-${{ hashFiles('packages/react-native-editor/ios/Podfile.lock') }}-${{ hashFiles('package-lock.json') }} - ${{ runner.os }}-pods-${{ hashFiles('packages/react-native-editor/ios/Gemfile.lock') }}-${{ hashFiles('packages/react-native-editor/ios/Podfile.lock') }}- - ${{ runner.os }}-pods-${{ hashFiles('packages/react-native-editor/ios/Gemfile.lock') }}- - ${{ runner.os }}-pods- + - name: Restore pods cache + uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 + with: + path: | + packages/react-native-editor/ios/Pods + ~/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') }} + restore-keys: | + ${{ runner.os }}-pods-${{ hashFiles('packages/react-native-editor/ios/Gemfile.lock') }}-${{ hashFiles('packages/react-native-editor/ios/Podfile.lock') }}-${{ hashFiles('package-lock.json') }} + ${{ runner.os }}-pods-${{ hashFiles('packages/react-native-editor/ios/Gemfile.lock') }}-${{ hashFiles('packages/react-native-editor/ios/Podfile.lock') }}- + ${{ runner.os }}-pods-${{ hashFiles('packages/react-native-editor/ios/Gemfile.lock') }}- + ${{ runner.os }}-pods- - - name: Bundle iOS - run: npm run native test:e2e:bundle:ios + - name: Bundle iOS + run: npm run native test:e2e:bundle:ios - - name: Switch Xcode Version - run: sudo xcode-select --switch /Applications/Xcode_12.app + - name: Switch Xcode Version + run: sudo xcode-select --switch /Applications/Xcode_12.app - - name: Build (if needed) - run: test -e packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app/gutenberg || npm run native test:e2e:build-app:ios + - name: Build (if needed) + run: test -e packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app/gutenberg || npm run native test:e2e:build-app:ios - - name: Run iOS Device Tests - run: TEST_RN_PLATFORM=ios npm run native device-tests:local ${{ matrix.native-test-name }} + - name: Run iOS Device Tests + run: TEST_RN_PLATFORM=ios npm run native device-tests:local ${{ matrix.native-test-name }} - - name: Prepare build cache - run: rm packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app/main.jsbundle + - name: Prepare build cache + run: rm packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app/main.jsbundle - - uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2 - if: always() - with: - name: ios-screen-recordings - path: packages/react-native-editor/ios-screen-recordings + - uses: actions/upload-artifact@e448a9b857ee2131e752b06002bf0e093c65e571 # v2.2.2 + if: always() + with: + name: ios-screen-recordings + path: packages/react-native-editor/ios-screen-recordings diff --git a/.github/workflows/stale-issue-needs-info.yml b/.github/workflows/stale-issue-needs-info.yml index a14b777dc0ab7..b537469fbafb5 100644 --- a/.github/workflows/stale-issue-needs-info.yml +++ b/.github/workflows/stale-issue-needs-info.yml @@ -1,18 +1,18 @@ -name: "Close stale issues that requires info" +name: 'Close stale issues that requires info' on: - schedule: - - cron: "30 1 * * *" + schedule: + - cron: '30 1 * * *' jobs: - stale: - runs-on: ubuntu-latest - steps: - - uses: actions/stale@996798eb71ef485dc4c7b4d3285842d714040c4a # v3.0.17 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: 'Help us move this issue forward. Since it has no activity after 15 days of requesting more information, a bot is marking the issue as stale. Please add additional information as a comment or this issued will be closed in 5 days.' - close-issue-message: 'This issue was closed because more information was requested and there was no activity. If this is a bug report and still a problem, please supply the additional information requested and reopen the issue.' - days-before-stale: 15 - days-before-close: 5 - only-labels: '[Status] Needs More Info' - stale-issue-label: '[Status] Stale' + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@996798eb71ef485dc4c7b4d3285842d714040c4a # v3.0.17 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: 'Help us move this issue forward. Since it has no activity after 15 days of requesting more information, a bot is marking the issue as stale. Please add additional information as a comment or this issued will be closed in 5 days.' + close-issue-message: 'This issue was closed because more information was requested and there was no activity. If this is a bug report and still a problem, please supply the additional information requested and reopen the issue.' + days-before-stale: 15 + days-before-close: 5 + only-labels: '[Status] Needs More Info' + stale-issue-label: '[Status] Stale' diff --git a/.github/workflows/static-checks.yml b/.github/workflows/static-checks.yml index ad10daa5a167f..4264af972e028 100644 --- a/.github/workflows/static-checks.yml +++ b/.github/workflows/static-checks.yml @@ -1,59 +1,59 @@ name: Static Analysis (Linting, License, Type checks...) on: - pull_request: - push: - branches: - - trunk - - 'wp/**' + pull_request: + push: + branches: + - trunk + - 'wp/**' jobs: - check: - name: All - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - - - name: Cache node modules - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Use Node.js 14.x - uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 - with: - node-version: 14.x - - - name: Npm install and build - # 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 - npm run build - - - name: Lint JavaScript and Styles - run: npm run lint - - - name: Lint ES5 built files (IE11) - run: npx eslint --parser-options=ecmaVersion:5 --no-eslintrc --no-ignore ./build/**/*.js - - - name: Type checking - run: npm run build:package-types - - - name: Build artifacts - run: npm run check-local-changes - - - name: License compatibility - run: npm run check-licenses + check: + name: All + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + + - name: Cache node modules + uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Use Node.js 14.x + uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 + with: + node-version: 14.x + + - name: Npm install and build + # 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 + npm run build + + - name: Lint JavaScript and Styles + run: npm run lint + + - name: Lint ES5 built files (IE11) + run: npx eslint --parser-options=ecmaVersion:5 --no-eslintrc --no-ignore ./build/**/*.js + + - name: Type checking + run: npm run build:package-types + + - name: Build artifacts + run: npm run check-local-changes + + - name: License compatibility + run: npm run check-licenses diff --git a/.github/workflows/storybook-pages.yml b/.github/workflows/storybook-pages.yml index 5ea64c6789934..d717c1cf58c3a 100644 --- a/.github/workflows/storybook-pages.yml +++ b/.github/workflows/storybook-pages.yml @@ -1,45 +1,45 @@ name: Storybook GitHub Pages on: - push: - branches: - - trunk + push: + branches: + - trunk jobs: - deploy: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - with: - ref: trunk + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + with: + ref: trunk - - name: Cache node modules - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- + - name: Cache node modules + uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- - - name: Setup Node - uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 - with: - node-version: '14.x' + - name: Setup Node + uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 + with: + node-version: '14.x' - - name: Install Dependencies - run: npm ci + - name: Install Dependencies + run: npm ci - - name: Build Storybook - run: npm run storybook:build + - name: Build Storybook + run: npm run storybook:build - - name: Deploy - uses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501 # v3.7.3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./storybook/build + - name: Deploy + uses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501 # v3.7.3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./storybook/build diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index a5ccf320fbef5..a14504275a780 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -3,137 +3,136 @@ name: Unit Tests # Since Unit Tests are required to pass for each PR, # we cannot disable them for documentation-only changes. on: - pull_request: - push: - branches: - - trunk - - 'wp/**' + pull_request: + push: + branches: + - trunk + - 'wp/**' jobs: - unit-js: - name: JavaScript - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - node: [12, 14] - - steps: - - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - - - name: Cache node modules - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Use Node.js ${{ matrix.node }}.x - uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 - with: - node-version: ${{ matrix.node }} - - - name: Npm install and build - # It's not necessary to run the full build, since Jest can interpret - # source files with `babel-jest`. Some packages have their own custom - # build tasks, however. These must be run. - run: | - npm ci - npx lerna run build - - - name: Running the tests - run: npm run test-unit -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache" - - - name: Running the date tests - run: npm run test-unit:date -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache" - - unit-php: - name: PHP - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - - - name: Cache node modules - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Use Node.js 14.x - uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 - with: - node-version: 14.x - - - name: Npm install and build - run: | - npm ci - npm run build - - - name: Install WordPress - run: | - chmod -R 767 ./ # TODO: Possibly integrate in wp-env - npm run wp-env start - - - name: Running lint check - run: npm run lint-php - - - name: Running single site unit tests - run: npm run test-unit-php - if: ${{ success() || failure() }} - - - name: Running multisite unit tests - run: npm run test-unit-php-multisite - if: ${{ success() || failure() }} - - - mobile-unit-js: - name: Mobile - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 - - - name: Cache node modules - uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Use Node.js 14.x - uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 - with: - node-version: 14.x - - - name: Npm install and build - # It's not necessary to run the full build, since Jest can interpret - # source files with `babel-jest`. Some packages have their own custom - # build tasks, however. These must be run. - run: | - npm ci - npx lerna run build - - - name: Running the tests - run: npm run test-unit:native -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache" + unit-js: + name: JavaScript + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node: [12, 14] + + steps: + - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + + - name: Cache node modules + uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Use Node.js ${{ matrix.node }}.x + uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 + with: + node-version: ${{ matrix.node }} + + - name: Npm install and build + # It's not necessary to run the full build, since Jest can interpret + # source files with `babel-jest`. Some packages have their own custom + # build tasks, however. These must be run. + run: | + npm ci + npx lerna run build + + - name: Running the tests + run: npm run test-unit -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache" + + - name: Running the date tests + run: npm run test-unit:date -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache" + + unit-php: + name: PHP + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + + - name: Cache node modules + uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Use Node.js 14.x + uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 + with: + node-version: 14.x + + - name: Npm install and build + run: | + npm ci + npm run build + + - name: Install WordPress + run: | + chmod -R 767 ./ # TODO: Possibly integrate in wp-env + npm run wp-env start + + - name: Running lint check + run: npm run lint-php + + - name: Running single site unit tests + run: npm run test-unit-php + if: ${{ success() || failure() }} + + - name: Running multisite unit tests + run: npm run test-unit-php-multisite + if: ${{ success() || failure() }} + + mobile-unit-js: + name: Mobile + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + + - name: Cache node modules + uses: actions/cache@26968a09c0ea4f3e233fdddbafd1166051a095f6 # v2.1.4 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Use Node.js 14.x + uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea # v2.1.5 + with: + node-version: 14.x + + - name: Npm install and build + # It's not necessary to run the full build, since Jest can interpret + # source files with `babel-jest`. Some packages have their own custom + # build tasks, however. These must be run. + run: | + npm ci + npx lerna run build + + - name: Running the tests + run: npm run test-unit:native -- --ci --maxWorkers=2 --cacheDirectory="$HOME/.jest-cache" diff --git a/.github/workflows/upload-release-to-plugin-repo.yml b/.github/workflows/upload-release-to-plugin-repo.yml index 57df6897e9553..4ab536735f2cd 100644 --- a/.github/workflows/upload-release-to-plugin-repo.yml +++ b/.github/workflows/upload-release-to-plugin-repo.yml @@ -1,64 +1,64 @@ on: - release: - types: [released] + release: + types: [released] name: Upload Gutenberg plugin to WordPress.org plugin repo jobs: - upload: - name: Upload Gutenberg Plugin - runs-on: ubuntu-latest - environment: wp.org plugin - if: github.event.release.assets[0] - env: - PLUGIN_REPO_URL: 'https://plugins.svn.wordpress.org/gutenberg' - STABLE_TAG_REGEX: 'Stable tag: [0-9]\+\.[0-9]\+\.[0-9]\+\s*' - SVN_USERNAME: ${{ secrets.svn_username }} - SVN_PASSWORD: ${{ secrets.svn_password }} - VERSION: ${{ github.event.release.name }} - steps: - - name: Check out Gutenberg trunk from WP.org plugin repo - run: svn checkout "$PLUGIN_REPO_URL/trunk" + upload: + name: Upload Gutenberg Plugin + runs-on: ubuntu-latest + environment: wp.org plugin + if: github.event.release.assets[0] + env: + PLUGIN_REPO_URL: 'https://plugins.svn.wordpress.org/gutenberg' + STABLE_TAG_REGEX: 'Stable tag: [0-9]\+\.[0-9]\+\.[0-9]\+\s*' + SVN_USERNAME: ${{ secrets.svn_username }} + SVN_PASSWORD: ${{ secrets.svn_password }} + VERSION: ${{ github.event.release.name }} + steps: + - name: Check out Gutenberg trunk from WP.org plugin repo + run: svn checkout "$PLUGIN_REPO_URL/trunk" - - name: Get previous stable tag - id: get_previous_stable_tag - run: echo ::set-output name=stable_tag::$(grep "$STABLE_TAG_REGEX" ./trunk/readme.txt) + - name: Get previous stable tag + id: get_previous_stable_tag + run: echo ::set-output name=stable_tag::$(grep "$STABLE_TAG_REGEX" ./trunk/readme.txt) - - name: Delete everything - working-directory: ./trunk - run: find . -maxdepth 1 -not -name ".svn" -not -name "." -not -name ".." -exec rm -rf {} + + - name: Delete everything + working-directory: ./trunk + run: find . -maxdepth 1 -not -name ".svn" -not -name "." -not -name ".." -exec rm -rf {} + - - name: Download and unzip Gutenberg plugin asset into trunk folder - env: - PLUGIN_URL: ${{ github.event.release.assets[0].browser_download_url }} - run: | - curl -L -o gutenberg.zip $PLUGIN_URL - unzip gutenberg.zip -d trunk - rm gutenberg.zip + - name: Download and unzip Gutenberg plugin asset into trunk folder + env: + PLUGIN_URL: ${{ github.event.release.assets[0].browser_download_url }} + run: | + curl -L -o gutenberg.zip $PLUGIN_URL + unzip gutenberg.zip -d trunk + rm gutenberg.zip - - name: Replace the stable tag placeholder with the existing stable tag on the SVN repository - env: - STABLE_TAG_PLACEHOLDER: 'Stable tag: V\.V\.V' - STABLE_TAG: ${{ steps.get_previous_stable_tag.outputs.stable_tag }} - run: sed -i "s/${STABLE_TAG_PLACEHOLDER}/${STABLE_TAG}/g" ./trunk/readme.txt + - name: Replace the stable tag placeholder with the existing stable tag on the SVN repository + env: + STABLE_TAG_PLACEHOLDER: 'Stable tag: V\.V\.V' + STABLE_TAG: ${{ steps.get_previous_stable_tag.outputs.stable_tag }} + run: sed -i "s/${STABLE_TAG_PLACEHOLDER}/${STABLE_TAG}/g" ./trunk/readme.txt - - name: Commit the content changes - working-directory: ./trunk - run: | - svn st | grep '^?' | awk '{print $2}' | xargs -r svn add - svn st | grep '^!' | awk '{print $2}' | xargs -r svn rm - svn commit -m "Committing version $VERSION" \ - --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD" + - name: Commit the content changes + working-directory: ./trunk + run: | + svn st | grep '^?' | awk '{print $2}' | xargs -r svn add + svn st | grep '^!' | awk '{print $2}' | xargs -r svn rm + svn commit -m "Committing version $VERSION" \ + --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD" - - name: Create the SVN tag - working-directory: ./trunk - run: | - svn copy "$PLUGIN_REPO_URL/trunk" "$PLUGIN_REPO_URL/tags/$VERSION" -m "Tagging version $VERSION" \ - --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD" + - name: Create the SVN tag + working-directory: ./trunk + run: | + svn copy "$PLUGIN_REPO_URL/trunk" "$PLUGIN_REPO_URL/tags/$VERSION" -m "Tagging version $VERSION" \ + --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD" - - name: Update the plugin's stable version - working-directory: ./trunk - run: | - sed -i "s/${STABLE_TAG_REGEX}/Stable tag: ${VERSION}/g" ./readme.txt - svn commit -m "Releasing version $VERSION" \ - --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD" + - name: Update the plugin's stable version + working-directory: ./trunk + run: | + sed -i "s/${STABLE_TAG_REGEX}/Stable tag: ${VERSION}/g" ./readme.txt + svn commit -m "Releasing version $VERSION" \ + --no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD" diff --git a/package-lock.json b/package-lock.json index 31cd2603e7d02..0144b08853303 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11280,9 +11280,9 @@ "integrity": "sha512-gCubfBUZ6KxzoibJ+SCUc/57Ms1jz5NjHe4+dI2krNmU5zCPAphyLJYyTOg06ueIyfj+SaCUqmzun7ImlxDcKg==" }, "@types/yauzl": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.1.tgz", - "integrity": "sha512-A1b8SU4D10uoPjwb0lnHmmu8wZhR9d+9o2PKBQT2jU5YPTKsxac6M2qGAdY7VcL+dHHhARVUDmeg0rOrcd9EjA==", + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.2.tgz", + "integrity": "sha512-8uALY5LTvSuHgloDVUvWP3pIauILm+8/0pDMokuDYIoNsOkSwd5AiHBTSEJjKTDcZr5z8UpgOWZkxBF4iJftoA==", "dev": true, "optional": true, "requires": { diff --git a/package.json b/package.json index 4da9869b0b28a..0f3c28a19e7bb 100644 --- a/package.json +++ b/package.json @@ -287,7 +287,7 @@ "*.scss": [ "wp-scripts lint-style" ], - "*.js": [ + "*.{js,yml}": [ "wp-scripts format-js", "wp-scripts lint-js" ], diff --git a/packages/scripts/scripts/format-js.js b/packages/scripts/scripts/format-js.js index 55a040e1d9355..6dd655bdab701 100644 --- a/packages/scripts/scripts/format-js.js +++ b/packages/scripts/scripts/format-js.js @@ -104,7 +104,7 @@ if ( fileArgs.length === 0 ) { // Converts `foo/bar` directory to `foo/bar/**/*.js` const globArgs = dirGlob( fileArgs, { - extensions: [ 'js', 'jsx', 'ts', 'tsx' ], + extensions: [ 'js', 'jsx', 'ts', 'tsx', 'yml', 'yaml' ], } ); const result = spawn(