Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEVOPS-837: Jenkins 2 Actions #5021

Open
wants to merge 37 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
8464535
Update build
sebastiangollob Oct 25, 2024
2970ebe
test
sebastiangollob Oct 25, 2024
d08caaf
Update build.yml
sebastiangollob Oct 25, 2024
662daa8
Refactor emulator options in build.yml
sebastiangollob Oct 25, 2024
2f30973
Refactor emulator options and update build.yml
sebastiangollob Oct 25, 2024
5b24755
test
sebastiangollob Oct 25, 2024
c05248e
test
sebastiangollob Oct 25, 2024
49e4648
try
sebastiangollob Oct 25, 2024
f4877ed
Merge branch 'develop' into DEVOPS-837
sebastiangollob Nov 4, 2024
2ee32f0
test api 34
sebastiangollob Nov 4, 2024
c1c0ecd
Update to JDK 21
sebastiangollob Nov 18, 2024
16d18a1
Refactor GitHub Actions workflow
sebastiangollob Nov 19, 2024
65a56e7
Update dependencies
sebastiangollob Nov 19, 2024
9cf66df
Fix errors
sebastiangollob Nov 19, 2024
8582d48
Test
sebastiangollob Nov 19, 2024
aa958a7
Test Win
sebastiangollob Nov 20, 2024
b8dcb8c
Update build.yml
sebastiangollob Nov 20, 2024
8fe0df5
Update build.yml
sebastiangollob Nov 20, 2024
ce0e0f0
Update pipeline
sebastiangollob Nov 26, 2024
233ca70
Merge branches 'DEVOPS-837' and 'DEVOPS-837' of github.com:Catrobat/C…
sebastiangollob Nov 26, 2024
67914d9
Fix syntax error in build.yml for unit test command
sebastiangollob Nov 26, 2024
99a0d27
Test
sebastiangollob Nov 26, 2024
4d6e484
Refactor build.yml to enhance Gradle setup and improve static analysi…
sebastiangollob Nov 26, 2024
f86a316
Update build.yml and code_quality_tasks.gradle for improved static an…
sebastiangollob Nov 26, 2024
6014ef9
Update build.yml and code_quality_tasks.gradle to change report forma…
sebastiangollob Nov 26, 2024
d7f84ff
Enhance build.yml and code_quality_tasks.gradle to upload additional …
sebastiangollob Nov 26, 2024
204d00f
Test Fix 1
sebastiangollob Nov 26, 2024
a1d99c9
test codeql
sebastiangollob Nov 26, 2024
b8972ef
Add permissions for security events and package access in build.yml
sebastiangollob Nov 26, 2024
898b974
Change CodeQL build mode to manual and add Dev Build step in build.yml
sebastiangollob Nov 26, 2024
ef2cd9b
SARIF hack
sebastiangollob Nov 26, 2024
269c935
Refactor checkStyleSarifHack task to simplify URI updates in SARIF file
sebastiangollob Nov 26, 2024
30f6e5f
Update pipeline to use matrix
sebastiangollob Nov 26, 2024
644b560
Fix
sebastiangollob Nov 26, 2024
24a4705
Fixup
sebastiangollob Nov 26, 2024
21ebef5
Update Unit Tests
sebastiangollob Nov 26, 2024
455ca92
Add Unit Reports
sebastiangollob Nov 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
177 changes: 177 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
name: Catroid Pipeline

on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
# 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

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 21
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 21

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Build APK
run: ./gradlew ${{ env.WEB_TEST_URL }} -Pindependent='#${{ github.run_number }} ${{ github.ref_name }}' assembleCatroidDebug ${{ env.ALL_FLAVOURS_PARAMETERS }}
# TODO: Check where to upload the APKs as GitHub Storage is an issue
#
# - name: Rename APKs
# run: |
# for file in $(find . -name "*.apk"); do
# mv "$file" "$(dirname "$file")/${{ github.ref_name }}-${{ github.run_number }}-$(basename "$file")"
# done
#
# - name: Archive APKs
# uses: actions/upload-artifact@v4
# with:
# name: apk-artifacts
# path: "**/*.apk"

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 21
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 21

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Unit Tests
run: ./gradlew -PenableCoverage jacocoTestCatroidDebugUnitTestReport --full-stacktrace
continue-on-error: true

- name: Upload Unit Test Reports
uses: actions/upload-artifact@v4
with:
name: unit-test-reports
path: |
catroid/build/reports/jacoco/jacocoTestCatroidDebugUnitTestReport.xml
catroid/build/reports/tests/testDebugUnitTest

code-analysis:
name: Code analysis
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' || '' }}
permissions:
security-events: write
packages: read

steps:
- uses: actions/checkout@v4

- name: Setup JDK 21
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 21

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

#######################################################################################
- name: PMD
run: ./gradlew pmd

- name: Upload Static Analysis Reports
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: pmd-report
path: |
catroid/build/reports/pmd.html
#######################################################################################
- name: Checkstyle
run: ./gradlew checkstyle

- name: Upload Checkstyle Report
uses: github/codeql-action/upload-sarif@v3
if: success() || failure()
with:
sarif_file: catroid/build/reports/checkstyle.sarif
category: "Checkstyle"
#######################################################################################
- name: Detekt
run: ./gradlew detekt

- name: Upload Detekt Report as HTML
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: detekt-report
path: |
catroid/build/reports/detekt.html

