Added code coverage (AST-79401) #645
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: AST Java Wrapper CI | |
| on: [pull_request] | |
| jobs: | |
| integration-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
| lfs: true | |
| - name: Install Git LFS | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install git-lfs | |
| git lfs install | |
| - name: Checkout LFS objects | |
| run: git lfs checkout | |
| - name: Cache local Maven repository | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Set up JDK 11 | |
| uses: actions/[email protected] | |
| with: | |
| distribution: 'temurin' | |
| java-version: '11' | |
| - name: Set Executable Permissions for Binary Files | |
| run: | | |
| chmod +x src/main/resources/cx-linux | |
| chmod +x src/main/resources/cx.exe | |
| chmod +x src/main/resources/cx-mac | |
| - name: Check existence of cx-linux binary | |
| run: | | |
| if [ ! -f "src/main/resources/cx-linux" ]; then | |
| echo "cx-linux binary does not exist"; exit 1; | |
| fi | |
| - name: Check existence of cx.exe binary | |
| run: | | |
| if [ ! -f "src/main/resources/cx.exe" ]; then | |
| echo "cx.exe binary does not exist"; exit 1; | |
| fi | |
| - name: Check existence of cx-mac binary | |
| run: | | |
| if [ ! -f "src/main/resources/cx-mac" ]; then | |
| echo "cx-mac binary does not exist"; exit 1; | |
| fi | |
| - name: Run tests with Maven and Generate Coverage Report | |
| run: | | |
| mvn clean verify -Dgpg.skip | |
| mvn jacoco:report -Dgpg.skip | |
| env: | |
| CX_CLIENT_ID: ${{ secrets.CX_CLIENT_ID }} | |
| CX_CLIENT_SECRET: ${{ secrets.CX_CLIENT_SECRET }} | |
| CX_BASE_URI: ${{ secrets.CX_BASE_URI }} | |
| CX_TENANT: ${{ secrets.CX_TENANT }} | |
| CX_APIKEY: ${{ secrets.CX_APIKEY }} | |
| - name: Display Coverage Summary | |
| run: | | |
| echo "Code Coverage Summary:" | |
| grep -A 10 "Total" target/site/jacoco/jacoco.csv || echo "Coverage report not found." | |
| - name: Upload JaCoCo Coverage Report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: jacoco-report | |
| path: target/site/jacoco/* | |
| - name: Build with Maven | |
| run: mvn -B verify -DskipTests -Dgpg.skip --file pom.xml | |
| - name: Run SpotBugs Analysis | |
| if: ${{ github.actor != 'dependabot[bot]' }} | |
| uses: jwgmeligmeyling/spotbugs-github-action@b8e2c3523acb34c87f14e18cbcd2d87db8c8584e #v1.2 | |
| with: | |
| path: '**/spotbugsXml.xml' |