|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - 'main' |
| 7 | + tags: |
| 8 | + - 'v[0-9]*' |
| 9 | + pull_request: |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Set up JDK 17 |
| 18 | + uses: actions/setup-java@v1 |
| 19 | + with: |
| 20 | + java-version: 17 |
| 21 | + |
| 22 | + - name: Checkout sources |
| 23 | + uses: actions/checkout@v1 |
| 24 | + |
| 25 | + - name: Build with Maven |
| 26 | + run: mvn --batch-mode -P jacoco verify |
| 27 | + |
| 28 | + - name: Run SonarCloud analysis |
| 29 | + run: > |
| 30 | + mvn --batch-mode -DskipTests sonar:sonar |
| 31 | + -Dsonar.host.url=https://sonarcloud.io |
| 32 | + -Dsonar.organization=gridsuite |
| 33 | + -Dsonar.projectKey=gridsuite_spreadsheet-config-server |
| 34 | + env: |
| 35 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 36 | + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
| 37 | + |
| 38 | + - name: Build Docker image - Main |
| 39 | + if: github.ref == 'refs/heads/main' |
| 40 | + run: > |
| 41 | + mvn --batch-mode deploy -DskipTests -Dmaven.install.skip -Dmaven.deploy.skip -Dpowsybl.docker.deploy |
| 42 | + -Djib.httpTimeout=60000 |
| 43 | + -Djib.to.image=docker.io/gridsuite/spreadsheet-config-server |
| 44 | + -Djib.to.auth.username=gridsuiteci |
| 45 | + -Djib.to.auth.password=${{ secrets.DOCKERHUB_TOKEN }} |
| 46 | + |
| 47 | + - name: Build Docker image - Tag |
| 48 | + if: startsWith(github.ref, 'refs/tags/') |
| 49 | + run: > |
| 50 | + mvn --batch-mode deploy -DskipTests -Dmaven.install.skip -Dmaven.deploy.skip -Dpowsybl.docker.deploy |
| 51 | + -Djib.httpTimeout=60000 |
| 52 | + -Djib.to.image=docker.io/gridsuite/spreadsheet-config-server:${GITHUB_REF_NAME#v} |
| 53 | + -Djib.to.auth.username=gridsuiteci |
| 54 | + -Djib.to.auth.password=${{ secrets.DOCKERHUB_TOKEN }} |
| 55 | + |
| 56 | + - name: Broadcast update event |
| 57 | + if: github.ref == 'refs/heads/main' |
| 58 | + uses: gridsuite/broadcast-event@main |
| 59 | + with: |
| 60 | + token: ${{ secrets.REPO_ACCESS_TOKEN }} |
| 61 | + event-type: spreadsheet_config_server_updated |
0 commit comments