Skip to content

fix upload sarif file #575

fix upload sarif file

fix upload sarif file #575

Workflow file for this run

name: plugin it-test
permissions:
contents: write
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Needed for git history
- name: Set up Go
uses: actions/setup-go@v4
- name: Build CLI for all platforms
run: make build-all
- name: Upload CLI binaries
uses: actions/upload-artifact@v4
with:
name: cli-binaries
path: |
cli-v2-linux
cli-v2.exe
cli-v2-macos
test:
needs: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Needed for git history
- name: Download CLI binaries
uses: actions/download-artifact@v4
with:
name: cli-binaries
path: .
- name: Select correct binary
shell: bash
run: |
if [ "${{ matrix.os }}" = "windows-latest" ]; then
# Keep the .exe extension for Windows
echo "Using Windows binary with .exe extension"
elif [ "${{ matrix.os }}" = "macos-latest" ]; then
mv cli-v2-macos cli-v2
else
mv cli-v2-linux cli-v2
fi
- name: Make binary executable
if: matrix.os != 'windows-latest'
run: chmod +x cli-v2
- name: Run init tests on Windows
if: matrix.os == 'windows-latest'
id: run_init_tests_windows
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
& ./integration-tests/run.ps1
if ($LASTEXITCODE -ne 0) {
Write-Error "Integration tests failed with exit code $LASTEXITCODE"
exit $LASTEXITCODE
}
env:
CODACY_API_TOKEN: ${{ secrets.CODACY_API_TOKEN }}
- name: Run init tests on Unix
if: matrix.os != 'windows-latest'
id: run_init_tests_unix
continue-on-error: true
shell: bash
env:
CODACY_API_TOKEN: ${{ secrets.CODACY_API_TOKEN }}
run: |
chmod +x integration-tests/run.sh
./integration-tests/run.sh
- name: Run tool tests
if: matrix.os != 'windows-latest'
id: run_tool_tests_unix
continue-on-error: true
shell: bash
run: |
chmod +x integration-tests/test-tools.sh
./integration-tests/test-tools.sh
- name: Check test results
if: always()
shell: bash
run: |
FAILED=false
# Check init tests on Windows
if [ "${{ matrix.os }}" = "windows-latest" ] && [ "${{ steps.run_init_tests_windows.outcome }}" = "failure" ]; then
echo "❌ Init tests failed on Windows"
FAILED=true
fi
# Check init tests on Unix
if [ "${{ matrix.os }}" != "windows-latest" ] && [ "${{ steps.run_init_tests_unix.outcome }}" = "failure" ]; then
echo "❌ Init tests failed on Unix"
FAILED=true
fi
# Check tool tests on Unix
if [ "${{ matrix.os }}" != "windows-latest" ] && [ "${{ steps.run_tool_tests_unix.outcome }}" = "failure" ]; then
echo "❌ Tool tests failed on Unix"
FAILED=true
fi
if [ "$FAILED" = true ]; then
echo "Job failed because some tests failed. Please check the logs above for details."
exit 1
fi