diff options
Diffstat (limited to '.github/workflows')
-rw-r--r-- | .github/workflows/build.yml | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..d674bae0 --- /dev/null +++ b/.github/workflows/build.yml | |||
@@ -0,0 +1,48 @@ | |||
1 | name: Build | ||
2 | on: | ||
3 | push: | ||
4 | branches: | ||
5 | - main | ||
6 | pull_request: | ||
7 | types: [opened, synchronize, reopened] | ||
8 | jobs: | ||
9 | build: | ||
10 | name: Build | ||
11 | runs-on: ubuntu-latest | ||
12 | steps: | ||
13 | - name: Checkout code | ||
14 | uses: actions/checkout@v2 | ||
15 | with: | ||
16 | fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of SonarCloud analysis | ||
17 | - name: Set up JDK 11 | ||
18 | uses: actions/setup-java@v1 | ||
19 | with: | ||
20 | java-version: 11 | ||
21 | - name: Cache Gradle packages | ||
22 | uses: actions/cache@v2 | ||
23 | with: | ||
24 | path: | | ||
25 | ~/.gradle/caches | ||
26 | **/.gradle/npm | ||
27 | **/.gradle/nodejs | ||
28 | key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | ||
29 | restore-keys: ${{ runner.os }}-gradle | ||
30 | - name: Cache Sonar packages | ||
31 | uses: actions/cache@v2 | ||
32 | with: | ||
33 | path: ~/.sonar/cache | ||
34 | key: ${{ runner.os }}-sonar | ||
35 | restore-keys: ${{ runner.os }}-sonar | ||
36 | - name: Cache npm packages | ||
37 | uses: actions/cache@v2 | ||
38 | with: | ||
39 | path: **/node_modules | ||
40 | key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} | ||
41 | restore-keys: ${{ runner.os }}-npm | ||
42 | - name: Gradle build | ||
43 | run: ./gradlew build --info | ||
44 | - name: Sonar analyze | ||
45 | env: | ||
46 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | ||
47 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
48 | run: ./gradlew sonarqube --info | ||