2121 branches :
2222 - ' main'
2323
24- permissions :
25- contents : read
26-
2724jobs :
28- codacy-security-scan :
29- permissions :
30- contents : read # for actions/checkout to fetch code
31- security-events : write # for github/codeql-action/upload-sarif to upload SARIF results
32- actions : read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
33- name : Codacy Security Scan
34- runs-on : ubuntu-latest
35- steps :
36- # Checkout the repository to the GitHub Actions runner
37- - name : Checkout code
38- uses : actions/checkout@v3
39-
40- # Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
41- - name : Run Codacy Analysis CLI
42- uses : codacy/codacy-analysis-cli-action@d840f886c4bd4edc059706d09c6a1586111c540b
43- with :
44- # Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
45- # You can also omit the token and run the tools that support default configurations
46- project-token : ${{ secrets.CODACY_PROJECT_TOKEN }}
47- verbose : true
48- output : results.sarif
49- format : sarif
50- # Adjust severity of non-security issues
51- gh-code-scanning-compat : true
52- # Force 0 exit code to allow SARIF file generation
53- # This will handover control about PR rejection to the GitHub side
54- max-allowed-issues : 2147483647
5525
56- # Upload the SARIF file generated in the previous step
57- - name : Upload SARIF results file
58- uses : github/codeql-action/upload-sarif@v2
59- with :
60- sarif_file : results.sarif
6126 rust-quality-gate :
6227 name : Rust Quality Gate
63- env :
64- working-directory : " role-manager"
6528 runs-on : ubuntu-latest
29+ permissions : write-all
6630 steps :
6731 - name : Checkout code
68- uses : actions/checkout@v2
32+ uses : actions/checkout@v3
6933
70- - name : Install Rust
71- uses : actions-rs/toolchain@v1
34+ - name : Install Rust toolchain
35+ uses : actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # @ v1
7236 with :
37+ profile : minimal
7338 toolchain : stable
39+ components : clippy
7440 override : true
7541
76- - name : Build code
77- run : cargo build --all --release
78- working-directory : ${{ env.working-directory }}
79-
80- - name : Install required cargo
81- run : cargo install clippy-sarif sarif-fmt
82-
83- - name : Run rust-clippy
84- run :
85- cargo clippy
86- --all-features
87- --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt
88- continue-on-error : true
89- working-directory : ${{ env.working-directory }}
90-
91- - name : Upload analysis results to GitHub
92- uses : github/codeql-action/upload-sarif@v1
93- with :
94- sarif_file : ${{ env.working-directory }}/rust-clippy-results.sarif
95- wait-for-processing : true
42+ - name : Install Dependencies
43+ run : sudo ./configure.sh -yd
9644
97- rust-format :
98- name : Rust Formatting Gate
99- env :
100- working-directory : " role-manager"
101- runs-on : ubuntu-latest
102- steps :
103- - name : Checkout code
104- uses : actions/checkout@v2
105-
106- - name : Install Rust
107- uses : actions-rs/toolchain@v1
45+ # if pull request review only
46+ - uses : mbrobbel/rustfmt-check@master
10847 with :
109- toolchain : stable
110- override : true
111- - name : Build code
112- run : cargo build --all --release
113- working-directory : ${{ env.working-directory }}
114- - name : Format code with Rustfmt
115- run : cargo fmt --all -- --check
116- working-directory : ${{ env.working-directory }}
48+ token : ${{ secrets.GITHUB_TOKEN }}
49+ continue-on-error : true # TODO: remove this line when rustfmt-check is fixed
11750
118- rust-security :
119- name : Rust Security Gate
120- env :
121- working-directory : " role-manager"
122- runs-on : ubuntu-latest
123- steps :
124- - name : Checkout code
125- uses : actions/checkout@v2
126-
127- - name : Install Rust
128- uses : actions-rs/toolchain@v1
51+ - uses : actions-rs/clippy-check@v1
12952 with :
130- toolchain : stable
131- override : true
132-
133- - name : Cargo audit
134- run : cargo audit --json | tee cargo-audit.json
135- working-directory : ${{ env.working-directory }}
136- id : cargo-audit
53+ token : ${{ secrets.GITHUB_TOKEN }}
54+ args : --all-features
0 commit comments