Skip to content

Commit 82130be

Browse files
authored
add CI
1 parent 280d0a0 commit 82130be

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

.github/workflows/rust.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build and Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build_and_deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Set up Rust
17+
uses: actions/setup-rust@v1
18+
with:
19+
rust-version: stable
20+
21+
- name: Cache Cargo registry
22+
uses: actions/cache@v3
23+
with:
24+
path: ~/.cargo/registry
25+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
26+
restore-keys: |
27+
${{ runner.os }}-cargo-registry-
28+
29+
- name: Cache Cargo build
30+
uses: actions/cache@v3
31+
with:
32+
path: target
33+
key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.toml') }}
34+
restore-keys: |
35+
${{ runner.os }}-cargo-target-
36+
37+
- name: Build the project
38+
run: cargo build --release
39+
40+
- name: Run Cargo project in 'example' directory
41+
run: |
42+
cd example
43+
cargo run build
44+
45+
- name: Deploy docs to GitHub Pages
46+
uses: JamesIves/github-pages-deploy-action@v4
47+
with:
48+
branch: gh-pages
49+
folder: example/docs
50+
token: ${{ secrets.GITHUB_TOKEN }}
51+
52+
- name: Clean up
53+
run: |
54+
rm -rf example/docs

0 commit comments

Comments
 (0)