Skip to content

Add github actions workflows #253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
on: [push]

jobs:
build_and_test:
name: Build and test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- uses: actions/checkout@master

- name: Install nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true

- name: check
uses: actions-rs/cargo@v1
with:
command: check
args: --all --benches --bins --examples --tests

- name: check unstable
uses: actions-rs/cargo@v1
with:
command: check
args: --features unstable --all --benches --bins --examples --tests

- name: tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all --doc --features unstable

check_fmt_and_docs:
name: Checking fmt and docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master

- name: setup
run: |
rustup default nightly
rustup component add rustfmt
test -x $HOME/.cargo/bin/mdbook || ./ci/install-mdbook.sh
rustc --version
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you see the install-mdbook script? That way saves quite a bit of time compared to the cargo install mdbook.

However, the script is fragile because it ultimately relies on a specific release filename pattern and it would be nice if we could have a more general solution. (This is currently an issue for another CI related PR here).

I think a better way might be to create a docker image based on the official image (or slim or docs.rs) with all of the tools we need (deadlinks, mdbook, tarpaulin?) pre-installed. Then we could use the container.image setting to set the environment so that stuff is available without having to rebuild it.

Another github action could handle docker image related tasks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree this would be really nice, and it would probably worth doing this in a follow-up!

Perhaps it's worth opening an issue for this on https://github.com/actions-rs/meta/issues also; I agree that having a general solution for this would probably be very valuable to a lot of people.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cargo install mdbook should be avoided, it adds ~8 min of build time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, long. I will fix it tonight, so take a moment

- name: mdbook
run: |
mdbook build docs
- name: fmt
run: cargo fmt --all -- --check

- name: Docs
run: cargo doc --features docs,unstable
19 changes: 19 additions & 0 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
on: push
name: Clippy check
jobs:
clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- id: component
uses: actions-rs/components-nightly@v1
with:
component: clippy
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ steps.component.outputs.toolchain }}
override: true
- run: rustup component add clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}