Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM eclipse-temurin:17-jdk-jammy

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не будет ли контейнер больше, чем при openjdk?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

пробовали его использовать? Мне кажется что будет ругаться на недостачу пакетов


ENV ANDROID_SDK_ROOT /opt/android-sdk
ENV PATH $PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin:$ANDROID_SDK_ROOT/platform-tools

RUN apt-get update && \
apt-get install -y wget unzip git && \
rm -rf /var/lib/apt/lists/*

RUN wget -O cmdline-tools.zip "https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip" && \
mkdir -p $ANDROID_SDK_ROOT/cmdline-tools && \
unzip -q cmdline-tools.zip -d $ANDROID_SDK_ROOT/cmdline-tools && \
mv $ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools $ANDROID_SDK_ROOT/cmdline-tools/latest && \
rm cmdline-tools.zip

RUN yes | sdkmanager --licenses && \
sdkmanager "platforms;android-35" "build-tools;35.0.0" "platform-tools"

RUN curl -Ls "https://sh.jbang.dev" | bash -s - app install --fresh --force jbang

WORKDIR /app
69 changes: 69 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
pipeline {
agent {
dockerfile true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

нужно указать название image и параметры

}
parameters {
booleanParam(name: 'RUN_PROFILER', defaultValue: false, description: 'Запустить gradle-profiler для анализа производительности сборки?')
}

stages {
stage('Checkout') {
steps {
checkout scm
}
}

stage('Grant execution permission') {
steps {
sh 'chmod +x gradlew'
}
}

stage('Build') {
steps {
script {
if (env.BRANCH_NAME == 'master') {
echo "Building for master branch..."
sh './gradlew assembleRelease'
} else {
echo "Building for branch ${env.BRANCH_NAME}..."
sh './gradlew assembleDebug'
}
}
}
}

stage('Unit Tests') {
steps {
sh './gradlew test'
}
}

stage('Static Analysis') {
steps {
sh './gradlew lint'
}
}

stage('Profiling') {
when {
// Запускать только если параметр RUN_PROFILER установлен в true
expression { params.RUN_PROFILER }
}
steps {
script {
echo "Starting Gradle profiler..."
sh "jbang dev.gradle.profiler.tool.Main --benchmark --project-dir . --scenario-file profiler.scenarios"
archiveArtifacts artifacts: 'profile-out/', followSymlinks: false
}
}
}
}

post {
always {
echo 'Build finished.'
cleanWs()
}
}
}
8 changes: 8 additions & 0 deletions profiler.scenarios
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
clean-build {
tasks = ["assembleDebug"]
cleanup-tasks = ["clean"]
}

incremental-build-no-changes {
tasks = ["assembleDebug"]
}