Skip to content

added running os to build cache key #305

added running os to build cache key

added running os to build cache key #305

Workflow file for this run

# 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
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: Build with Gradle
run: ./gradlew compileJava
- name: Save build cache
uses: actions/cache/save@v3
with:
path: .
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: Restore build cache
uses: actions/cache/restore@v3
with:
path: .
key: ${{ github.sha }}-${{ github.workflow_id }}-${{ runner.os }}
- name: Gradle check
run: ./gradlew check
- name: Save tests cache
uses: actions/cache/save@v3
with:
path: .
key: ${{ github.sha }}-${{ github.workflow_id }}-${{ runner.os }}
analyze:
name: Static code analysis
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Restore tests cache
uses: actions/cache/restore@v3
with:
path: .
key: ${{ github.sha }}-${{ github.workflow_id }}-${{ runner.os }}
- 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)
- 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 analyze