From ccf882c2aff08144e9143c8d895adb6a5dfadac6 Mon Sep 17 00:00:00 2001 From: gleb7499 <164905074+gleb7499@users.noreply.github.com> Date: Fri, 15 Nov 2024 11:05:44 +0300 Subject: [PATCH] Create build.yml --- .github/workflows/build.yml | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..6b37d46 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,39 @@ +name: SonarQube Cloud +on: + push: + # branches: + # - main + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + name: Build and analyze + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'zulu' # Alternative distribution options are available + - name: Cache SonarQube Cloud packages + uses: actions/cache@v4 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Cache Gradle packages + uses: actions/cache@v4 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle + - name: Make gradlew executable + run: chmod +x ./gradlew + - name: Build and analyze + env: + GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: ./gradlew build sonar --info \ No newline at end of file