Skip to content

Commit 2b649fe

Browse files
authored
Merge pull request #1071 from ehuss/github-actions
Switch to GitHub Actions.
2 parents a592da3 + fc4236e commit 2b649fe

File tree

11 files changed

+214
-193
lines changed

11 files changed

+214
-193
lines changed

.github/workflows/deploy.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Deploy
2+
on:
3+
release:
4+
types: [created]
5+
6+
jobs:
7+
release:
8+
name: Deploy Release
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
matrix:
12+
os: [ubuntu-latest, macos-latest, windows-latest]
13+
env:
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
steps:
16+
- uses: actions/checkout@master
17+
- name: Install hub
18+
run: ci/install-hub.sh ${{ matrix.os }}
19+
shell: bash
20+
- name: Install Rustup
21+
run: ci/install-rustup.sh stable
22+
shell: bash
23+
- name: Install Rust
24+
run: ci/install-rust.sh stable
25+
shell: bash
26+
- name: Build and deploy artifacts
27+
run: ci/make-release.sh ${{ matrix.os }}
28+
shell: bash
29+
pages:
30+
name: GitHub Pages
31+
runs-on: ubuntu-latest
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
steps:
35+
- uses: actions/checkout@master
36+
- name: Install Rust (rustup)
37+
run: rustup update stable --no-self-update && rustup default stable
38+
- name: Deploy to GitHub Pages
39+
run: ci/deploy-gh-pages.sh

.github/workflows/main.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: CI
2+
on:
3+
# Only run when merging to master, or open/synchronize/reopen a PR.
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
jobs:
10+
test:
11+
name: Test
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
build: [stable, beta, nightly, macos, windows, msrv]
16+
include:
17+
- build: stable
18+
os: ubuntu-latest
19+
rust: stable
20+
- build: beta
21+
os: ubuntu-latest
22+
rust: beta
23+
- build: nightly
24+
os: ubuntu-latest
25+
rust: nightly
26+
- build: macos
27+
os: macos-latest
28+
rust: stable
29+
- build: windows
30+
os: windows-latest
31+
rust: stable
32+
- build: msrv
33+
os: ubuntu-latest
34+
rust: 1.35.0
35+
steps:
36+
- uses: actions/checkout@master
37+
- name: Install Rustup
38+
run: bash ci/install-rustup.sh ${{ matrix.rust }}
39+
- name: Install Rust
40+
run: bash ci/install-rust.sh ${{ matrix.rust }}
41+
- name: Build and run tests
42+
run: cargo test
43+
- name: Test no default
44+
run: cargo test --no-default-features
45+
46+
rustfmt:
47+
name: Rustfmt
48+
runs-on: ubuntu-latest
49+
steps:
50+
- uses: actions/checkout@master
51+
- name: Install Rust
52+
run: rustup update stable && rustup default stable && rustup component add rustfmt
53+
- run: cargo fmt -- --check

.travis.yml

Lines changed: 0 additions & 82 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,8 @@
11
# mdBook
22

3-
<table>
4-
<tr>
5-
<td><strong>Linux / OS X</strong></td>
6-
<td>
7-
<a href="https://travis-ci.com/rust-lang-nursery/mdBook"><img src="https://travis-ci.com/rust-lang-nursery/mdBook.svg?branch=master"></a>
8-
</td>
9-
</tr>
10-
<tr>
11-
<td><strong>Windows</strong></td>
12-
<td>
13-
<a href="https://ci.appveyor.com/project/rust-lang-libs/mdbook"><img src="https://ci.appveyor.com/api/projects/status/ysyke2rvo85sni55?svg=true"></a>
14-
</td>
15-
</tr>
16-
<tr>
17-
<td colspan="2">
18-
<a href="https://crates.io/crates/mdbook"><img src="https://img.shields.io/crates/v/mdbook.svg"></a>
19-
<a href="LICENSE"><img src="https://img.shields.io/github/license/rust-lang-nursery/mdBook.svg"></a>
20-
</td>
21-
</tr>
22-
</table>
3+
[![Build Status](https://github.com/rust-lang-nursery/mdBook/workflows/CI/badge.svg)](https://github.com/rust-lang-nursery/mdBook/actions?workflow=CI)
4+
[![crates.io](https://img.shields.io/crates/v/mdbook.svg)](https://crates.io/crates/mdbook)
5+
[![LICENSE](https://img.shields.io/github/license/rust-lang-nursery/mdBook.svg)](LICENSE)
236

247
mdBook is a utility to create modern online books from Markdown files.
258

appveyor.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

ci/before_deploy.sh

Lines changed: 0 additions & 32 deletions
This file was deleted.

ci/deploy-gh-pages.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
# Updates gh-pages with latest docs.
3+
set -ex
4+
5+
cargo run -- build book-example
6+
cd book-example/book
7+
touch .nojekyll
8+
git init
9+
git config --local user.email ""
10+
git config --local user.name "GitHub Deployer"
11+
git add .
12+
git commit -m "Deploy to gh-pages"
13+
remote="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
14+
git push "$remote" HEAD:gh-pages --force

ci/install-hub.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
# Installs the `hub` executable into hub/bin
3+
set -ex
4+
case $1 in
5+
ubuntu*)
6+
curl -LsSf https://github.com/github/hub/releases/download/v2.12.8/hub-linux-amd64-2.12.8.tgz -o hub.tgz
7+
mkdir hub
8+
tar -xzvf hub.tgz --strip=1 -C hub
9+
;;
10+
macos*)
11+
curl -LsSf https://github.com/github/hub/releases/download/v2.12.8/hub-darwin-amd64-2.12.8.tgz -o hub.tgz
12+
mkdir hub
13+
tar -xzvf hub.tgz --strip=1 -C hub
14+
;;
15+
windows*)
16+
curl -LsSf https://github.com/github/hub/releases/download/v2.12.8/hub-windows-amd64-2.12.8.zip -o hub.zip
17+
7z x hub.zip -ohub
18+
;;
19+
*)
20+
echo "OS should be first parameter, was: $1"
21+
;;
22+
esac
23+
24+
echo "##[add-path]$PWD/hub/bin"

ci/install-rust.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
# Install/update rust.
3+
# The first argument should be the toolchain to install.
4+
5+
set -ex
6+
if [ -z "$1" ]
7+
then
8+
echo "First parameter must be toolchain to install."
9+
exit 1
10+
fi
11+
TOOLCHAIN="$1"
12+
13+
rustup set profile minimal
14+
rustup component remove --toolchain=$TOOLCHAIN rust-docs || echo "already removed"
15+
rustup update $TOOLCHAIN
16+
rustup default $TOOLCHAIN
17+
rustup -V
18+
rustc -Vv
19+
cargo -V

ci/install-rustup.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
# Install/update rustup.
3+
# The first argument should be the toolchain to install.
4+
#
5+
# It is helpful to have this as a separate script due to some issues on
6+
# Windows where immediately after `rustup self update`, rustup can fail with
7+
# "Device or resource busy".
8+
9+
set -ex
10+
if [ -z "$1" ]
11+
then
12+
echo "First parameter must be toolchain to install."
13+
exit 1
14+
fi
15+
TOOLCHAIN="$1"
16+
17+
# Install/update rustup.
18+
if command -v rustup
19+
then
20+
echo `command -v rustup` `rustup -V` already installed
21+
rustup self update
22+
else
23+
# macOS currently does not have rust pre-installed.
24+
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $TOOLCHAIN --profile=minimal
25+
echo "##[add-path]$HOME/.cargo/bin"
26+
fi

0 commit comments

Comments
 (0)