ci: Move the remaining CI tasks (updating the book) to GitHub actions.

This commit is contained in:
Emilio Cobos Álvarez
2020-12-26 19:58:03 +01:00
parent 259be1235f
commit a5f9b70dca
5 changed files with 53 additions and 58 deletions
+19
View File
@@ -148,3 +148,22 @@ jobs:
BINDGEN_FEATURE_TESTING_ONLY_DOCS: ${{matrix.feature_testing_only_docs}}
BINDGEN_NO_DEFAULT_FEATURES: ${{matrix.no_default_features}}
run: ./ci/test.sh
test-book:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install stable
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
# NOTE(emilio): Change deploy-book as well if you change this.
- name: Test book
run: |
cargo install mdbook --root mdbook-install --vers "^0.2.1" --force
./mdbook-install/bin/mdbook build book
./mdbook-install/bin/mdbook test book
+34
View File
@@ -0,0 +1,34 @@
name: Deploy book
on:
push:
branches:
- master
jobs:
deploy-book:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
- name: Install stable
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Test book
run: |
cargo install mdbook --root mdbook-install --vers "^0.2.1" --force
./mdbook-install/bin/mdbook build book
./mdbook-install/bin/mdbook test book
- name: Deploy book
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: book/book
-15
View File
@@ -1,15 +0,0 @@
language: rust
dist: xenial
os:
- linux
rust:
- stable
env:
global:
- CARGO_TARGET_DIR=/tmp/bindgen
script:
- ./ci/test-book.sh
after_success:
- test "$TRAVIS_PULL_REQUEST" == "false" &&
test "$TRAVIS_BRANCH" == "master" &&
./ci/deploy-book.sh
-33
View File
@@ -1,33 +0,0 @@
#!/usr/bin/env bash
set -xeu
cd "$(dirname "$0")/../book"
# Ensure mdbook is installed.
cargo install mdbook --vers "^0.2.1" --force || true
export PATH="$PATH:~/.cargo/bin"
# Get the git revision we are on.
rev=$(git rev-parse --short HEAD)
# Build the users guide book and go into the built book's directory.
rm -rf ./book
mdbook build
cd ./book
# Make the built book directory a new git repo, fetch upstream, make a new
# commit on gh-pages, and push it upstream.
git init
git config user.name "Travis CI"
git config user.email "builds@travis-ci.org"
git remote add upstream "https://$GH_TOKEN@github.com/rust-lang/rust-bindgen.git"
git fetch upstream
git reset upstream/gh-pages
touch .
git add -A .
git commit -m "Rebuild users guide at ${rev}"
git push upstream HEAD:gh-pages
-10
View File
@@ -1,10 +0,0 @@
#!/usr/bin/env bash
set -xeu
cd "$(dirname "$0")/../book"
cargo install mdbook --vers "^0.2.1" --force || true
export PATH="$PATH:~/.cargo/bin"
mdbook build
mdbook test