Skip to content

build: deploy screenshot functions #4698

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

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ after_success:
cache:
directories:
- node_modules
- $HOME/.pub-cache
- tools/screenshot-test/functions/node_modules
19 changes: 16 additions & 3 deletions scripts/ci/after-success.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ cd $(dirname $0)/../..
# If not running as a PR, wait for all other travis modes to finish.
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && $(npm bin)/travis-after-modes; then
echo "All travis modes passed. Publishing the build artifacts..."
./scripts/release/publish-build-artifacts.sh
./scripts/release/publish-docs-content.sh
fi
echo ""

# Build Material, CDK and the docs before publishing artifacts
$(npm bin)/gulp material:build-release:clean
$(npm bin)/gulp material-examples:build-release
$(npm bin)/gulp docs

# Run publishing of artifacts in parallel. This is possible because the output has been built before.
./scripts/release/publish-build-artifacts.sh --no-build &
./scripts/release/publish-docs-content.sh --no-build &

# Deploy the screenshot functions for each push build.
./scripts/release/deploy-screenshot-functions.sh &

wait
#fi
17 changes: 17 additions & 0 deletions scripts/release/deploy-screenshot-functions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Go to the project root directory
cd $(dirname ${0})/../..

# Install node modules for screenshot functions. Firebase CLI needs to execute the functions
# before it can collect all functions and deploy them.
(cd tools/screenshot-test/functions; npm install)

if [ -z ${MATERIAL2_SCREENSHOT_ACCESS_TOKEN} ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created MATERIAL2_SCREENSHOT_FIREBASE_DEPLOY_TOKEN for this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

echo "Error: No access token for firebase specified." \
"Please set the environment variable 'MATERIAL2_SCREENSHOT_ACCESS_TOKEN'."
exit 1
fi

# Deploy the screenshot functions to Firebase
$(npm bin)/firebase deploy --only functions --token ${MATERIAL2_SCREENSHOT_ACCESS_TOKEN}
9 changes: 7 additions & 2 deletions scripts/release/publish-build-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ cd $(dirname ${0})/../..
PACKAGES=(cdk material)
REPOSITORIES=(cdk-builds material2-builds)

# Command line arguments.
COMMAND_ARGS=${*}

# Function to publish artifacts of a package to Github.
# @param ${1} Name of the package
# @param ${2} Repository name of the package.
Expand All @@ -30,8 +33,10 @@ publishPackage() {
repoUrl="https://github.com/angular/${packageRepo}.git"
repoDir="tmp/${packageRepo}"

# Create a release of the current repository.
$(npm bin)/gulp ${packageName}:build-release:clean
if [[ ! ${COMMAND_ARGS} == *--no-build* ]]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this flag needed for?

Copy link
Member Author

@devversion devversion May 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allows us to decide whether the script itself should build or if we want to build the output before on our own.

This allows us to run publishing & deploying in parallel.

You can still run the script without any flag to build it as usual.

# Create a release of the current repository.
$(npm bin)/gulp ${packageName}:build-release:clean
fi

# Prepare cloning the builds repository
rm -rf ${repoDir}
Expand Down
6 changes: 4 additions & 2 deletions scripts/release/publish-docs-content.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ repoPath="/tmp/material2-docs-content"
repoUrl="https://github.com/angular/material2-docs-content"
examplesSource="./dist/docs/examples"

$(npm bin)/gulp material-examples:build-release:clean
$(npm bin)/gulp docs
if [[ ! ${*} == *--no-build* ]]; then
$(npm bin)/gulp material-examples:build-release:clean
$(npm bin)/gulp docs
fi

# Get git meta info for commit
commitSha="$(git rev-parse --short HEAD)"
Expand Down