-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (123 loc) · 3.83 KB
/
codacy-analysis.yml
File metadata and controls
138 lines (123 loc) · 3.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Codacy Local Analysis
on:
push:
branches:
- main
paths:
- .codacy.yml
- .codacy.yaml
- .codacy/**
- .github/workflows/codacy-analysis.yml
- AGENTS.md
- docs/**
- src/**
- tests/**
- bench/**
- "*.md"
- "*.sh"
- CMakeLists.txt
- Makefile
pull_request:
branches:
- main
paths:
- .codacy.yml
- .codacy.yaml
- .codacy/**
- .github/workflows/codacy-analysis.yml
- AGENTS.md
- docs/**
- src/**
- tests/**
- bench/**
- "*.md"
- "*.sh"
- CMakeLists.txt
- Makefile
schedule:
- cron: "37 04 * * 3"
workflow_dispatch:
permissions:
actions: read
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
codacy-local:
name: Codacy Local Analysis
runs-on: ubuntu-latest
timeout-minutes: 45
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Set up Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "26"
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version: "1.26.x"
cache: false
- name: Install Codacy Analysis CLI
run: npm install -g @codacy/analysis-cli@0.8.0
- name: Install Opengrep
run: |
mkdir -p "$HOME/.local/bin"
curl -fsSL \
https://github.com/opengrep/opengrep/releases/download/v1.22.0/opengrep_manylinux_x86 \
-o "$HOME/.local/bin/opengrep"
echo "45bcd58440e397ed52c50e953ccf5948909ea77087c9186fc7d277216f62e319 $HOME/.local/bin/opengrep" | sha256sum -c -
chmod +x "$HOME/.local/bin/opengrep"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
"$HOME/.local/bin/opengrep" --version
- name: Inspect Codacy tool availability
run: |
codacy-analysis analyze . \
--inspect \
--output-format json \
--output codacy-inspect.json
- name: Run Codacy local analysis
id: codacy
run: |
set +e
codacy-analysis analyze . \
--install-dependencies \
--output-format sarif \
--output codacy.sarif \
--parallel-tools 2 \
--tool-timeout 900000
status=$?
echo "status=${status}" >> "$GITHUB_OUTPUT"
if [ ! -s codacy.sarif ]; then
echo "Codacy SARIF output was not created." >&2
exit 1
fi
exit 0
- name: Upload Codacy SARIF artifact
if: always() && hashFiles('codacy.sarif') != ''
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: codacy-sarif
path: codacy.sarif
retention-days: 5
- name: Upload Codacy SARIF to code scanning
if: always() && hashFiles('codacy.sarif') != '' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
uses: github/codeql-action/upload-sarif@87557b9c84dde89fdd9b10e88954ac2f4248e463 # v4.36.1
with:
sarif_file: codacy.sarif
category: codacy-local
- name: Report Codacy analysis status
if: steps.codacy.outputs.status != '0'
env:
CODACY_STATUS: ${{ steps.codacy.outputs.status }}
run: |
echo "Codacy local analysis reported findings or non-fatal tool results with status ${CODACY_STATUS}; SARIF was generated for review." >&2
exit 1