Skip to content

Commit dda8257

Browse files
authored
Ci (#86)
* updated CI This changes the CI as follows. - adds a build run and also triggers on every push, not just PRs, so that we can display badges for the main branch. - separates all three CI runs into separate actions, so that we can display badges (can only be done per action) * add badges in README * CI: do not run build and test actions twice on PRs
1 parent 0632194 commit dda8257

File tree

4 files changed

+69
-31
lines changed

4 files changed

+69
-31
lines changed

.github/workflows/build.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Build
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
push:
7+
branches:
8+
- main
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Set up Rust
17+
uses: actions-rs/toolchain@v1
18+
with:
19+
toolchain: stable
20+
profile: minimal
21+
override: true
22+
- name: Cache Cargo dependencies
23+
uses: Swatinem/rust-cache@v2
24+
- name: Build
25+
run: cargo build --verbose

.github/workflows/clippy.yml

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,19 @@
1-
name: Clippy Lint Check
1+
name: Clippy
2+
on: [pull_request]
23

3-
on:
4-
pull_request:
5-
branches:
6-
- main
4+
jobs:
5+
lint:
6+
runs-on: ubuntu-latest
77

8-
jobs:
9-
clippy:
10-
name: Run Clippy & Tests
11-
runs-on: ubuntu-latest
12-
steps:
13-
- name: Checkout repository
14-
uses: actions/checkout@v4
15-
16-
- name: Install Rust
17-
uses: dtolnay/rust-toolchain@stable
18-
with:
19-
components: clippy
20-
21-
- name: Cache Cargo dependencies
22-
uses: Swatinem/rust-cache@v2
23-
24-
- name: Run Clippy
25-
run: |
26-
set -x
27-
cargo clippy -- -D warnings
28-
29-
- name: Run Tests
30-
run: |
31-
set -x
32-
cargo test --all-features --verbose
8+
steps:
9+
- uses: actions/checkout@v2
10+
- name: Set up Rust
11+
uses: actions-rs/toolchain@v1
12+
with:
13+
toolchain: stable
14+
profile: minimal
15+
override: true
16+
- name: Cache Cargo dependencies
17+
uses: Swatinem/rust-cache@v2
18+
- name: Run clippy
19+
run: cargo clippy -- -D warnings

.github/workflows/test.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Test
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
push:
7+
branches:
8+
- main
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Set up Rust
17+
uses: actions-rs/toolchain@v1
18+
with:
19+
toolchain: stable
20+
profile: minimal
21+
override: true
22+
- name: Cache Cargo dependencies
23+
uses: Swatinem/rust-cache@v2
24+
- name: Run tests
25+
run: cargo test --all-features --verbose

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
<!-- badges: start -->
44
[![made-with-rust](https://img.shields.io/badge/Made%20with-Rust-1f425f.svg)](https://www.rust-lang.org/)
5-
[![Clippy Lint Check](https://github.com/SynthesisLab/shepherd/actions/workflows/clippy.yml/badge.svg?branch=main&event=fork)](https://github.com/SynthesisLab/shepherd/actions/workflows/clippy.yml)
5+
[![Build](https://github.com/SynthesisLab/shepherd/actions/workflows/build.yaml/badge.svg?branch=main&event=push)](https://github.com/SynthesisLab/shepherd/actions/workflows/build.yaml)
6+
[![Tests](https://github.com/SynthesisLab/shepherd/actions/workflows/test.yaml/badge.svg?branch=main&event=push)](https://github.com/SynthesisLab/shepherd/actions/workflows/test.yaml)
67
<!-- badges: end -->
78

89

0 commit comments

Comments
 (0)