diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 790d0b06..05a90675 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,59 +1,58 @@ 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 - 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: run_book_tests + displayName: Book code example tests + 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: | + cd docs/book/tests && $HOME/.cargo/bin/cargo test + displayName: Test book code examples via skeptic -- job: run_book_tests - displayName: Book code example tests - 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: | - cd docs/book/tests && $HOME/.cargo/bin/cargo test - displayName: Test book code examples via skeptic + - job: build_book_master + displayName: Build rendered book on master branch and push to Github + pool: + 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: $(GHSshKnownHosts) + sshPublicKey: $(GHSshPub) + sshKeySecureFile: $(GHSshPriv) + - script: | + ./docs/book/ci-build.sh master -- job: build_book_master - displayName: Build rendered book on master branch and push to Github - pool: - 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 + parameters: + name: Linux + vmImage: ubuntu-16.04 -- template: _build/azure-pipelines-template.yml - parameters: - name: Linux - vmImage: ubuntu-16.04 + - template: _build/azure-pipelines-template.yml + parameters: + name: macOS + vmImage: macOS-10.13 -- template: _build/azure-pipelines-template.yml - parameters: - name: macOS - vmImage: macOS-10.13 - -- template: _build/azure-pipelines-template.yml - parameters: - name: Windows - vmImage: vs2017-win2016 + - template: _build/azure-pipelines-template.yml + parameters: + name: Windows + vmImage: vs2017-win2016 diff --git a/docs/book/ci-build.sh b/docs/book/ci-build.sh index 6f66df52..55b97eff 100755 --- a/docs/book/ci-build.sh +++ b/docs/book/ci-build.sh @@ -1,8 +1,8 @@ #! /usr/bin/env bash # 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. # # It is only inteded for use on the CI! @@ -29,7 +29,7 @@ if [ $MDBOOK -h ]; then echo "mdbook found..." else 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 MDBOOK="/tmp/mdbook" fi @@ -44,6 +44,8 @@ git clean -fd git checkout gh-pages rm -rf $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 commit -m "Updated book for $VERSION" +git commit -m "Updated book for $VERSION ***NO_CI***" git push origin gh-pages