wolfcrypt-jni/.github/workflows/infer.yml

76 lines
2.5 KiB
YAML

name: Facebook Infer static analysis
on:
workflow_call:
inputs:
os:
required: true
type: string
jdk_distro:
required: true
type: string
jdk_version:
required: true
type: string
jobs:
build_wolfcryptjni:
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v4
# Infer runs javac directly over the Java sources (see
# scripts/infer.sh), so this job does not need native wolfSSL,
# the JNI library, JUnit, or the test suite. Tests for this
# configuration run in the main CI matrix (linux-zulu-all).
# Cache the extracted Infer release (~100MB download per run).
- name: Restore cached Infer
id: cache-infer
uses: actions/cache/restore@v4
with:
path: infer-linux64-v1.1.0
key: infer-v1.1.0-${{ runner.os }}-${{ runner.arch }}
# Download Facebook Infer, verifying the release tarball checksum
- name: Download Infer
if: steps.cache-infer.outputs.cache-hit != 'true'
run: |
wget https://github.com/facebook/infer/releases/download/v1.1.0/infer-linux64-v1.1.0.tar.xz
echo "5f5d453814422e93e2a70998d8946b09a2721628ff427f67ff0123dea87461d4 infer-linux64-v1.1.0.tar.xz" \
| shasum -a 256 -c -
- name: Extract Infer
if: steps.cache-infer.outputs.cache-hit != 'true'
run: tar -xvf infer-linux64-v1.1.0.tar.xz
- name: Add Infer to PATH
run: echo "$GITHUB_WORKSPACE/infer-linux64-v1.1.0/bin" >> "$GITHUB_PATH"
- name: Test Infer get version
run: infer --version
# Save only after the version sanity check above passes, and
# before the analysis runs, so a failed Infer run (issues found)
# does not prevent the cache from being populated but a broken
# extraction is never cached.
- name: Save Infer to cache
if: steps.cache-infer.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: infer-linux64-v1.1.0
key: infer-v1.1.0-${{ runner.os }}-${{ runner.arch }}
# Setup Java
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: ${{ inputs.jdk_distro }}
java-version: ${{ inputs.jdk_version }}
# Run Facebook Infer
- name: Run Facebook Infer
run: ./scripts/infer.sh
- name: Shows Infer report on failure
if: failure()
run: cat infer-out/report.txt