Add actions

These will be more easily maintained by others than a Taskcluster
configuration.
This commit is contained in:
Dustin J. Mitchell 2021-04-03 19:51:25 -04:00
parent c767718ac9
commit e4e40b3e5e
3 changed files with 106 additions and 98 deletions

27
.github/workflows/publish-docs.yml vendored Normal file
View file

@ -0,0 +1,27 @@
name: taskchampion
on:
push:
branches:
- main
jobs:
mdbook-deploy:
runs-on: ubuntu-latest
needs: mdbook
steps:
- uses: actions/checkout@v1
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: 'latest'
- run: mdbook build docs
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/book

79
.github/workflows/rust-tests.yml vendored Normal file
View file

@ -0,0 +1,79 @@
name: taskchampion
on:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: actions-rs/cargo@v1.0.1
with:
command: check
- name: test
run: cargo test
clippy:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v1
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- run: rustup component add clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
mdbook:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: 'latest'
- run: mdbook test docs
- run: mdbook build docs

View file

@ -1,98 +0,0 @@
version: 1
reporting: checks-v1
policy:
pullRequests: public
tasks:
$if: 'tasks_for in ["github-push", "github-pull-request"]'
then:
$let:
run:
$if: 'tasks_for == "github-push"'
then: {$eval: 'event.ref == "refs/heads/main"'}
else: {$eval: 'event.action in ["opened", "reopened", "synchronize"]'}
repo_url:
$if: 'tasks_for == "github-push"'
then: ${event.repository.clone_url}
else: ${event.pull_request.head.repo.clone_url}
ref:
$if: 'tasks_for == "github-push"'
then: ${event.after}
else: ${event.pull_request.head.sha}
in:
- $if: run
then:
provisionerId: 'proj-misc'
workerType: 'ci'
deadline: {$fromNow: '1 hour'}
expires: {$fromNow: '1 day'}
payload:
maxRunTime: 3600
image: rust:latest
command:
- /bin/bash
- '-c'
- >-
rustup component add rustfmt &&
git clone ${repo_url} repo &&
cd repo &&
git config advice.detachedHead false &&
git checkout ${ref} &&
cargo test
metadata:
name: taskchampion-tests
description: Run tests for taskchampion
owner: dustin@v.igoro.us
source: ${repo_url}
- $if: run
then:
provisionerId: 'proj-misc'
workerType: 'ci'
deadline: {$fromNow: '1 hour'}
expires: {$fromNow: '1 day'}
payload:
maxRunTime: 3600
image: rust:latest
command:
- /bin/bash
- '-c'
- >-
rustup component add rustfmt &&
git clone ${repo_url} repo &&
cd repo &&
git config advice.detachedHead false &&
git checkout ${ref} &&
rustup component add clippy &&
cargo clippy &&
cargo fmt -- --check
metadata:
name: taskchampion-clippy
description: Run clippy and rustfmt for taskchampion
owner: dustin@v.igoro.us
source: ${repo_url}
- $if: run
then:
provisionerId: 'proj-misc'
workerType: 'ci'
deadline: {$fromNow: '1 hour'}
expires: {$fromNow: '1 day'}
payload:
maxRunTime: 3600
image: rust:latest
command:
- /bin/bash
- '-c'
- >-
git clone ${repo_url} repo &&
cd repo &&
git config advice.detachedHead false &&
git checkout ${ref} &&
cd docs &&
curl -L --compressed https://github.com/rust-lang/mdBook/releases/download/v0.4.4/mdbook-v0.4.4-x86_64-unknown-linux-gnu.tar.gz | gunzip -c | tar -xf - &&
chmod +x mdbook &&
./mdbook test &&
./mdbook build
metadata:
name: taskchampion-book
description: Verify that the docs build with mdbook
owner: dustin@v.igoro.us
source: ${repo_url}