Add common tests (AST-80969) #592
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: AST TeamCity plugin CI | |
on: [pull_request] | |
jobs: | |
integration-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4.1.7 | |
with: | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
lfs: true # Ensure LFS files are checked out | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'adopt' | |
server-id: github | |
settings-path: ${{ github.workspace }} | |
- 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: 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: Upload coverage report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report | |
path: coverage-report/target/site/jacoco-aggregate/index.html | |
- name: Generate JaCoCo Badge | |
uses: cicirello/jacoco-badge-generator@f33476a5a3fd5a4f77cb5eef2ebe728c1dd5b921 #v2.11.0 | |
with: | |
jacoco-csv-file: coverage-report/target/site/jacoco-aggregate/jacoco.csv | |
# - name: Check Coverage Threshold | |
# run: | | |
# COVERAGE=$(awk -F, 'NR>1 {lines_covered+=$9; lines_total+=$8+$9} END {printf "%.2f", (lines_covered/lines_total)*100}' coverage-report/target/site/jacoco-aggregate/jacoco.csv) | |
# echo "Total coverage: $COVERAGE%" | |
# if (( $(echo "$COVERAGE < 10" | bc -l) )); then | |
# echo "Coverage is below 70%" | |
# exit 1 | |
# fi | |
# - 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%" |