Skip to content

Commit 4bd1806

Browse files
author
Eric Swanson
committed
format, lint, and test workflows
1 parent f5f8033 commit 4bd1806

File tree

3 files changed

+104
-0
lines changed

3 files changed

+104
-0
lines changed

.github/workflows/fmt.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Format
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- ens/sdk-2105-skeleton
8+
pull_request:
9+
10+
jobs:
11+
format:
12+
name: fmt:required
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Install Rust toolchain from rust-toolchain.toml
19+
run: rustup show
20+
21+
- name: Check formatting
22+
run: cargo fmt --all -- --check
23+

.github/workflows/lint.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- ens/sdk-2105-skeleton
8+
pull_request:
9+
10+
jobs:
11+
lint:
12+
name: lint:required
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Show Rust toolchain
19+
run: rustup show
20+
21+
- name: Cache Cargo
22+
uses: actions/cache@v4
23+
with:
24+
path: |
25+
~/.cargo/registry
26+
~/.cargo/git
27+
target
28+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-lint-1
29+
30+
- name: Run Lint
31+
run: cargo clippy --verbose --tests --benches -- -D warnings
32+
env:
33+
RUST_BACKTRACE: 1

.github/workflows/test.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- ens/sdk-2105-skeleton
8+
pull_request:
9+
10+
jobs:
11+
test:
12+
name: ${{ matrix.test }} on ${{ matrix.os }}
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
os: [ubuntu-latest, macos-latest]
18+
test:
19+
- name: hello_tests
20+
package: icp-cli
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Show Rust toolchain version
26+
run: rustup show
27+
28+
- uses: actions/cache@v4
29+
with:
30+
path: |
31+
~/.cargo/registry
32+
~/.cargo/git
33+
target
34+
key: ${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-test-1
35+
36+
- name: Run ${{ matrix.test }}
37+
run: cargo test --package ${{ matrix.test.package }} --test ${{ matrix.test.name }}
38+
39+
40+
aggregate:
41+
name: test:required
42+
if: ${{ always() }}
43+
runs-on: ubuntu-latest
44+
needs: [test]
45+
steps:
46+
- name: check result
47+
if: ${{ needs.test.result != 'success' }}
48+
run: exit 1

0 commit comments

Comments
 (0)