From 4a49a4b7d90414ec9cb32474112c0edc1035b7f4 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Fri, 22 May 2020 23:04:09 -0500 Subject: [PATCH] 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. --- .github/workflows/main.yml | 64 ++++++++++++++++++++++++++++++++++++++ ADMIN_TASKS.md | 2 +- README.md | 2 +- ci/validate.sh | 4 +++ 4 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/main.yml create mode 100644 ci/validate.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..fcdcb905 --- /dev/null +++ b/.github/workflows/main.yml @@ -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 \ No newline at end of file diff --git a/ADMIN_TASKS.md b/ADMIN_TASKS.md index ad02693a..70137557 100644 --- a/ADMIN_TASKS.md +++ b/ADMIN_TASKS.md @@ -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` diff --git a/README.md b/README.md index 08d53c84..5f86f89a 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/ci/validate.sh b/ci/validate.sh new file mode 100644 index 00000000..9e2cfdf1 --- /dev/null +++ b/ci/validate.sh @@ -0,0 +1,4 @@ +for file in src/*.md ; do + echo Checking references in $file + cargo run --quiet --bin link2print < $file > /dev/null +done \ No newline at end of file