Skip to content

Commit c13331c

Browse files
committed
Add reusable rust workflows
0 parents  commit c13331c

15 files changed

+290
-0
lines changed

nightly-issue.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: Nightly build failed
3+
labels: nightly
4+
---
5+
[Failed Run](https://github.com/{{ env.REPO }}/actions/runs/{{ env.RUN }})

workflows/audit.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
env:
2+
RUST_BACKTRACE: 1
3+
4+
jobs:
5+
audit:
6+
name: cargo audit
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v1
10+
- uses: actions-rs/audit-check@v1
11+
with:
12+
token: ${{ secrets.GITHUB_TOKEN }}
13+
14+
on:
15+
workflow_call:

workflows/cargo.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
env:
2+
RUST_BACKTRACE: 1
3+
4+
jobs:
5+
cargo:
6+
name: cargo +${{ inputs.toolchain }} ${{ inputs.command }}
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
- uses: hecrj/setup-rust-action@v1
11+
with:
12+
rust-version: ${{ inputs.toolchain }}
13+
targets: ${{ inputs.targets }}
14+
components: ${{ inputs.components }}
15+
- uses: actions-rs/cargo@v1
16+
with:
17+
toolchain: ${{ inputs.toolchain }}
18+
command: ${{ inputs.command }}
19+
args: ${{ inputs.args }}
20+
21+
on:
22+
workflow_call:
23+
inputs:
24+
toolchain:
25+
default: stable
26+
type: string
27+
components:
28+
default: ''
29+
type: string
30+
targets:
31+
default: ''
32+
type: string
33+
command:
34+
required: true
35+
type: string
36+
args:
37+
default: ''
38+
type: string

workflows/clippy.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
jobs:
2+
clippy:
3+
uses: workflows/cargo.yml
4+
with:
5+
toolchain: ${{ inputs.toolchain }}
6+
components: clippy
7+
command: clippy
8+
args: --workspace --all-targets --all-features --locked -- -D warnings
9+
10+
on:
11+
workflow_call:
12+
inputs:
13+
toolchain:
14+
default: stable
15+
type: string

workflows/coverage.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
env:
2+
RUST_BACKTRACE: 1
3+
4+
jobs:
5+
codecov:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v2
9+
- uses: hecrj/setup-rust-action@v1
10+
- uses: actions-rs/[email protected]
11+
with:
12+
args: --locked --all-features
13+
- uses: codecov/codecov-action@v1
14+
15+
on:
16+
workflow_call:

workflows/docsrs.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
jobs:
2+
docsrs:
3+
name: cargo +nightly doc --cfg docsrs
4+
uses: workflows/cargo.yml
5+
with:
6+
toolchain: nightly
7+
command: doc
8+
args: --no-deps --workspace --all-features --locked
9+
env:
10+
RUSTDOCFLAGS: --cfg=docsrs -Dwarnings
11+
12+
on:
13+
workflow_call:

workflows/features.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
jobs:
2+
check-features:
3+
name: cargo hack check --feature-powerset
4+
runs-on: ubuntu-latest
5+
env:
6+
RUSTFLAGS: -Dwarnings
7+
steps:
8+
- uses: actions/checkout@v2
9+
- uses: hecrj/setup-rust-action@v1
10+
- uses: taiki-e/install-action@cargo-hack
11+
- uses: actions-rs/cargo@v1
12+
with:
13+
command: hack
14+
args:
15+
check
16+
--workspace
17+
--feature-powerset
18+
--no-dev-deps
19+
--skip "${{ inputs.skip }}"
20+
21+
on:
22+
workflow_call:
23+
skip:
24+
default: ''
25+
type: string

workflows/fmt.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
jobs:
2+
fmt:
3+
uses: workflows/cargo.yml
4+
with:
5+
toolchain: ${{ inputs.toolchain }}
6+
components: rustfmt
7+
command: fmt
8+
args: -- --check
9+
10+
on:
11+
workflow_call:
12+
inputs:
13+
toolchain:
14+
default: stable
15+
type: string

workflows/minimal-versions.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
jobs:
2+
minimal-versions:
3+
name: cargo minimal-versions check --workspace
4+
runs-on: ubuntu-latest
5+
steps:
6+
- uses: actions/checkout@v2
7+
- uses: hecrj/setup-rust-action@v1
8+
- uses: taiki-e/install-action@cargo-minimal-versions
9+
- uses: actions-rs/cargo@v1
10+
with:
11+
command: minimal-versions
12+
args: check --workspace
13+
14+
on:
15+
workflow_call:

workflows/nightly.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
jobs:
2+
test:
3+
uses: workflows/test.yml
4+
with:
5+
toolchain: nightly
6+
fmt:
7+
uses: workflows/fmt.yml
8+
with:
9+
toolchain: nightly
10+
clippy:
11+
uses: workflows/clippy.yml
12+
with:
13+
toolchain: nightly
14+
audit:
15+
uses: workflows/audit.yml
16+
updates:
17+
uses: workflows/updates.yml
18+
minimal-versions:
19+
uses: workflows/minimal-versions.yml
20+
21+
create-issue:
22+
name: create issue
23+
runs-on: ubuntu-latest
24+
if: failure()
25+
needs: [test, fmt, clippy, audit]
26+
steps:
27+
- uses: actions/checkout@v2
28+
- uses: JasonEtco/create-an-issue@v2
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
REPO: ${{ github.repository }}
32+
RUN: ${{ github.run_id }}
33+
with:
34+
update_existing: true
35+
filename: nightly-issue.md
36+
37+
close-issue:
38+
name: close issue
39+
runs-on: ubuntu-latest
40+
needs: [test, fmt, clippy, audit]
41+
steps:
42+
- uses: lee-dohm/close-matching-issues@v2
43+
with:
44+
query: 'is:open label:nightly'
45+
token: ${{ secrets.GITHUB_TOKEN }}
46+
47+
on:
48+
workflow_call:

workflows/platforms.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
jobs:
2+
test:
3+
strategy:
4+
matrix:
5+
platform:
6+
- { os: macos-latest, target: x86_64-apple-darwin }
7+
- { os: ubuntu-latest, target: i686-unknown-linux-gnu }
8+
- { os: ubuntu-latest, target: x86_64-unknown-linux-gnu }
9+
- { os: windows-latest, target: i686-pc-windows-msvc }
10+
- { os: windows-latest, target: x86_64-pc-windows-msvc }
11+
runs-on: ${{ matrix.platform.os }}
12+
uses: workflows/test.yml
13+
with:
14+
targets: ${{ matrix.platform.target }}
15+
args: --target ${{ matrix.platform.target }}
16+
17+
on:
18+
workflow_call:

workflows/pull_request.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
jobs:
2+
test:
3+
uses: workflows/test.yml
4+
fmt:
5+
uses: workflows/fmt.yml
6+
clippy:
7+
uses: workflows/clippy.yml
8+
audit:
9+
uses: workflows/audit.yml
10+
11+
on:
12+
workflow_call:

workflows/staging.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
jobs:
2+
platforms:
3+
uses: workflows/platforms.yml
4+
check-features:
5+
uses: workflows/features.yml
6+
updates:
7+
uses: workflows/updates.yml
8+
minimal-versions:
9+
uses: workflows/minimal-versions.yml
10+
11+
on:
12+
workflow_call:

workflows/test.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
env:
2+
RUST_BACKTRACE: 1
3+
4+
jobs:
5+
test:
6+
name: cargo +${{ inputs.toolchain }} test ${{ inputs.args }}
7+
uses: workflows/cargo.yml
8+
with:
9+
toolchain: ${{ inputs.toolchain }}
10+
targets: ${{ inputs.targets }}
11+
command: test
12+
args: --workspace --locked --all-features ${{ inputs.args }}
13+
14+
on:
15+
workflow_call:
16+
inputs:
17+
toolchain:
18+
default: stable
19+
type: string
20+
args:
21+
required: false
22+
type: string
23+
targets:
24+
required: false
25+
type: string

workflows/updates.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
jobs:
2+
updates:
3+
name: cargo update && cargo test
4+
runs-on: ubuntu-latest
5+
steps:
6+
- uses: actions/checkout@v2
7+
- uses: hecrj/setup-rust-action@v1
8+
- uses: actions-rs/cargo@v1
9+
with:
10+
command: update
11+
args: --aggressive
12+
- uses: actions-rs/cargo@v1
13+
with:
14+
command: test
15+
args: --workspace --locked --all-features
16+
17+
on:
18+
workflow_call:

0 commit comments

Comments
 (0)