Switch to GitHub Actions ()

Closes 
This commit is contained in:
Chris Wong 2020-12-23 19:20:58 +13:00 committed by GitHub
parent 167afc65bd
commit 24593d8118
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 124 additions and 53 deletions
.github/workflows
.travis.yml

124
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,124 @@
name: CI
on:
pull_request:
push:
branches:
- master
schedule:
- cron: '0 1 * * *'
jobs:
main:
name: Main
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: true
components: clippy
- name: Run tests
run: cargo test --workspace
- name: Check Clippy
# TODO(#209): Use `--all-targets`
run: cargo clippy --workspace -- -D warnings
# Optional features (i.e. web framework integrations) take a long time to
# build and rarely break. Speed up CI by checking them separately.
all-features:
name: All features
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: true
- name: Check build
run: cargo check --workspace --all-features --all-targets
benchmarks:
name: Benchmarks
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: true
- name: Run benchmarks
run: cd benchmarks && cargo test --benches --locked
documentation:
name: Documentation
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
with:
# Documentation build uses `git describe` which requires history
fetch-depth: 0
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: true
- name: Build documentation
run: cd docs && make -j$(nproc)
rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
# rustfmt is often missing on nightly. Since there's little benefit to
# using the nightly version, use the more reliable stable build instead.
toolchain: stable
profile: minimal
override: true
components: rustfmt
- name: Check formatting
run: |
cargo fmt -- --check
(cd benchmarks && cargo fmt -- --check)
(cd docs && cargo fmt -- --check)
# trybuild harnesses are technically not part of the Cargo project, so
# need to be checked separately
rustfmt --check maud/tests/warnings/*.rs

View file

@ -1,53 +0,0 @@
language: rust
rust: nightly
virt: lxd
jobs:
include:
- name: "Main"
script:
- |
RUN_CLIPPY=true
rustup component add clippy --toolchain=nightly || RUN_CLIPPY=false
- cargo test --workspace
- |
if $RUN_CLIPPY; then
CLIPPY_STATUS=0
for package in maud_htmlescape maud_macros maud; do
(cd $package && cargo clippy -- -D warnings) || CLIPPY_STATUS=$?
done
(exit $CLIPPY_STATUS)
fi
# Optional features (i.e. web framework integrations) take a long time to
# build and rarely break. Speed up CI by checking them separately.
- name: "All features"
script:
- cargo check --workspace --all-features --all-targets
- name: "Benchmarks"
script:
- (cd benchmarks && cargo test --benches --locked)
- name: "Documentation"
script:
- (cd docs && make -j$(nproc))
deploy:
provider: pages
edge: true
token: $GITHUB_TOKEN
fqdn: maud.lambda.xyz
local_dir: docs/site
keep_history: false
on:
tags: true
- name: "Format"
# rustfmt is often missing on nightly. Since there's little benefit to
# using the nightly version, use the more reliable stable build instead.
rust: stable
before_script:
- rustup component add rustfmt
script:
- cargo fmt -- --check
- (cd benchmarks && cargo fmt -- --check)
- (cd docs && cargo fmt -- --check)
# trybuild harnesses are technically not part of the Cargo project, so
# need to be checked separately
- rustfmt --check maud/tests/warnings/*.rs