Skip to content

Commit 0c8f7d7

Browse files
authored
Merge pull request #3 from EspressoSystems/feat/publish-crate
Add workflow to publish crate
2 parents 740a73c + 6311db7 commit 0c8f7d7

File tree

4 files changed

+107
-125
lines changed

4 files changed

+107
-125
lines changed

.github/workflows/build.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,43 @@ on:
55
branches:
66
- main
77
- release-*
8+
tags:
9+
- v*.*.*
810
pull_request:
911
branches:
1012
- main
1113
- release-*
1214
workflow_dispatch:
1315

1416
jobs:
17+
lint:
18+
runs-on: ubuntu-latest
19+
env:
20+
RUST_LOG: info
21+
steps:
22+
- uses: styfle/[email protected]
23+
name: Cancel Outdated Builds
24+
with:
25+
all_but_latest: true
26+
access_token: ${{ github.token }}
27+
28+
- uses: actions/checkout@v4
29+
name: Checkout Repository
30+
31+
- uses: dtolnay/rust-toolchain@stable
32+
33+
- uses: Swatinem/rust-cache@v2
34+
name: Enable Rust Caching
35+
36+
- name: Format Check
37+
run: cargo fmt -- --check
38+
39+
- uses: actions-rs/clippy-check@v1
40+
name: Clippy
41+
with:
42+
token: ${{ github.token }}
43+
args: --workspace --all-features --all-targets -- -D warnings
44+
1545
build:
1646
runs-on: ubuntu-latest
1747
env:
@@ -46,3 +76,80 @@ jobs:
4676
github_token: ${{ secrets.GITHUB_TOKEN }}
4777
publish_dir: ./target/doc
4878
cname: tide-disco.docs.espressosys.com
79+
80+
test:
81+
runs-on: ubuntu-latest
82+
env:
83+
RUST_LOG: info
84+
steps:
85+
- uses: styfle/[email protected]
86+
name: Cancel Outdated Builds
87+
with:
88+
all_but_latest: true
89+
access_token: ${{ github.token }}
90+
91+
- uses: actions/checkout@v4
92+
name: Checkout Repository
93+
94+
- uses: dtolnay/rust-toolchain@stable
95+
96+
- uses: Swatinem/rust-cache@v2
97+
name: Enable Rust Caching
98+
99+
- name: Build tests
100+
run: cargo test --workspace --release --all-features --no-run
101+
102+
- name: Test
103+
run: cargo test --workspace --release --all-features --verbose -- --test-threads 2
104+
timeout-minutes: 60
105+
106+
docs:
107+
runs-on: ubuntu-latest
108+
env:
109+
RUST_LOG: info
110+
steps:
111+
- uses: styfle/[email protected]
112+
name: Cancel Outdated Builds
113+
with:
114+
all_but_latest: true
115+
access_token: ${{ github.token }}
116+
117+
- uses: actions/checkout@v4
118+
name: Checkout Repository
119+
120+
- uses: dtolnay/rust-toolchain@stable
121+
122+
- uses: Swatinem/rust-cache@v2
123+
name: Enable Rust Caching
124+
125+
- name: Generate Documentation
126+
run: |
127+
cargo doc --no-deps --lib --release --all-features
128+
echo '<meta http-equiv="refresh" content="0; url=base64_bytes">' > target/doc/index.html
129+
130+
- name: Deploy Documentation
131+
uses: peaceiris/actions-gh-pages@v3
132+
if: ${{ github.ref == 'refs/heads/main' }}
133+
with:
134+
github_token: ${{ secrets.GITHUB_TOKEN }}
135+
publish_dir: ./target/doc
136+
cname: base64-bytes.docs.espressosys.com
137+
138+
publish:
139+
needs:
140+
- build
141+
- test
142+
- lint
143+
- docs
144+
runs-on: ubuntu-latest
145+
steps:
146+
- uses: actions/checkout@v3
147+
- uses: actions-rs/toolchain@v1
148+
with:
149+
toolchain: stable
150+
override: true
151+
- uses: katyo/publish-crates@v2
152+
with:
153+
# Only do an actual publish if this is a push to a release tag. Otherwise, do a dry run.
154+
dry-run: ${{ !(github.event_name == 'push' && github.ref_type == 'tag') }}
155+
ignore-unpublished-changes: true

.github/workflows/docs.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)