File tree 3 files changed +46
-39
lines changed
3 files changed +46
-39
lines changed Original file line number Diff line number Diff line change
1
+ name : Continuous Integration
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - ' **'
7
+
8
+ jobs :
9
+ ci :
10
+ runs-on : ubuntu-latest
11
+
12
+ steps :
13
+ - name : Checkout repository
14
+ uses : actions/checkout@v3
15
+
16
+ - name : Set up Rust
17
+ uses : actions-rs/toolchain@v1
18
+ with :
19
+ toolchain : stable
20
+ override : true
21
+
22
+ - name : Run cargo build
23
+ run : cargo build --release
24
+
25
+ - name : Run tests
26
+ run : cargo test --release
27
+
28
+ - name : Check formatting
29
+ run : cargo fmt -- --check
30
+
31
+ - name : Run clippy
32
+ run : cargo clippy -- -D warnings
Original file line number Diff line number Diff line change 1
1
name : Publish to crates.io
2
2
3
3
on :
4
- push :
5
- branches :
6
- - main
7
- paths :
8
- - ' src/**'
4
+ workflow_run :
5
+ workflows : ["Continuous Integration"]
6
+ types :
7
+ - completed
9
8
10
9
jobs :
11
10
publish :
11
+ if : ${{ github.event.workflow_run.conclusion == 'success' && github.ref == 'refs/heads/main' }}
12
12
runs-on : ubuntu-latest
13
13
14
14
steps :
15
15
- name : Checkout repository
16
16
uses : actions/checkout@v3
17
17
18
- - name : Set up Rust
19
- uses : actions-rs/toolchain@v1
20
- with :
21
- toolchain : stable
22
- override : true
23
-
24
- - name : Build the project
25
- run : cargo build --release
26
-
27
- - name : Run tests
28
- run : cargo test --release
18
+ - name : Check for changes in src directory
19
+ id : check_changes
20
+ run : |
21
+ if git diff --name-only ${{ github.event.workflow_run.head_commit.id }}^ ${{ github.event.workflow_run.head_commit.id }} | grep -q '^src/'; then
22
+ echo "changes_in_src=true" >> $GITHUB_ENV
23
+ else
24
+ echo "changes_in_src=false" >> $GITHUB_ENV
25
+ fi
29
26
30
27
- name : Publish to crates.io
31
- if : success()
28
+ if : env.changes_in_src == 'true'
32
29
env :
33
30
CARGO_REGISTRY_TOKEN : ${{ secrets.CARGO_REGISTRY_TOKEN }}
34
31
run : cargo publish
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments