build: disabling daemon for gradlew tasks #354
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
# Building workflow for moonlight | |
name: Build & Test & Analyze | |
on: [push, pull_request] | |
jobs: | |
build: | |
name: Java build | |
strategy: | |
matrix: | |
os: [ macos-latest, windows-latest, ubuntu-latest ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
cache: gradle | |
- name: build with Gradle | |
run: ./gradlew --no-daemon build | |
- name: Save build cache | |
uses: actions/cache/save@v3 | |
with: | |
path: ./build | |
key: ${{ github.sha }}-${{ github.workflow_id }}-${{ runner.os }} | |
# Tests running and static code analysis | |
test: | |
name: Run Tests | |
needs: build | |
strategy: | |
matrix: | |
os: [macos-latest, windows-latest, ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
cache: gradle | |
- name: Restore build cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: ./build | |
key: ${{ github.sha }}-${{ github.workflow_id }}-${{ runner.os }} | |
- name: Gradle check | |
run: ./gradlew --no-daemon check | |
- name: Save tests cache | |
uses: actions/cache/save@v3 | |
with: | |
path: ./build | |
key: ${{ github.sha }}-${{ github.workflow_id }}-${{ runner.os }}-tests | |
analyze: | |
name: Static code analysis | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
cache: gradle | |
- name: Restore tests cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: ./build | |
key: ${{ github.sha }}-${{ github.workflow_id }}-${{ runner.os }}-tests | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v3 | |
with: | |
path: ./.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Sonar analyze | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: ./gradlew --no-daemon analyze | |
- name: Codecov update | |
uses: codecov/codecov-action@v3 | |
with: | |
token: "d76dfcb2-9baa-40e4-b07a-4b2647bcf3c4" # should be moved to ${{ secrets.CODECOV_TOKEN }} | |
files: "./build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml" | |
flags: unittests # optional | |
name: codecov-umbrella # optional | |
fail_ci_if_error: true # optional (default = false) | |
verbose: true # optional (default = false) | |