Skip to content
Closed
Show file tree
Hide file tree
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] Jul 1, 2021
71e7f12
Bump lodash from 4.17.19 to 4.17.21
dependabot[bot] Jul 1, 2021
5706ad6
Added script and workflow to automatically update build artifact size…
gonfunko Jul 7, 2021
6766156
Fixed invalid update_metadata.yml file.
gonfunko Jul 7, 2021
2a03fe9
Fix additional error in update_metadata.yml.
gonfunko Jul 7, 2021
fa1d186
Merge pull request #4978 from google/dependabot/npm_and_yarn/ws-7.5.1
rachel-fenichel Jul 9, 2021
ade970f
Initial commit for appengine deploy action
rachel-fenichel Jul 8, 2021
c89d0c5
Update comments to be more descriptive
rachel-fenichel Jul 9, 2021
8a14d66
Merge pull request #4979 from google/dependabot/npm_and_yarn/lodash-4…
rachel-fenichel Jul 9, 2021
7bf024e
Merge pull request #5005 from rachel-fenichel/appengine_demos_master
rachel-fenichel Jul 9, 2021
615abab
Get deploy files from the correct directory
rachel-fenichel Jul 9, 2021
3738098
Merge pull request #5010 from google/rachel-fenichel-patch-1
rachel-fenichel Jul 9, 2021
8c635b5
Create Github Action to comment on PR while develop is frozen (#5006)
moniika Jul 9, 2021
f259143
Revert "Create Github Action to comment on PR while develop is frozen…
moniika Jul 9, 2021
16ca378
Revert "Get deploy files from the correct directory"
rachel-fenichel Jul 9, 2021
bd46d8a
Bump hosted-git-info from 2.8.4 to 2.8.9 (#4980)
dependabot[bot] Jul 12, 2021
e531689
Merge pull request #5014 from google/revert-5010-rachel-fenichel-patch-1
rachel-fenichel Jul 12, 2021
0b80343
Merge branch 'google:master' into update-metadata
gonfunko Jul 12, 2021
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
54 changes: 54 additions & 0 deletions .github/workflows/appengine_deploy.yml
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
39 changes: 39 additions & 0 deletions .github/workflows/update_metadata.yml
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 }}"
1 change: 1 addition & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module.exports = {
package: packageTasks.package,
checkLicenses: licenseTasks.checkLicenses,
recompile: releaseTasks.recompile,
prepareDemos: appengineTasks.prepareDemos,
publish: releaseTasks.publish,
publishBeta: releaseTasks.publishBeta,
sortRequires: cleanupTasks.sortRequires,
Expand Down
38 changes: 9 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"lint": "eslint .",
"package": "gulp package",
"prepare": "npm run package",
"prepareDemos": "gulp prepareDemos",
"publish": "gulp publish",
"publish:beta": "gulp publishBeta",
"recompile": "gulp recompile",
Expand Down
16 changes: 9 additions & 7 deletions scripts/gulpfiles/appengine_tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,19 @@ function deployAndClean(done) {
done();
}

/**
* Prepares demos.
*/
const prepareDemos = gulp.series(
prepareDeployDir, copyStaticSrc, copyAppengineSrc, copyPlaygroundDeps);


/**
* Deploys demos.
*/
const deployDemos = gulp.series(
prepareDeployDir,
copyStaticSrc,
copyAppengineSrc,
copyPlaygroundDeps,
deployAndClean
);
const deployDemos = gulp.series(prepareDemos, deployAndClean);

module.exports = {
deployDemos: deployDemos,
prepareDemos: prepareDemos
}
20 changes: 20 additions & 0 deletions tests/scripts/update_metadata.sh
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}"
Comment on lines +13 to +19
Copy link
Collaborator

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.sh were 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.

Copy link
Collaborator

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}").

Copy link
Contributor Author

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.

sed -ri "s/blocks_gz_size_expected=[0-9]+/${replacement}/g" tests/scripts/check_metadata.sh