Skip to content

Commit cd421b6

Browse files
authored
Merge pull request #2 from cgwalters/rework-ci
Copy GHA workflow from ocidir-rs
2 parents 7ac51c4 + 94edfef commit cd421b6

File tree

1 file changed

+48
-16
lines changed

1 file changed

+48
-16
lines changed

.github/workflows/ci.yml

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,58 @@
1-
name: Build and Test
1+
# Copied originally from https://github.com/coreos/repo-templates
2+
3+
name: Rust
24
on:
35
push:
4-
branches: [master]
6+
branches: [main]
57
pull_request:
6-
branches: [master]
8+
branches: [main]
9+
permissions:
10+
contents: read
11+
12+
# don't waste job slots on superseded code
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
716

817
env:
918
CARGO_TERM_COLOR: always
19+
# Pinned toolchain for linting
20+
ACTIONS_LINTS_TOOLCHAIN: 1.76.0
1021

1122
jobs:
12-
build:
23+
tests-stable:
24+
name: Tests, stable toolchain
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Check out repository
28+
uses: actions/checkout@v4
29+
- name: Install toolchain
30+
uses: dtolnay/rust-toolchain@v1
31+
with:
32+
toolchain: stable
33+
- name: Cache build artifacts
34+
uses: Swatinem/rust-cache@v2
35+
- name: cargo build
36+
run: cargo build --all-targets --all-features
37+
- name: cargo test
38+
run: cargo test --all-targets --all-features
39+
# https://github.com/rust-lang/cargo/issues/6669
40+
- name: cargo test --doc
41+
run: cargo test --doc --all-features
42+
linting:
43+
name: Lints, pinned toolchain
1344
runs-on: ubuntu-latest
1445
steps:
15-
- uses: actions/checkout@v2
16-
- name: Build
17-
run: rustup target add wasm32-unknown-unknown && rustup target add wasm32-wasi && cargo build && cargo build --target wasm32-unknown-unknown && cargo build --target wasm32-wasi
18-
- name: Run tests
19-
run: cargo test
20-
- name: Set up Go
21-
uses: actions/setup-go@v2
22-
- name: Run integration tests
23-
run: |
24-
export GOPATH=$HOME/go && export GOBIN=$(go env GOPATH)/bin && export PATH=$PATH:$GOPATH && export PATH=$PATH:$GOBIN && mkdir -p $GOBIN
25-
go get github.com/technosophos/canonjson
26-
./scripts/integration.sh
46+
- name: Check out repository
47+
uses: actions/checkout@v4
48+
- name: Install toolchain
49+
uses: dtolnay/rust-toolchain@v1
50+
with:
51+
toolchain: ${{ env.ACTIONS_LINTS_TOOLCHAIN }}
52+
components: rustfmt, clippy
53+
- name: Cache build artifacts
54+
uses: Swatinem/rust-cache@v2
55+
- name: cargo fmt (check)
56+
run: cargo fmt -- --check -l
57+
- name: cargo clippy (warnings)
58+
run: cargo clippy --all-targets --all-features -- -D warnings

0 commit comments

Comments
 (0)