Skip to content

Add common tests (AST-80969) #583

Add common tests (AST-80969)

Add common tests (AST-80969) #583

Workflow file for this run

name: AST TeamCity plugin CI
on: [pull_request]
jobs:
integration-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
lfs: true # Ensure LFS files are checked out
- name: Cache local Maven repository
uses: actions/[email protected]
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'adopt'
server-id: github
settings-path: ${{ github.workspace }}
- name: Install xmllint
run: sudo apt-get install -y libxml2-utils
- name: Verify with Maven
run: mvn -B verify
- name: Run SpotBugs Analysis
if: ${{ github.actor != 'dependabot[bot]' }}
uses: jwgmeligmeyling/spotbugs-github-action@b8e2c3523acb34c87f14e18cbcd2d87db8c8584e #master (currently 1.2)
with:
path: '**/spotbugsXml.xml'
- name: Package with Maven
run: mvn -B package --file pom.xml -s $GITHUB_WORKSPACE/settings.xml
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Run tests with coverage
run: mvn test jacoco:report
- name: Print total coverage percentage
run: |
COVERED_LINES=$(xmllint --xpath "string(//report/counter[@type='LINE']/@covered)" target/site/jacoco/jacoco.xml)
MISSED_LINES=$(xmllint --xpath "string(//report/counter[@type='LINE']/@missed)" target/site/jacoco/jacoco.xml)
TOTAL_LINES=$((COVERED_LINES + MISSED_LINES))
COVERAGE_PERCENTAGE=$(echo "scale=2; $COVERED_LINES / $TOTAL_LINES * 100" | bc)
echo "Total coverage percentage: $COVERAGE_PERCENTAGE%"
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: target/site/jacoco