|
| 1 | +name: Plugin Integration Test |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + integration-test: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + steps: |
| 9 | + - uses: actions/checkout@v6 |
| 10 | + |
| 11 | + - name: Set up JDK 17 |
| 12 | + uses: actions/setup-java@v5 |
| 13 | + with: |
| 14 | + java-version: '17' |
| 15 | + distribution: 'adopt' |
| 16 | + cache: 'gradle' |
| 17 | + |
| 18 | + - name: Build Plugin |
| 19 | + run: ./gradlew clean jar |
| 20 | + |
| 21 | + - name: Start SonarQube server |
| 22 | + run: | |
| 23 | + PLUGIN_JAR=$(find build/libs -name "*.jar" ! -name "*-sources.jar" | head -n 1) |
| 24 | + docker run -d --name sonarqube -p 9000:9000 \ |
| 25 | + -e SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true \ |
| 26 | + -v "$(pwd)/$PLUGIN_JAR:/opt/sonarqube/extensions/plugins/sonar-communitybsl-plugin.jar" \ |
| 27 | + sonarqube:25.4.0.105899-community |
| 28 | +
|
| 29 | + - name: Wait & Setup |
| 30 | + run: | |
| 31 | + until curl -s -f http://localhost:9000/api/system/status | grep -q '"status":"UP"'; do sleep 5; done |
| 32 | + curl -u admin:admin -X POST "http://localhost:9000/api/users/change_password?login=admin&previousPassword=admin&password=Sonar_Password_1" |
| 33 | + RESPONSE=$(curl -u admin:Sonar_Password_1 -s -X POST "http://localhost:9000/api/user_tokens/generate?name=gha-token") |
| 34 | + TOKEN=$(echo $RESPONSE | jq -r '.token') |
| 35 | + echo "SONAR_TOKEN=$TOKEN" >> $GITHUB_ENV |
| 36 | + curl -u admin:Sonar_Password_1 -s -X POST "http://localhost:9000/api/projects/create?name=Test&project=test-project" |
| 37 | +
|
| 38 | + - name: Checkout SSL 3.1 |
| 39 | + uses: actions/checkout@v5 |
| 40 | + with: |
| 41 | + repository: '1c-syntax/ssl_3_1' |
| 42 | + path: 'target-project' |
| 43 | + |
| 44 | + - name: Run Sonar Scanner |
| 45 | + run: | |
| 46 | + docker run --rm --network="host" -v "$(pwd)/target-project:/usr/src" \ |
| 47 | + sonarsource/sonar-scanner-cli \ |
| 48 | + -Dsonar.projectKey=test-project \ |
| 49 | + -Dsonar.sources=. \ |
| 50 | + -Dsonar.host.url=http://localhost:9000 \ |
| 51 | + -Dsonar.token=${{ env.SONAR_TOKEN }} \ |
| 52 | + -Dsonar.lang.patterns.bsl=**/*.bsl,**/*.os \ |
| 53 | + -Dsonar.scm.disabled=true |
| 54 | +
|
| 55 | + - name: Server Logs on Failure |
| 56 | + if: failure() |
| 57 | + run: docker logs sonarqube |
0 commit comments