- name: Upload Detekt Report
uses: github/codeql-action/upload-sarif@v3
if: success() || failure()
with:
sarif_file: catroid/build/reports/detekt.sarif
category: "Detekt"
#######################################################################################
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: java-kotlin
build-mode: manual

- name: Dev Build
run: ./gradlew assembleCatroidDebug

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:$java-kotlin"
#######################################################################################
- name: Lint
run: ./gradlew lintCatroidDebug

- name: Upload Lint Report
uses: github/codeql-action/upload-sarif@v3
if: success() || failure()
with:
sarif_file: catroid/build/reports/lint/lintCatroidDebug.xml
category: "Lint"
#######################################################################################
1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.6.21'
ext.kotlin_version = '2.0.21'
ext.koin_version = '2.1.6'
ext.lifecycle_version = '2.2.0'
ext.jacoco_core_version = '0.8.7'

repositories {
google()
mavenCentral()
Expand All @@ -37,7 +38,7 @@ buildscript {
dependencies {
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'com.android.tools.build:gradle:8.5.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jacoco:org.jacoco.core:$jacoco_core_version"
classpath 'com.huawei.agconnect:agcp:1.4.2.300'
Expand Down
49 changes: 24 additions & 25 deletions catroid/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import com.android.build.api.dsl.ManagedVirtualDevice
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

Check warning

Code scanning / Checkstyle

Line does not match expected header line of '^\W*$'. Warning

Line does not match expected header line of '^\W*$'.

/*
* Catroid: An on-device visual programming system for Android devices
Expand Down Expand Up @@ -26,15 +26,16 @@
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.google.gms:google-services:4.3.10'
}
}

plugins {
id "io.gitlab.arturbosch.detekt" version "1.23.0"
id "io.gitlab.arturbosch.detekt" version "1.23.7"
id 'com.google.devtools.ksp' version '2.0.21-1.0.25' apply true
id 'checkstyle'
}

Expand All @@ -51,18 +52,17 @@

projectVersion = "0.9"
gdxVersion = "1.9.10"
mockitoVersion = "3.12.4"
espressoVersion = "3.1.0"
playServicesVersion = '17.0.1'
cameraXVersion = "1.0.0-beta07"
room_version = "2.3.0"
coroutines_version = "1.3.2"
work_manager_version = '2.7.1'
mockitoVersion = '5.14.2'
espressoVersion = '3.6.1'
playServicesVersion = '18.1.1'
cameraXVersion = '1.4.0'
room_version = "2.6.1"
coroutines_version = '1.9.0'
work_manager_version = '2.9.1'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

apply from: 'gradle/code_quality_tasks.gradle'
apply from: 'gradle/release_crowdin_tasks.gradle'
Expand Down Expand Up @@ -107,7 +107,6 @@

android {
compileSdk 34
buildToolsVersion = "33.0.2"

namespace 'org.catrobat.catroid'

Expand Down Expand Up @@ -239,7 +238,6 @@
buildConfigField "boolean", "FEATURE_CATBLOCKS_ENABLED", "true"
buildConfigField "boolean", "FEATURE_CATBLOCKS_DEBUGABLE", "true"
buildConfigField "boolean", "FEATURE_AI_ASSIST_ENABLED", "false"
testCoverageEnabled = rootProject.hasProperty('enableCoverage')
signingConfig signingConfigs.debug
}

Expand All @@ -259,9 +257,10 @@

flavorDimensions = ["default"]
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_21
targetCompatibility JavaVersion.VERSION_21
}

androidResources {
noCompress 'lite'
}
Expand All @@ -277,7 +276,6 @@
xmlReport true
}


productFlavors {
catroid {
isDefault.set(true)
Expand Down Expand Up @@ -319,8 +317,8 @@
}
}

applicationVariants.all { variant ->
variant.outputs.all { output ->
applicationVariants.configureEach { variant ->
variant.outputs.configureEach { output ->

if(variant.buildType.name == "signedRelease")
{
Expand All @@ -341,7 +339,7 @@
}
}
}
productFlavors.all { flavor ->
productFlavors.configureEach { flavor ->
copyGoogleServicesFile(flavor.name, defaultConfig.applicationId + (flavor.applicationIdSuffix ?: ""))
}
}
Expand Down Expand Up @@ -370,7 +368,7 @@
implementation "androidx.work:work-runtime:$work_manager_version"

// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
androidTestImplementation project(path: ':catroid')
androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version"
Expand Down Expand Up @@ -414,7 +412,8 @@

// Room
implementation("androidx.room:room-runtime:$room_version")
kapt("androidx.room:room-compiler:$room_version")
ksp("androidx.room:room-compiler:$room_version")

// Kotlin Extensions and Coroutines support for Room
implementation("androidx.room:room-ktx:$room_version")

Expand Down Expand Up @@ -536,7 +535,7 @@
connectedCatroidDebugAndroidTest.ignoreFailures = true
}

task copyAndroidNatives {
tasks.register('copyAndroidNatives') {
doFirst {
file("src/main/jniLibs/armeabi-v7a/").mkdirs()
file("src/main/jniLibs/arm64-v8a/").mkdirs()
Expand All @@ -560,15 +559,15 @@
}
}

tasks.whenTaskAdded { packageTask ->
tasks.configureEach { packageTask ->
if (packageTask.name.contains("package")) {
packageTask.dependsOn 'copyAndroidNatives'
}
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
jvmTarget = "11"
jvmTarget = JavaVersion.VERSION_21
}
}

Expand Down
Loading