-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Added script and workflow to automatically update build artifact sizes in check_metadata.sh #4997
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
Closed
Closed
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
5e4c650
Bump ws from 7.4.4 to 7.5.1
dependabot[bot] 71e7f12
Bump lodash from 4.17.19 to 4.17.21
dependabot[bot] 5706ad6
Added script and workflow to automatically update build artifact size…
gonfunko 6766156
Fixed invalid update_metadata.yml file.
gonfunko 2a03fe9
Fix additional error in update_metadata.yml.
gonfunko fa1d186
Merge pull request #4978 from google/dependabot/npm_and_yarn/ws-7.5.1
rachel-fenichel ade970f
Initial commit for appengine deploy action
rachel-fenichel c89d0c5
Update comments to be more descriptive
rachel-fenichel 8a14d66
Merge pull request #4979 from google/dependabot/npm_and_yarn/lodash-4…
rachel-fenichel 7bf024e
Merge pull request #5005 from rachel-fenichel/appengine_demos_master
rachel-fenichel 615abab
Get deploy files from the correct directory
rachel-fenichel 3738098
Merge pull request #5010 from google/rachel-fenichel-patch-1
rachel-fenichel 8c635b5
Create Github Action to comment on PR while develop is frozen (#5006)
moniika f259143
Revert "Create Github Action to comment on PR while develop is frozen…
moniika 16ca378
Revert "Get deploy files from the correct directory"
rachel-fenichel bd46d8a
Bump hosted-git-info from 2.8.4 to 2.8.9 (#4980)
dependabot[bot] e531689
Merge pull request #5014 from google/revert-5010-rachel-fenichel-patch-1
rachel-fenichel 0b80343
Merge branch 'google:master' into update-metadata
gonfunko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # Workflow that prepares files and deploys to appengine | ||
|
|
||
| name: Deploy to App Engine | ||
|
|
||
| # Controls when the workflow will run | ||
| on: | ||
| # Allows you to run this workflow manually from the Actions tab | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| prepare: | ||
| name: Prepare | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| # Checks-out the repository under $GITHUB_WORKSPACE. | ||
| # When running manually this checks out the master branch. | ||
| - uses: actions/checkout@v2 | ||
|
|
||
| - name: Prepare demo files | ||
| # Install all dependencies, then copy all the files needed for demos. | ||
| run: | | ||
| npm install | ||
| npm run prepareDemos | ||
|
|
||
| - name: Upload | ||
| uses: actions/upload-artifact@v2 | ||
| with: | ||
| name: appengine_files | ||
| path: _deploy/ | ||
|
|
||
| deploy: | ||
| name: Deploy | ||
| runs-on: ubuntu-latest | ||
| # The prepare step must succeed for this step to run. | ||
| needs: prepare | ||
| steps: | ||
| - name: Download prepared files | ||
| uses: actions/download-artifact@v2 | ||
| with: | ||
| name: appengine_files | ||
| path: _deploy/ | ||
|
|
||
| - name: Deploy to App Engine | ||
| uses: google-github-actions/deploy-appengine@v0.2.0 | ||
| # For parameters see: | ||
| # https://github.com/google-github-actions/deploy-appengine#inputs | ||
| with: | ||
| working_directory: _deploy/ | ||
| deliverables: app.yaml | ||
| project_id: ${{ secrets.GCP_PROJECT }} | ||
| credentials: ${{ secrets.GCP_SA_KEY }} | ||
| promote: false | ||
| version: vtest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # This workflow updates the check_metadata.sh script, which compares the current | ||
| # size of build artifacts against their size in the previous version of Blockly. | ||
|
|
||
| name: Update Metadata | ||
|
|
||
| on: [workflow_dispatch] | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ${{ matrix.os }} | ||
|
|
||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest] | ||
| node-version: [16.x] | ||
|
|
||
| steps: | ||
| - name: Check Out Blockly | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| ref: 'develop' | ||
|
|
||
| - name: Use Node.js ${{ matrix.node-version }} | ||
| uses: actions/setup-node@v1 | ||
| with: | ||
| node-version: ${{ matrix.node-version }} | ||
|
|
||
| - name: Update Metadata | ||
| run: source ./tests/scripts/update_metadata.sh | ||
|
|
||
| - name: Create Pull Request | ||
| uses: peter-evans/create-pull-request@9825ae65b1cb54b543b938503728b432a0176d29 | ||
| with: | ||
| commit-message: Updated build artifact sizes in check_metadata.sh | ||
| delete-branch: true | ||
| title: Updated build artifact sizes in check_metadata.sh | ||
|
|
||
| - name: View Pull Request | ||
| run: echo "View Pull Request - ${{ steps.cpr.outputs.pull-request-url }}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Determines the size of generated files and updates check_metadata.sh to | ||
| # reflect the new values. | ||
|
|
||
| blockly_size=$(wc -c < "blockly_compressed.js") | ||
| blocks_size=$(wc -c < "blocks_compressed.js") | ||
| blockly_gz_size=$(wc -c < "blockly_compressed.js.gz") | ||
| blocks_gz_size=$(wc -c < "blocks_compressed.js.gz") | ||
| quarter=$(date "+Q%q %Y") | ||
| version=$(npx -c 'echo "$npm_package_version"') | ||
|
|
||
| replacement="# ${quarter} ${version} ${blockly_size}\nblockly_size_expected=${blockly_size}" | ||
| sed -ri "s/blockly_size_expected=[0-9]+/${replacement}/g" tests/scripts/check_metadata.sh | ||
| replacement="# ${quarter} ${version} ${blocks_size}\nblocks_size_expected=${blocks_size}" | ||
| sed -ri "s/blocks_size_expected=[0-9]+/${replacement}/g" tests/scripts/check_metadata.sh | ||
| replacement="# ${quarter} ${version} ${blockly_gz_size}\nblockly_gz_size_expected=${blockly_gz_size}" | ||
| sed -ri "s/blockly_gz_size_expected=[0-9]+/${replacement}/g" tests/scripts/check_metadata.sh | ||
| replacement="# ${quarter} ${version} ${blocks_gz_size}\nblocks_gz_size_expected=${blocks_gz_size}" | ||
| sed -ri "s/blocks_gz_size_expected=[0-9]+/${replacement}/g" tests/scripts/check_metadata.sh | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that most of the history lines in
check_metadata.shwere tab-delimited (and I've fixed the ones which aren't in PR #4968). If you prefer to change that then I suggest waiting for #4968 then including a commit to reformat the history in this PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, also: see [style guide re: line length and long string literals](replacement="# ${quarter} ${version} ${blockly_size}\nblockly_size_expected=${blockly_size}").
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I noticed the delimiter issue and decided to just go with the most recent, but having it be consistent SGTM, will hold off until that change is in.