Skip to content

Add permissions in CI to upload artifact #643

Add permissions in CI to upload artifact

Add permissions in CI to upload artifact #643

Workflow file for this run

name: CI-java
on:
push:
branches:
- 'main'
- 'release-v**'
- 'full-sonar-analysis-**'
pull_request:
release:
types: [published]
permissions: {}
# Cancel previous workflows if they are the same workflow on same ref (branch/tags)
# with the same event (push/pull_request) even they are in progress.
# This setting will help reduce the number of duplicated workflows.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
build:
name: Build Java on OS ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Set up JDK 17
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
distribution: 'temurin'
java-version: '17'
- name: Checkout sources
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Build with Maven (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: ./mvnw --batch-mode -Pjacoco install
- name: Build with Maven (Windows)
if: matrix.os == 'windows-latest'
run: mvnw.cmd --batch-mode install
shell: cmd
- name: Build with Maven (MacOS)
if: matrix.os == 'macos-latest'
run: ./mvnw --batch-mode install
- name: Run SonarCloud analysis
if: matrix.os == 'ubuntu-latest'
run: >
./mvnw --batch-mode -DskipTests sonar:sonar
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.organization=powsybl-ci-github
-Dsonar.projectKey=com.powsybl:powsybl-metrix
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}