Skip to content

Commit

Permalink
updated build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ennioVisco committed Jun 22, 2023
1 parent 1d5dd28 commit 8f8e528
Showing 1 changed file with 41 additions and 13 deletions.
54 changes: 41 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,61 @@
# Building workflow for moonlight
name: Build
name: Build, Test & Analyze
on: [push, pull_request]

jobs:
build:
name: Build & Tests
runs-on: ubuntu-latest

name: Java Build
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- 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@v2
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: gradle
#
# - name: Grant execute permission for gradlew
# run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew build
run: ./gradlew compileJava

# Tests running and static code analysis
- name: Save build cache
uses: actions/cache/save@v3
with:
key: ${{ github.sha }}-${{ github.workflow }}

# 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: Restore build cache
uses: actions/cache/restore@v3
with:
key: ${{ github.sha }}-${{ github.workflow }}
- name: Gradle check
run: ./gradlew check
- name: Save tests cache
uses: actions/cache/save@v3
with:
key: ${{ github.sha }}-${{ github.workflow }}

analyze:
name: Static code analysis
needs: test
runs-on: ubuntu-latest
steps:
- name: Restore tests cache
uses: actions/cache/restore@v3
with:
key: ${{ github.sha }}-${{ github.workflow }}
- name: Codecov update
uses: codecov/codecov-action@v3
with:
Expand All @@ -43,7 +71,7 @@ jobs:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Build and analyze
- name: Sonar analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand Down

0 comments on commit 8f8e528

Please sign in to comment.