Merge pull request #121 from lacework/bump-sca-v0.0.74 #483
This file contains 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: Integration test | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
env: | |
LW_ACCOUNT_NAME: ${{ secrets.LW_ACCOUNT_CAT }} | |
LW_API_KEY: ${{ secrets.LW_API_KEY_CAT }} | |
LW_API_SECRET: ${{ secrets.LW_API_SECRET_CAT }} | |
DEBUG: 'true' | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-12 | |
- ubuntu-22.04 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Move action | |
run: | | |
mkdir ../action | |
mv * ../action | |
mv ../action/sample-repo/* . | |
- name: Build sample repo | |
run: | | |
mvn --quiet package | |
dotnet publish --output target/ | |
- name: Run action | |
id: run-action | |
uses: ./../action | |
with: | |
target: push | |
tools: sca,sast | |
classpath: target/test-project-0.1.0.jar | |
sources: ${{ github.workspace }} | |
debug: true | |
- name: Check run succeeded | |
env: | |
RUN_OUTPUT: ${{ steps.run-action.outputs.push-completed }} | |
run: | | |
if [ "$RUN_OUTPUT" == "true" ]; then | |
echo "Test run succeeded!" | |
else | |
echo "::error Test run failed!" | |
exit 1 | |
fi | |
- name: Download results | |
uses: actions/download-artifact@v3 | |
with: | |
name: results-push | |
path: artifact | |
- name: Check results | |
working-directory: artifact | |
run: | | |
export SCA_RESULTS=`jq '.runs | map (.results | length) | add' sca.sarif` | |
expectedScaResults=3 | |
echo "Got $SCA_RESULTS from SCA" | |
if [ "$SCA_RESULTS" != "$expectedScaResults" ]; then | |
echo "::error::Expected to have $expectedScaResults SCA results!" | |
exit 1 | |
fi | |
export SAST_RESULTS=`jq '.runs | map (.results | length) | add' sast.sarif` | |
expectedSastResults=1 | |
echo "Got $SAST_RESULTS from SAST" | |
if [ "$SAST_RESULTS" != "$expectedSastResults" ]; then | |
echo "::error::Expected to have $expectedSastResults SAST results!" | |
exit 1 | |
fi |