-
Notifications
You must be signed in to change notification settings - Fork 1
76 lines (76 loc) · 2.39 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Build
on:
workflow_call:
inputs:
version:
required: false
type: string
mutation-testing:
required: false
type: boolean
default: true
sonarqube:
required: false
type: boolean
default: ${{ !github.event.pull_request.head.repo.fork }}
gametests:
required: false
type: boolean
default: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set version number
if: ${{ inputs.version != '' }}
run: |
echo "RELEASE_VERSION=${{ inputs.version }}" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Setup Java
uses: refinedmods/refinedarchitect/.github/actions/setup-java@develop
# https://docs.sonarqube.org/latest/analysis/github-integration/
- name: Cache SonarQube packages
if: ${{ inputs.sonarqube == true }}
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Build and test
run: ./gradlew build codeCoverageReportAggregate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Gametests
if: ${{ inputs.gametests == true }}
run: ./gradlew runGameTestServer
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Analyze
if: ${{ inputs.sonarqube == true }}
run: ./gradlew assemble sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Publish test report
uses: mikepenz/action-junit-report@v4
if: always()
with:
report_paths: '**/build/test-results/test/TEST-*.xml'
- name: Publish Checkstyle report
uses: Juuxel/publish-checkstyle-report@v1
if: ${{ failure() }}
with:
reports: |
**/build/reports/checkstyle/*.xml
- name: Mutation testing
if: ${{ inputs.mutation-testing == true }}
run: ./gradlew pitest
- name: Upload build artifacts
if: ${{ runner.os == 'Linux' }}
uses: actions/upload-artifact@v4
with:
name: Artifacts
path: '**/build/libs/'