-
Notifications
You must be signed in to change notification settings - Fork 816
191 lines (163 loc) · 6.12 KB
/
main.yml
File metadata and controls
191 lines (163 loc) · 6.12 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: Catroid Main Workflow
on:
push:
branches:
- "main"
- "develop"
pull_request:
schedule:
- cron: "0 0 * * *" # Run daily at midnight
workflow_dispatch:
inputs:
WEB_TEST_URL:
description: "When set, all the archived APKs will point to this Catrobat web server, useful for testing web changes. E.g https://web-test.catrob.at"
required: false
type: string
default: ""
BUILD_ALL_FLAVOURS:
description: "When selected all flavours are built and archived as artifacts that can be installed alongside other versions of the same APKs"
required: false
type: boolean
default: false
env:
# Java version for the JDK setup
JAVA_VERSION: 21
jobs:
repo-check:
if: ${{ github.repository == 'Catrobat/Catroid' }}
# set --env GITHUB_REPOSITORY=Catrobat/Catroid for local runs in act since env.ACT is not accessible here
name: Repo Check
runs-on: ubuntu-latest
steps:
- run: echo "This workflow was triggered in the ${{ github.repository }} repo!"
build:
needs: repo-check
name: Build APK
runs-on: ubuntu-latest
env:
WEB_TEST_URL: ${{ inputs.WEB_TEST_URL != '' && format('-PwebTestUrl=''{0}''', inputs.WEB_TEST_URL) || '' }}
ALL_FLAVOURS_PARAMETERS: ${{ inputs.BUILD_ALL_FLAVOURS && 'assembleCreateAtSchoolDebug assembleLunaAndCatDebug assemblePhiroDebug assembleEmbroideryDesignerDebug assemblePocketCodeBetaDebug assembleMindstormsDebug' || '' }}
steps:
- uses: actions/checkout@v4
- name: Setup JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: ${{ env.JAVA_VERSION }}
cache: gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Set up Android SDK
if: ${{ env.ACT }} # Only run on local act setups, as GitHub Actions provides the Android SDK on Ubuntu
uses: android-actions/setup-android@v2
- name: Build APK
run: ./gradlew ${{ env.WEB_TEST_URL }} -Pindependent='#${{ github.run_number }} ${{ github.ref_name }}' assembleCatroidDebug ${{ env.ALL_FLAVOURS_PARAMETERS }}
unit-tests:
needs: repo-check
name: Unit Tests
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
repository-projects: write
checks: write
env:
WEB_TEST_URL: ${{ inputs.WEB_TEST_URL != '' && format('-PwebTestUrl=''{0}''', inputs.WEB_TEST_URL) || '' }}
ALL_FLAVOURS_PARAMETERS: ${{ inputs.BUILD_ALL_FLAVOURS && 'assembleCreateAtSchoolDebug assembleLunaAndCatDebug assemblePhiroDebug assembleEmbroideryDesignerDebug assemblePocketCodeBetaDebug assembleMindstormsDebug' || '' }}
steps:
- uses: actions/checkout@v4
- name: Setup JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: ${{ env.JAVA_VERSION }}
cache: gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Run Unit Tests
run: ./gradlew -PenableCoverage jacocoTestCatroidDebugUnitTestReport --full-stacktrace
- name: Upload Unit Test Reports XML
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: Unit Tests
path: catroid/build/test-results/**/*TEST*.xml
reporter: java-junit
- name: Upload Unit Test Reports
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: unit-test-report
path: |
catroid/build/reports/tests/testCatroidDebugUnitTest
code-analysis:
needs: repo-check
name: Code Analysis
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
tool:
- { name: "pmd", sarif: false }
- { name: "checkstyle", sarif: true }
- { name: "detekt", sarif: true }
- { name: "lint", sarif: true }
steps:
- uses: actions/checkout@v4
- name: Setup JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: ${{ env.JAVA_VERSION }}
cache: gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Run ${{ matrix.tool.name }} Analysis
run: |
case ${{ matrix.tool.name }} in
"pmd") ./gradlew pmd ;;
"checkstyle") ./gradlew checkstyle ;;
"detekt") ./gradlew detekt ;;
"lint") ./gradlew lintCatroidDebug ;;
esac
- name: Upload ${{ matrix.tool.name }} SARIF Report
uses: github/codeql-action/upload-sarif@v3
if: ${{ matrix.tool.sarif && (success() || failure()) }}
with:
sarif_file: catroid/build/reports/${{ matrix.tool.name }}.sarif
category: ${{ matrix.tool.name }}
- name: Upload ${{ matrix.tool.name }} HTML Report
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: ${{ matrix.tool.name }}-report
path: |
catroid/build/reports/html/${{ matrix.tool.name }}.html
instrumented-unit-tests:
needs: repo-check
name: Instrumented Unit Tests
uses: ./.github/workflows/emulated_tests.yml
with:
gradle-test-config: org.catrobat.catroid.testsuites.LocalHeadlessTestSuite
calling-job: instrumented-unit-tests
testrunner-tests:
needs: repo-check
name: Testrunner Tests
uses: ./.github/workflows/emulated_tests.yml
with:
gradle-test-config: org.catrobat.catroid.catrobattestrunner.CatrobatTestRunner
calling-job: testrunner-tests
quarantined-tests:
needs: repo-check
name: Quarantined Tests
uses: ./.github/workflows/emulated_tests.yml
with:
gradle-test-config: org.catrobat.catroid.testsuites.UiEspressoQuarantineTestSuite
calling-job: quarantined-tests
rtl-tests:
needs: repo-check
name: RTL Tests
uses: ./.github/workflows/emulated_tests.yml
with:
gradle-test-config: org.catrobat.catroid.testsuites.UiEspressoRtlTestSuite
calling-job: rtl-tests