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

chore: improve v8 snapshot cache action to be more resilient to windows slowness and have one PR per platform #30551

Merged
merged 13 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
26 changes: 18 additions & 8 deletions .github/workflows/update_v8_snapshot_cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,20 @@ jobs:
steps:
- name: Determine snapshot files - Windows
if: ${{ matrix.platform == 'windows-latest' }}
run: echo "SNAPSHOT_FILES='tooling\v8-snapshot\cache\win32\snapshot-meta.json'" >> $GITHUB_ENV
run: |
echo "SNAPSHOT_FILES='tooling\v8-snapshot\cache\win32\snapshot-meta.json'" >> $GITHUB_ENV
echo "PLATFORM=windows" >> $GITHUB_ENV
shell: bash
- name: Determine snapshot files - Linux
if: ${{ matrix.platform == 'ubuntu-latest' }}
run: echo "SNAPSHOT_FILES='tooling/v8-snapshot/cache/linux/snapshot-meta.json'" >> $GITHUB_ENV
run: |
echo "SNAPSHOT_FILES='tooling/v8-snapshot/cache/linux/snapshot-meta.json'" >> $GITHUB_ENV
echo "PLATFORM=linux" >> $GITHUB_ENV
- name: Determine snapshot files - Mac
if: ${{ matrix.platform == 'macos-latest' }}
run: echo "SNAPSHOT_FILES='tooling/v8-snapshot/cache/darwin/snapshot-meta.json'" >> $GITHUB_ENV
run: |
echo "SNAPSHOT_FILES='tooling/v8-snapshot/cache/darwin/snapshot-meta.json'" >> $GITHUB_ENV
echo "PLATFORM=darwin" >> $GITHUB_ENV
- name: Install setuptools - Mac
if: ${{ matrix.platform == 'macos-latest' }}
run: sudo -H pip install setuptools
Expand All @@ -85,7 +91,8 @@ jobs:
node-version: 18
cache: 'yarn'
- name: Run yarn
run: yarn
# set the timeout here to try and deal with Windows slowness
run: yarn --network-timeout 300000
- name: Run build
run: yarn build
- name: Generate prod snapshot from scratch
Expand All @@ -108,14 +115,17 @@ jobs:
- name: Determine branch name - commit to separate branch
if: ${{ inputs.commit_directly_to_branch != true }}
run: |
echo "BRANCH_NAME=update-v8-snapshot-cache-on-${{ env.BASE_BRANCH }}" >> $GITHUB_ENV
echo "BRANCH_EXISTS=$(git show-ref --verify --quiet refs/remotes/origin/update-v8-snapshot-cache-on-${{ env.BASE_BRANCH }} && echo 'true')" >> $GITHUB_ENV
echo "BRANCH_NAME=update-v8-snapshot-cache-on-${{ env.BASE_BRANCH }}-${{ env.PLATFORM }}" >> $GITHUB_ENV
echo "BRANCH_EXISTS=$(git show-ref --verify --quiet refs/remotes/origin/update-v8-snapshot-cache-on-${{ env.BASE_BRANCH }}-${{ env.PLATFORM }} && echo 'true')" >> $GITHUB_ENV
shell: bash
- name: Check need for PR or branch update
id: check-need-for-pr
run: |
echo "needs_pr=${{ steps.check-for-v8-snapshot-cache-changes.outputs.has_changes == 'true' && env.BRANCH_EXISTS != 'true' }}" >> $GITHUB_OUTPUT
echo "number_of_prs_for_branch=$(gh api '/repos/cypress-io/cypress/pulls?head=cypress-io:${{ env.BRANCH_NAME }}' --jq length) >> $GITHUB_OUTPUT
ryanthemanuel marked this conversation as resolved.
Show resolved Hide resolved
echo "needs_pr=${{ steps.check-for-v8-snapshot-cache-changes.outputs.has_changes == 'true' && number_of_prs_for_branch == '0' }}" >> $GITHUB_OUTPUT
ryanthemanuel marked this conversation as resolved.
Show resolved Hide resolved
echo "needs_branch_update=${{ steps.check-for-v8-snapshot-cache-changes.outputs.has_changes == 'true' && env.BRANCH_EXISTS == 'true' }}" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.BOT_GITHUB_ACTION_TOKEN }}
shell: bash
## Update available and a branch/PR already exists
- name: Checkout existing branch
Expand Down Expand Up @@ -152,7 +162,7 @@ jobs:
github,
baseBranch: '${{ env.BASE_BRANCH }}',
branchName: '${{ env.BRANCH_NAME }}',
description: 'Update v8 snapshot cache',
description: 'Update v8 snapshot cache - ${{ env.PLATFORM }}',
body: 'This PR was automatically generated by the [update-v8-snapshot-cache](https://github.com/cypress-io/cypress/actions/workflows/update_v8_snapshot_cache.yml) github action.',
reviewers: ['ryanthemanuel']
})
3 changes: 1 addition & 2 deletions tooling/v8-snapshot/cache/darwin/snapshot-meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4233,9 +4233,8 @@
"./packages/types/src/spec.ts",
"./packages/types/src/util.ts",
"./packages/types/src/video.ts",
"./packages/types/src/warning.ts",
"./tooling/v8-snapshot/cache/darwin/snapshot-entry.js"
],
"deferredHashFile": "yarn.lock",
"deferredHash": "4c1da762a851baab24ef5d1ba9d878ad207147c7703383f4796c0c9c7910240f"
}
}
3 changes: 1 addition & 2 deletions tooling/v8-snapshot/cache/linux/snapshot-meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4248,9 +4248,8 @@
"./packages/types/src/spec.ts",
"./packages/types/src/util.ts",
"./packages/types/src/video.ts",
"./packages/types/src/warning.ts",
"./tooling/v8-snapshot/cache/linux/snapshot-entry.js"
],
"deferredHashFile": "yarn.lock",
"deferredHash": "3f91247096ae79ca27c13f643c4d4f870ab6aa22f210ce68ddbcce8ea7050380"
}
}
3 changes: 1 addition & 2 deletions tooling/v8-snapshot/cache/win32/snapshot-meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4232,9 +4232,8 @@
"./packages/types/src/spec.ts",
"./packages/types/src/util.ts",
"./packages/types/src/video.ts",
"./packages/types/src/warning.ts",
"./tooling/v8-snapshot/cache/win32/snapshot-entry.js"
],
"deferredHashFile": "yarn.lock",
"deferredHash": "13b4e2c024574673089f0bd15e763cc1db73256cafb63a98edb1e916317e3d3f"
}
}
Loading