Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Merge requests
  • !20179

Allow PRs to be previewed in-browser without building them locally

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge previewing into v4-dev 9 years ago
  • Overview 0
  • Commits 1
  • Pipelines 0
  • Changes 4

Created by: cvrebert

I still need to muck around with Savage a bit for this, but the idea is that for Sass or JS PRs, Travis can build the docs with the PR's changes and upload a copy to http://preview.twbsapps.com/c/${commit-sha}/ (and eventually we can post a GitHub comment that links to the URL). This is more convenient than having to pull down the PR locally, run Grunt, and then run Jekyll. Also, we can eventually point Sauce/BrowserStack/etc. at these public URLs, instead of setting up a local tunnel to Travis, which can be flaky/slow sometimes.

CC: @twbs/team

Compare
  • v4-dev (base)

and
  • latest version
    37241ed7
    1 commit, 2 years ago

4 files
+ 39
- 6

    Preferences

    File browser
    Compare changes
gr‎unt‎
gcp-key.‎json.enc‎ +0 -0
upload-p‎review.sh‎ +28 -0
.trav‎is.yml‎ +1 -0
Gruntf‎ile.js‎ +10 -6
grunt/gcp-key.json.enc 0 → 100644
+ 0
- 0
  • View file @ 37241ed7

gcp-key.json.enc

Download
grunt/upload-preview.sh 0 → 100755
+ 28
- 0
  • View file @ 37241ed7

  • Edit in single-file editor

  • Open in Web IDE

#!/bin/bash
# Upload built docs to preview.twbsapps.com
if [ "$TRAVIS_REPO_SLUG" != twbs-savage/bootstrap ]; then exit 0; fi
# Add build metadata to version
sed -i "/^current_version:/ s/\$/+pr.${TRAVIS_COMMIT}/" _config.yml
# Fix URLs since the site's root is now a subdirectory
echo "baseurl: /c/${TRAVIS_COMMIT}" >> _config.yml
bundle exec jekyll build --destination "$TRAVIS_COMMIT"
# Install gcloud & gsutil
GSUTIL_VERSION=$(gsutil version | cut -d ' ' -f 3)
if [ ! -d "${HOME}/google-cloud-sdk" ] || [ "${GSUTIL_VERSION}" != '4.19' ]; then
rm -rf "${HOME}/google-cloud-sdk" # Kill Travis' outdated non-updateable preinstalled version
echo 'Installing google-cloud-sdk...'
export CLOUDSDK_CORE_DISABLE_PROMPTS=1
time (curl -S -s https://sdk.cloud.google.com | bash &>/dev/null)
echo 'Done.'
fi
source "${HOME}/google-cloud-sdk/path.bash.inc"
openssl aes-256-cbc -K $encrypted_2b749c8e6327_key -iv $encrypted_2b749c8e6327_iv -in grunt/gcp-key.json.enc -out grunt/gcp-key.json -d
gcloud auth activate-service-account "$GCP_SERVICE_ACCOUNT" --key-file grunt/gcp-key.json &> /dev/null || (echo 'GCP login failed!'; exit 1)
echo "Uploading to http://preview.twbsapps.com/c/${TRAVIS_COMMIT} ..."
time gsutil -q -m cp -z html,css,js,svg -r "./${TRAVIS_COMMIT}" gs://preview.twbsapps.com/c/
echo 'Done.'
.travis.yml
+ 1
- 0
  • View file @ 37241ed7

  • Edit in single-file editor

  • Open in Web IDE


@@ -25,6 +25,7 @@ cache:
directories:
- node_modules
- vendor/bundle
- "$HOME/google-cloud-sdk"
env:
global:
- NPM_CONFIG_PROGRESS="false"
Gruntfile.js
+ 10
- 6
  • View file @ 37241ed7

  • Edit in single-file editor

  • Open in Web IDE


@@ -277,6 +277,9 @@ module.exports = function (grunt) {
},
'postcss-docs': {
command: 'npm run postcss-docs'
},
'upload-preview': {
command: './grunt/upload-preview.sh'
}
},
@@ -351,12 +354,13 @@ module.exports = function (grunt) {
// Only run Sauce Labs tests if there's a Sauce access key
if (typeof process.env.SAUCE_ACCESS_KEY !== 'undefined' &&
// Skip Sauce if running a different subset of the test suite
runSubset('sauce-js-unit') &&
// Skip Sauce on Travis when [skip sauce] is in the commit message
isUndefOrNonZero(process.env.TWBS_DO_SAUCE)) {
testSubtasks.push('babel:dev');
testSubtasks.push('connect');
testSubtasks.push('saucelabs-qunit');
runSubset('sauce-js-unit')) {
testSubtasks = testSubtasks.concat(['dist', 'docs-css', 'docs-js', 'clean:docs', 'copy:docs', 'exec:upload-preview']);
// Skip Sauce on Travis when [skip sauce] is in the commit message
if (isUndefOrNonZero(process.env.TWBS_DO_SAUCE)) {
testSubtasks.push('connect');
testSubtasks.push('saucelabs-qunit');
}
}
grunt.registerTask('test', testSubtasks);
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 participants
Reference: vinta/awesome-python!1456
Source branch: previewing

Menu

Explore Projects Groups Snippets