Port to GitHub Actions

Most of the Rust project has moved over to Actions, but we were still on
Travis. This sets up the needed Actions for us.
This commit is contained in:
Steve Klabnik 2020-05-22 23:04:09 -05:00
parent df7b104359
commit 4a49a4b7d9
4 changed files with 70 additions and 2 deletions

64
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,64 @@
name: CI
on: [push, pull_request]
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Update rustup
run: rustup self update
- name: Install Rust
run: |
rustup set profile minimal
rustup toolchain install 1.41.0 -c rust-docs
rustup default 1.41.0
- name: Install mdbook
run: |
mkdir bin
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.3.5/mdbook-v0.3.5-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
echo "##[add-path]$(pwd)/bin"
- name: Report versions
run: |
rustup --version
rustc -Vv
mdbook --version
- name: Run tests
run: mdbook test
lint:
name: Run lints
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Update rustup
run: rustup self update
- name: Install Rust
run: |
rustup set profile minimal
rustup toolchain install nightly -c rust-docs
rustup default nightly
- name: Install mdbook
run: |
mkdir bin
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.3.5/mdbook-v0.3.5-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
echo "##[add-path]$(pwd)/bin"
- name: Report versions
run: |
rustup --version
rustc -Vv
mdbook --version
- name: Spellcheck
run: bash ci/spellcheck.sh list
- name: Lint for local file paths
run: |
mdbook build
cargo run --bin lfp src
- name: Validate references
run: bash ci/validate.sh
- name: Check for broken links
run: |
curl -sSLo linkcheck.sh \
https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/linkcheck.sh
# Cannot use --all here because of the generated redirect pages aren't available.
sh linkcheck.sh book

View File

@ -5,7 +5,7 @@ occasional maintenance tasks.
## Update the `rustc` version
- Change the version number in `.travis.yml`
- Change the version number in `.github/workflows/main.yml`
- Change the version number in `rust-toolchain`, which should change the version you're using
locally with `rustup`
- Change the version number in `src/title-page.md`

View File

@ -1,6 +1,6 @@
# The Rust Programming Language
[![Build Status](https://travis-ci.com/rust-lang/book.svg?branch=master)](https://travis-ci.com/rust-lang/book)
![Build Status](https://github.com/rust-lang/book/workflows/main/badge.svg)
This repository contains the source of "The Rust Programming Language" book.

4
ci/validate.sh Normal file
View File

@ -0,0 +1,4 @@
for file in src/*.md ; do
echo Checking references in $file
cargo run --quiet --bin link2print < $file > /dev/null
done