1+ # This workflow uses actions that are not certified by GitHub.
2+ # They are provided by a third-party and are governed by
3+ # separate terms of service, privacy policy, and support
4+ # documentation.
5+ # rust-clippy is a tool that runs a bunch of lints to catch common
6+ # mistakes in your Rust code and help improve your Rust code.
7+ # More details at https://github.com/rust-lang/rust-clippy
8+ # and https://rust-lang.github.io/rust-clippy/
9+
10+ name : rust-clippy analyze
11+
12+ on :
13+ push :
14+ branches : [ "main" ]
15+ pull_request :
16+ # The branches below must be a subset of the branches above
17+ branches : [ "main" ]
18+ schedule :
19+ - cron : ' 20 14 * * 5'
20+
21+ jobs :
22+ rust-clippy-analyze :
23+ name : Run rust-clippy analyzing
24+ runs-on : ubuntu-latest
25+
26+ strategy :
27+ matrix :
28+ pg : [ "16" ]
29+ permissions :
30+ contents : read
31+ security-events : write
32+ actions : read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
33+ steps :
34+ - name : Checkout code
35+ uses : actions/checkout@v4
36+
37+ - name : Install Rust toolchain
38+ uses : actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # @v1
39+ with :
40+ profile : minimal
41+ toolchain : stable
42+ components : clippy
43+ override : true
44+
45+
46+ - name : Install cargo-pgrx
47+ run : |
48+ PGRX_VERSION=$(cargo metadata --format-version 1 | jq -r '.packages[]|select(.name=="pgrx")|.version')
49+ cargo install --locked --version=$PGRX_VERSION cargo-pgrx --debug --force
50+ cargo pgrx init --pg${{ matrix.pg }} download
51+
52+ - name : Install required cargo
53+ run : cargo install clippy-sarif sarif-fmt
54+
55+ - name : Run rust-clippy
56+ run :
57+ cargo clippy
58+ --all-features
59+ --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt
60+ continue-on-error : true
61+
62+ - name : Upload analysis results to GitHub
63+ uses : github/codeql-action/upload-sarif@v1
64+ with :
65+ sarif_file : rust-clippy-results.sarif
66+ wait-for-processing : true
0 commit comments