Fenrir fixes for AES-GCM/GMAC and RSA-PSS JNI wrappers #168
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: SpotBugs Static Analysis | |
| on: | |
| pull_request: | |
| branches: [ '*' ] | |
| paths: | |
| - '**/*.java' | |
| - 'build.xml' | |
| - 'spotbugs-exclude.xml' | |
| # Cancel superseded in-progress runs for the same PR. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| spotbugs: | |
| runs-on: ubuntu-latest | |
| name: Run SpotBugs | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Java 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| # Ant is preinstalled on the ubuntu-latest runner image, so no | |
| # apt-get install is needed here. | |
| - name: Setup JUnit | |
| uses: ./.github/actions/setup-junit | |
| - name: Download and set up SpotBugs | |
| run: | | |
| SPOTBUGS_VERSION="4.9.3" | |
| wget -q "https://github.com/spotbugs/spotbugs/releases/download/${SPOTBUGS_VERSION}/spotbugs-${SPOTBUGS_VERSION}.tgz" | |
| tar xzf "spotbugs-${SPOTBUGS_VERSION}.tgz" | |
| echo "SPOTBUGS_HOME=${GITHUB_WORKSPACE}/spotbugs-${SPOTBUGS_VERSION}" >> $GITHUB_ENV | |
| - name: Run SpotBugs | |
| run: | | |
| ant spotbugs | |
| - name: Check for SpotBugs warnings | |
| if: always() | |
| run: | | |
| REPORT="build/reports/spotbugs.html" | |
| if [ ! -f "$REPORT" ]; then | |
| echo "SpotBugs report not found" | |
| exit 1 | |
| fi | |
| # Extract warning count from report | |
| COUNT=$(python3 -c " | |
| import re | |
| with open('$REPORT', 'r') as f: | |
| content = f.read() | |
| m = re.search(r'<b>Total Warnings</b>.*?<b>(\d+)</b>', content, re.DOTALL) | |
| print(m.group(1) if m else '0') | |
| ") | |
| if [ "$COUNT" -eq 0 ]; then | |
| echo "==================================" | |
| echo "SpotBugs: 0 warnings found" | |
| echo "==================================" | |
| exit 0 | |
| fi | |
| echo "==================================" | |
| echo "SpotBugs: $COUNT warning(s) found" | |
| echo "==================================" | |
| echo "" | |
| # Print each warning | |
| python3 -c " | |
| import re | |
| with open('$REPORT', 'r') as f: | |
| content = f.read() | |
| pattern = r'priority-(\d)\">([\w]+)</span>.*?</td>\s*<td>(.*?)</td>.*?Bug type (\w+).*?</p>' | |
| warnings = re.findall(pattern, content, re.DOTALL) | |
| for pri, code, desc, full_type in warnings: | |
| d = re.sub(r'<[^>]+>', '', desc).strip() | |
| loc = '' | |
| m2 = re.search(r'At ([\w.]+:\[line \d+\])', d) | |
| print(f'[P{pri}] {full_type}') | |
| print(f' {d[:200]}') | |
| print() | |
| " | |
| exit 1 |