-
Notifications
You must be signed in to change notification settings - Fork 835
140 lines (118 loc) · 4.58 KB
/
Copy pathmain.yml
File metadata and controls
140 lines (118 loc) · 4.58 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
name: Catroid Main Workflow
on:
push:
fork:
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:
build:
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:
name: Unit Tests
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: Run Unit Tests
run: ./gradlew -PenableCoverage jacocoTestCatroidDebugUnitTestReport --full-stacktrace
- name: Test Report
uses: dorny/test-reporter@v1
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:
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