Setup GitHub actions

This commit is contained in:
Matthijs Brobbel 2020-06-24 20:22:51 +02:00
parent 7af96855a2
commit b9939e8100
No known key found for this signature in database
GPG key ID: 551189F8515034D3
4 changed files with 95 additions and 30 deletions

53
.github/workflows/book.yml vendored Normal file
View file

@ -0,0 +1,53 @@
name: Book
on:
push:
branches:
- master
pull_request:
paths:
- 'book/**'
jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
MDBOOK_VERSION: '0.4.0'
MDBOOK_LINKCHECK_VERSION: '0.7.0'
MDBOOK_MERMAID_VERSION: '^0.4'
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/.cargo/bin
key: ${{ env.MDBOOK_MERMAID_VERSION }}
- name: Install mdbook
run: |
mkdir -p $HOME/mdbook $HOME/mdbook-linkcheck
curl -L https://github.com/rust-lang/mdBook/releases/download/v$MDBOOK_VERSION/mdbook-v$MDBOOK_VERSION-x86_64-unknown-linux-gnu.tar.gz | tar xz -C $HOME/mdbook
echo "::add-path::${HOME}/mdbook/"
curl -L https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/download/v$MDBOOK_LINKCHECK_VERSION/mdbook-linkcheck-v$MDBOOK_LINKCHECK_VERSION-x86_64-unknown-linux-gnu.tar.gz | tar xz -C $HOME/mdbook-linkcheck
echo "::add-path::${HOME}/mdbook-linkcheck/"
mdbook-mermaid --version || cargo install mdbook-mermaid --version $MDBOOK_MERMAID_VERSION --debug
- name: Build
run: mdbook build
working-directory: book
- uses: actions/upload-artifact@v2
with:
name: book
path: book/book/html
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/download-artifact@v2
with:
name: book
- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .

40
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,40 @@
name: Test
on:
push:
branches:
- master
pull_request:
paths:
- '**.rs'
- '**/Cargo.*'
jobs:
test:
name: Test
strategy:
matrix:
rust:
- stable
- beta
experimental:
- false
include:
- rust: nightly
experimental: true
continue-on-error: ${{ matrix.experimental }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
default: true
- uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --all-targets
- uses: actions-rs/cargo@v1
with:
command: test
args: --doc

View file

@ -1,29 +0,0 @@
language: rust
sudo: false
rust:
- nightly
- beta
- stable
cache:
- cargo
matrix:
allow_failures:
- rust: nightly
before_install:
- cargo install mdbook --version '0.3.1' --debug --force
- cargo install mdbook-linkcheck --version '0.4.0' --debug --force
- cargo install mdbook-mermaid --version '^0.4' --debug --force
script:
- RUST_BACKTRACE=1 CARGO_INCREMENTAL=0 cargo test --all
- RUST_BACKTRACE=1 CARGO_INCREMENTAL=0 cargo test --tests --all
- RUST_BACKTRACE=1 CARGO_INCREMENTAL=0 cargo test --examples --all
- cd book && mdbook build && mdbook test
deploy:
provider: pages
skip-cleanup: true
github-token: $GITHUB_TOKEN
local-dir: book/book/html
keep-history: false
on:
branch: master

View file

@ -1,6 +1,7 @@
# salsa
[![Build Status](https://travis-ci.org/salsa-rs/salsa.svg?branch=master)](https://travis-ci.org/salsa-rs/salsa)
[![Test](https://github.com/salsa-rs/salsa/workflows/Test/badge.svg)](https://github.com/salsa-rs/salsa/actions?query=workflow%3ATest)
[![Book](https://github.com/salsa-rs/salsa/workflows/Book/badge.svg)](https://github.com/salsa-rs/salsa/actions?query=workflow%3ABook)
[![Released API docs](https://docs.rs/salsa/badge.svg)](https://docs.rs/salsa)
[![Crates.io](https://img.shields.io/crates/v/salsa.svg)](https://crates.io/crates/salsa)