@@ -14,6 +14,10 @@ concurrency:
14
14
group : ${{ github.head_ref || github.run_id }}
15
15
cancel-in-progress : true
16
16
17
+ permissions :
18
+ issues : write
19
+ pull-requests : write
20
+
17
21
jobs :
18
22
build-and-test :
19
23
name : " Build and Test"
@@ -83,10 +87,60 @@ jobs:
83
87
uses : Swatinem/rust-cache@v2
84
88
- name : Install TileDB
85
89
uses : ./.github/actions/install-tiledb
86
- - name : Check Formatting
87
- run : cargo fmt --quiet --check
88
- - name : Lint
89
- run : cargo clippy --no-deps --all-targets --all-features -- -Dwarnings
90
+ - name : Check Formatting and Clippy
91
+ id : lints
92
+ env :
93
+ GITHUB_OS : ${{ matrix.os }}
94
+ shell : python
95
+ run : |
96
+ # Checking formatting and clippy
97
+ import json
98
+ import os
99
+ import subprocess as sp
100
+
101
+ fmt = sp.run(["cargo", "fmt", "--quiet", "--check"])
102
+ clippy = sp.run([
103
+ 'cargo',
104
+ 'clippy',
105
+ '--workspace',
106
+ '--all-targets',
107
+ '--all-features',
108
+ '--',
109
+ '-Dwarnings'
110
+ ])
111
+
112
+ if fmt.returncode == 0 and clippy.returncode == 0:
113
+ exit(0)
114
+
115
+ msg = [
116
+ "# Rust +Nightly Check Failures - {}".format(os.environ["GITHUB_OS"]),
117
+ ""
118
+ ]
119
+ if fmt.returncode == 0:
120
+ msg.append("* ✅ Formatting Check Succeeded")
121
+ else:
122
+ msg.append("* ❌ Formatting Check Failed")
123
+ if clippy.returncode == 0:
124
+ msg.append("* ✅ Clippy Check Succeeded")
125
+ else:
126
+ msg.append("* ❌ Clippy Check Failed")
127
+ msg.append("")
128
+
129
+ msg = json.dumps("\n".join(msg))
130
+
131
+ with open(os.environ["GITHUB_OUTPUT"], "wb") as handle:
132
+ handle.write("message={}\n".format(msg).encode("utf-8"))
133
+ - uses : actions/github-script@v7
134
+ if : ${{ steps.lints.outputs.message }}
135
+ with :
136
+ github-token : ${{secrets.GITHUB_TOKEN}}
137
+ script : |
138
+ github.rest.issues.createComment({
139
+ issue_number: context.issue.number,
140
+ owner: context.repo.owner,
141
+ repo: context.repo.repo,
142
+ body: ${{ steps.lints.outputs.message }}
143
+ })
90
144
91
145
check-pr-title :
92
146
name : " Check Title Format"
0 commit comments