diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000000..fcdcb905d1 --- /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/.travis.yml b/.travis.yml deleted file mode 100644 index 5221c0edf7..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -sudo: false -dist: trusty -language: rust -cache: cargo -rust: - - 1.41.0 -branches: - only: - - master -addons: - apt: - packages: - - aspell - - aspell-en -before_script: - - (cargo install mdbook --vers 0.3.5 --force || true) -script: - - bash ci/build.sh diff --git a/ADMIN_TASKS.md b/ADMIN_TASKS.md index ad02693a33..701375574b 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 08d53c8423..5f86f89a3d 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 0000000000..9e2cfdf10d --- /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