Christian Legnitto 2019-04-16 21:27:24 -07:00
parent 17e564c6f0
commit 94cc621598
2 changed files with 58 additions and 57 deletions

View file

@ -1,59 +1,58 @@
jobs: jobs:
- job: check_formatting
displayName: Check formatting
pool:
vmImage: ubuntu-16.04
steps:
- script: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
$HOME/.cargo/bin/rustup component add rustfmt
displayName: Install stable Rust
- script: |
$HOME/.cargo/bin/cargo fmt -- --check
displayName: Run rustfmt
- job: check_formatting - job: run_book_tests
displayName: Check formatting displayName: Book code example tests
pool: pool:
vmImage: ubuntu-16.04 vmImage: ubuntu-16.04
steps: steps:
- script: | - script: |
curl https://sh.rustup.rs -sSf | sh -s -- -y curl https://sh.rustup.rs -sSf | sh -s -- -y
$HOME/.cargo/bin/rustup component add rustfmt $HOME/.cargo/bin/rustup component add rustfmt
displayName: Install stable Rust displayName: Install stable Rust
- script: | - script: |
$HOME/.cargo/bin/cargo fmt -- --check cd docs/book/tests && $HOME/.cargo/bin/cargo test
displayName: Run rustfmt displayName: Test book code examples via skeptic
- job: run_book_tests - job: build_book_master
displayName: Book code example tests displayName: Build rendered book on master branch and push to Github
pool: pool:
vmImage: ubuntu-16.04 vmImage: ubuntu-16.04
steps: dependsOn: run_book_tests
- script: | condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
curl https://sh.rustup.rs -sSf | sh -s -- -y variables:
$HOME/.cargo/bin/rustup component add rustfmt - group: github-keys
displayName: Install stable Rust steps:
- script: | - task: InstallSSHKey@0
cd docs/book/tests && $HOME/.cargo/bin/cargo test inputs:
displayName: Test book code examples via skeptic hostName: $(GHSshKnownHosts)
sshPublicKey: $(GHSshPub)
sshKeySecureFile: $(GHSshPriv)
- script: |
./docs/book/ci-build.sh master
- job: build_book_master - template: _build/azure-pipelines-template.yml
displayName: Build rendered book on master branch and push to Github parameters:
pool: name: Linux
vmImage: ubuntu-16.04 vmImage: ubuntu-16.04
dependsOn: run_book_tests
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
variables:
- group: github-keys
steps:
# - task: InstallSSHKey@0
# inputs:
# hostName: $(secret.GHSshKnownHosts)
# sshPublicKey: $(secret.GHSshPub)
# sshKeySecureFile: $(secret.GHSshPriv)
- script: |
./docs/book/ci-build.sh master
- template: _build/azure-pipelines-template.yml - template: _build/azure-pipelines-template.yml
parameters: parameters:
name: Linux name: macOS
vmImage: ubuntu-16.04 vmImage: macOS-10.13
- template: _build/azure-pipelines-template.yml - template: _build/azure-pipelines-template.yml
parameters: parameters:
name: macOS name: Windows
vmImage: macOS-10.13 vmImage: vs2017-win2016
- template: _build/azure-pipelines-template.yml
parameters:
name: Windows
vmImage: vs2017-win2016

View file

@ -1,8 +1,8 @@
#! /usr/bin/env bash #! /usr/bin/env bash
# Usage: ./ci-build.sh VERSION # Usage: ./ci-build.sh VERSION
# #
# This script builds the book to HTML with mdbook # This script builds the book to HTML with mdbook
# commits and pushes the contents to the repo in the "gh-pages" branch. # commits and pushes the contents to the repo in the "gh-pages" branch.
# #
# It is only inteded for use on the CI! # It is only inteded for use on the CI!
@ -29,7 +29,7 @@ if [ $MDBOOK -h ]; then
echo "mdbook found..." echo "mdbook found..."
else else
echo "mdbook not found. Downloading..." echo "mdbook not found. Downloading..."
curl -L https://github.com/rust-lang-nursery/mdBook/releases/download/v0.2.0/mdbook-v0.2.0-x86_64-unknown-linux-gnu.tar.gz | tar xzf - curl -L https://github.com/rust-lang-nursery/mdBook/releases/download/v0.2.0/mdbook-v0.2.0-x86_64-unknown-linux-gnu.tar.gz | tar xzf -
mv ./mdbook /tmp/mdbook mv ./mdbook /tmp/mdbook
MDBOOK="/tmp/mdbook" MDBOOK="/tmp/mdbook"
fi fi
@ -44,6 +44,8 @@ git clean -fd
git checkout gh-pages git checkout gh-pages
rm -rf $VERSION rm -rf $VERSION
mv /tmp/book-content ./$VERSION mv /tmp/book-content ./$VERSION
git config --local user.name "Juniper Doc Bot"
git config --local user.email "juniper@example.com"
git add -A $VERSION git add -A $VERSION
git commit -m "Updated book for $VERSION" git commit -m "Updated book for $VERSION ***NO_CI***"
git push origin gh-pages git push origin gh-pages