Skip to content

Commit 7b8fd91

Browse files
committed
add ci workflows
1 parent 9a1e524 commit 7b8fd91

File tree

2 files changed

+181
-0
lines changed

2 files changed

+181
-0
lines changed

.github/workflows/ci.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
workflow_dispatch:
9+
10+
env:
11+
CARGO_TERM_COLOR: always
12+
13+
jobs:
14+
fmt:
15+
name: Rustfmt
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: dtolnay/rust-action@nightly
20+
with:
21+
components: rustfmt
22+
- name: Check formatting
23+
run: cargo fmt --all -- --check
24+
25+
clippy:
26+
name: Clippy
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: dtolnay/rust-action@stable
31+
with:
32+
components: clippy
33+
- name: Clippy
34+
run: cargo clippy --all-targets --all-features -- -D warnings
35+
36+
test:
37+
name: Test (${{ matrix.os }})
38+
runs-on: ${{ matrix.os }}
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
os: [ubuntu-latest, macos-latest, windows-latest]
43+
steps:
44+
- uses: actions/checkout@v4
45+
- uses: dtolnay/rust-action@stable
46+
- name: Run tests
47+
run: cargo test --all-features --workspace
48+
49+
docs:
50+
name: Docs
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v4
54+
- uses: dtolnay/rust-action@stable
55+
- name: Check documentation
56+
env:
57+
RUSTDOCFLAGS: -D warnings
58+
run: cargo doc --no-deps --all-features --workspace
59+
60+
conformance:
61+
name: Sigstore Conformance
62+
runs-on: ubuntu-latest
63+
steps:
64+
- uses: actions/checkout@v4
65+
66+
- uses: dtolnay/rust-action@stable
67+
68+
- name: Build conformance binary
69+
run: cargo build --release --example conformance --package sigstore-verify
70+
71+
- name: Clone sigstore-conformance
72+
run: |
73+
git clone --depth 1 https://github.com/sigstore/sigstore-conformance.git
74+
cd sigstore-conformance
75+
pip install .
76+
77+
- name: Run sigstore-conformance
78+
env:
79+
GHA_SIGSTORE_CONFORMANCE_XFAIL: ""
80+
run: |
81+
pytest sigstore-conformance/test \
82+
--entrypoint ./target/release/examples/conformance \
83+
--skip-signing \
84+
-v
85+
86+
# Optional: Run full signing tests (requires OIDC token)
87+
conformance-signing:
88+
name: Sigstore Conformance (with signing)
89+
runs-on: ubuntu-latest
90+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
91+
permissions:
92+
id-token: write
93+
contents: read
94+
steps:
95+
- uses: actions/checkout@v4
96+
97+
- uses: dtolnay/rust-action@stable
98+
99+
- name: Build conformance binary
100+
run: cargo build --release --example conformance --package sigstore-verify
101+
102+
- name: Clone sigstore-conformance
103+
run: |
104+
git clone --depth 1 https://github.com/sigstore/sigstore-conformance.git
105+
cd sigstore-conformance
106+
pip install .
107+
108+
- name: Run sigstore-conformance (with signing)
109+
env:
110+
GHA_SIGSTORE_CONFORMANCE_XFAIL: ""
111+
run: |
112+
pytest sigstore-conformance/test \
113+
--entrypoint ./target/release/examples/conformance \
114+
-v

.github/workflows/release-plz.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Release-plz
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
# Release unpublished packages.
10+
release-plz-release:
11+
name: Release-plz release
12+
runs-on: ubuntu-latest
13+
# Prevent multiple releases from running at the same time
14+
concurrency:
15+
group: release-plz-release
16+
cancel-in-progress: false
17+
# Permissions needed for:
18+
# - contents: write - create GitHub releases
19+
# - pull-requests: write - update PRs
20+
# - id-token: write - request OIDC token for Sigstore attestations on crates.io
21+
permissions:
22+
contents: write
23+
pull-requests: write
24+
id-token: write
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Install Rust toolchain
32+
uses: dtolnay/rust-action@stable
33+
34+
- name: Run release-plz
35+
uses: release-plz/[email protected]
36+
with:
37+
command: release
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
40+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
41+
42+
# Create a PR with the new versions and changelog, preparing the next release.
43+
release-plz-pr:
44+
name: Release-plz PR
45+
runs-on: ubuntu-latest
46+
concurrency:
47+
group: release-plz-pr
48+
cancel-in-progress: false
49+
permissions:
50+
contents: write
51+
pull-requests: write
52+
steps:
53+
- name: Checkout repository
54+
uses: actions/checkout@v4
55+
with:
56+
fetch-depth: 0
57+
58+
- name: Install Rust toolchain
59+
uses: dtolnay/rust-action@stable
60+
61+
- name: Run release-plz
62+
uses: release-plz/[email protected]
63+
with:
64+
command: release-pr
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
67+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

0 commit comments

Comments
 (0)