Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
14 contributors

Users who have contributed to this file

@JuanCaicedo @teesloane @rosieyohannan @trevor-circleci @felicianotech @millerpeterson @michelle-luna @keybits @kimh @yangkookkim @zzak @KunalJain @glenjamin @smart-alek
209 lines (198 sloc) 6.93 KB
version: 2
references:
js_deps_cache_key: &js_deps_cache_key
v8-dependency-js-deps-{{ checksum "package-lock.json" }}
js_deps_backup_cache_key: &js_deps_backup_cache_key
v8-dependency-js-deps
workspace_root: &workspace_root
/tmp/workspace
attach_workspace: &attach_workspace
attach_workspace:
at: *workspace_root
jobs:
js_build:
docker:
- image: node:8.11.1
steps:
- *attach_workspace
- checkout
- restore_cache:
keys:
- *js_deps_cache_key
- *js_deps_backup_cache_key
- run:
name: npm dependencies
command: npm install
- run:
name: Prepare JS assets
command: npm run webpack-prod
- run:
name: Persist JS assets
command: |
set -exu
mkdir -p /tmp/workspace/js
mv jekyll/assets/js/*.bundle.js /tmp/workspace/js/
- persist_to_workspace:
root: *workspace_root
paths:
- js
- save_cache:
key: *js_deps_cache_key
paths:
- node_modules
build:
docker:
- image: circleci/ruby:2.6.3-node-browsers
working_directory: ~/circleci-docs
environment:
JEKYLL_ENV: production
NOKOGIRI_USE_SYSTEM_LIBRARIES: true
JOB_RESULTS_PATH: run-results
steps:
- checkout
- *attach_workspace
- run:
name: "Test Markdown Files"
command: |
wget https://github.com/felicianotech/md-proofer/releases/download/v0.1.0/md-proofer-v0.1.0-linux-amd64.tar.gz
tar xfz md-proofer-v*.tar.gz
sudo chmod +x ./md-proofer
echo "Test CircleCI 2.0 Markdown files"
echo "===================================================================================="
./md-proofer lint jekyll/_cci2/
echo "\n\nTest CircleCI API Markdown files"
echo "===================================================================================="
./md-proofer lint jekyll/_api/
echo "\n\nTest CircleCI 1.0 Markdown files"
echo "===================================================================================="
./md-proofer lint jekyll/_cci1/
- restore_cache:
key: circleci-docs-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
- run:
name: Install Ruby dependencies
command: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
- save_cache:
key: circleci-docs-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
paths:
- "vendor/bundle"
- run:
name: Create results directory
command: mkdir -p $JOB_RESULTS_PATH
- run:
name: "Manage Data Files We'll Need"
command: |
./scripts/pull-docker-image-tags.sh
- run:
name: Restore js
command: |
set -exu
mkdir -p /tmp/workspace/js
mv /tmp/workspace/js/* jekyll/assets/js/
- run:
name: Shim untranslated Japanese pages
command: ./scripts/shim-translation.sh jekyll/_cci2 jekyll/_cci2_ja
- restore_cache:
key: circleci-docs-{{ .Branch }}-{{ checksum "src-api/Gemfile.lock" }}
- run:
name: Build API 1.x documentation with Slate
command: |
cd src-api; bundle install; npm install
bundle exec middleman build --clean
cp -R build/* ../jekyll/_api
- run:
name: Build API 2.x documentation with Widdershins and Slate
command: |
cd src-api; rm -r build; rm source/index.html.md
curl https://circleci.com/api/v2/openapi.json > openapi.json
node node_modules/widdershins/widdershins.js --search false --language_tabs 'shell:Curl' 'ruby:Ruby' 'python:Python' 'javascript:Javascript' 'go: Go' --summary openapi.json -o source/index.html.md
bundle exec middleman build --clean
cp -R build/* ../jekyll/_api/v2
- save_cache:
key: circleci-docs-{{ .Branch }}-{{ checksum "src-api/Gemfile.lock" }}
paths:
- "src-api/vendor/bundle"
- run:
name: Build the Jekyll site
command: bundle exec jekyll build --config jekyll/_config.yml,jekyll/_config_production.yml --source jekyll --destination jekyll/_site/docs/ 2>&1 | tee $JOB_RESULTS_PATH/build-results.txt
- run:
name: Build PDFs for Server
command: |
bundle exec asciidoctor-pdf -v
./scripts/build_pdfs.sh
- run:
name: Test with HTMLproofer
command: bundle exec htmlproofer jekyll/_site --allow-hash-href --check-favicon --check-html --disable-external --file-ignore "/docs/ja/2.0/aws-prereq/,/docs/ja/2.0/ops/,/docs/ja/2.0/about-circleci/,/docs/ja/2.0/demo-apps/,/docs/ja/2.0/google-auth/,/docs/ja/2.0/orb-concepts/,/docs/ja/2.0/tutorials/" --empty-alt-ignore | tee $JOB_RESULTS_PATH/htmlproofer-results.txt
- store_artifacts:
path: release/tmp/
- store_artifacts:
path: jekyll/_site/docs/
destination: circleci-docs
- store_artifacts:
path: run-results/
destination: run-results
- persist_to_workspace:
root: ~/circleci-docs/jekyll/_site
paths:
- docs
reindex-search:
docker:
- image: circleci/ruby:2.6.3-node-browsers
working_directory: ~/circleci-docs
environment:
JEKYLL_ENV: production
steps:
- checkout
- *attach_workspace
- restore_cache:
key: circleci-docs-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
- run:
name: Install Ruby dependencies
command: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
- run:
name: Update Algolia Index
command: |
ALGOLIA_API_KEY=$ALGOLIA_PRIVATE_KEY bundle exec jekyll algolia --source jekyll --config jekyll/_config.yml
deploy:
docker:
- image: cibuilds/aws:1.16.185
steps:
- attach_workspace:
at: ./generated-site
- run:
name: Deploy to S3 if tests pass and branch is Master
command: aws s3 sync generated-site/docs s3://circle-production-static-site/docs/ --delete
workflows:
version: 2
build-deploy:
jobs:
- js_build
- build:
requires:
- js_build
- reindex-search:
requires:
- build
filters:
branches:
only: master
- deploy:
requires:
- build
filters:
branches:
only: master
nightly-build:
triggers:
- schedule:
cron: "0 8 * * *"
filters:
branches:
only: master
jobs:
- js_build
- build:
requires:
- js_build
- deploy:
requires:
- build
You can’t perform that action at this time.