Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
114 changes: 96 additions & 18 deletions .github/workflows/android_ci.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,98 @@
name: android_ci
name: CI

on:
push:
branches: [ master ]
branches:
- master
pull_request:
branches: [ master ]
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true


jobs:
lint:
android-build:
if: contains(github.event.pull_request.labels.*.name, 'android')
runs-on: ubuntu-latest
container: mobiledevops/android-sdk-image
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4

- name: set up Java
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'zulu'
distribution: 'temurin'
java-version: 17

- name: Build debug APK
run: gradle

- name: Grant execute permissions for gradlew
run: chmod +x ./gradlew


- name: Build debug APK
run: ./gradlew assembleDebug

- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: app
path: app/build/outputs/apk/debug/app-debug.apk

docker-job:
if: contains(github.event.pull_request.labels.*.name, 'docker')
runs-on: ubuntu-latest
container:
image: maven:3.8.4-openjdk-17
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Print Java version
run: java --version

- name: Print Maven version
run: mvn --version

- name: Print Gradle version
run: gradle --version

# - name: Install build tools
# run: |
# apt-get update -y
# apt-get install wget
#
# - name: Testing project
# run: ./gradlew dependencies


lint:
if: contains(github.event.pull_request.labels.*.name, 'curl-fetch')
runs-on: ubuntu-latest
container:
image: maven:3.8.4-openjdk-17
steps:
- uses: actions/checkout@v4

- name: Get google java format
run: |
wget https://github.com/google/google-java-format/releases/download/v1.23.0/google-java-format-1.23.0.jar
curl -O https://github.com/google/google-java-format/releases/download/v1.23.0/google-java-format-1.23.0.jar -L
ls -l
mv google-java-format-1.23.0.jar google-java-format.jar

- name: Validate the checksum
run: |
checksum=$(sha256sum google-java-format.jar)
echo "$checksum"
java -jar google-java-format.jar --replace $(find src/ -name "*.java")

build:

if: contains(github.event.pull_request.labels.*.name, 'setup-java')
runs-on: ubuntu-latest

steps:
Expand All @@ -36,25 +104,33 @@ jobs:
distribution: 'temurin'
java-version: 17

- uses: gradle/actions/setup-gradle
with:
gradle-version: '7.6.3'
# - uses: gradle/actions/setup-gradle
# with:
# gradle-version: '7.6.3'


# - name: Set up Gradle
# run: echo "GRADLE_HOME=$(which gradle)" >> "$GITHUB_ENV"

- name: Print gradle version
run: gradle --version

- name: Building project
run: gradle build --no-daemon
# - name: Building project
# run: gradle build --no-daemon
#
# - name: Testing project
# run: ./gradlew dependencies

- name: Testing project
run: gradle test

- name: Google Java Format
uses: axel-op/googlejavaformat-action@v4
uses: axel-op/googlejavaformat-action@v3
with:
args: "--set-exit-if-changed"

build-with-nix-shell:
if: contains(github.event.pull_request.labels.*.name, 'nix')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -67,5 +143,7 @@ jobs:
- name: Activate Nix flake
run: nix develop .

- name: Build the project
run: echo "TODO"
- name: Fetch the dependencies
run: |
nix develop . -c gradle
# nix develop . -c ./gradlew dependencies
108 changes: 54 additions & 54 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
apply plugin: 'com.android.application'
// apply plugin: 'com.android.application'

android {
compileSdkVersion 33
buildToolsVersion "33.0.3"
defaultConfig {
applicationId "net.louib.nwipe_android"
minSdkVersion 23
targetSdkVersion 33
versionCode 1
versionName "0.1"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
/*
debug {
minifyEnabled false
applicationIdSuffix ".debug"
}
*/
}
lintOptions {
// Turns off checks for the issue IDs you specify.
// disable 'TypographyFractions','TypographyQuotes'
// Turns on checks for the issue IDs you specify. These checks are in
// addition to the default lint checks.
// enable 'RtlHardcoded', 'RtlCompat', 'RtlEnabled'
// If set to true, turns off analysis progress reporting by lint.
quiet false
// if set to true (default), stops the build if errors are found.
abortOnError true
// if true, only report errors.
ignoreWarnings false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// android {
// compileSdkVersion 33
// buildToolsVersion "33.0.3"
// defaultConfig {
// applicationId "net.louib.nwipe_android"
// minSdkVersion 23
// targetSdkVersion 33
// versionCode 1
// versionName "0.1"
// multiDexEnabled true
// testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// }
// buildTypes {
// release {
// minifyEnabled true
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
// }
// /*
// debug {
// minifyEnabled false
// applicationIdSuffix ".debug"
// }
// */
// }
// lintOptions {
// // Turns off checks for the issue IDs you specify.
// // disable 'TypographyFractions','TypographyQuotes'
// // Turns on checks for the issue IDs you specify. These checks are in
// // addition to the default lint checks.
// // enable 'RtlHardcoded', 'RtlCompat', 'RtlEnabled'
// // If set to true, turns off analysis progress reporting by lint.
// quiet false
// // if set to true (default), stops the build if errors are found.
// abortOnError true
// // if true, only report errors.
// ignoreWarnings false
// }
// compileOptions {
// sourceCompatibility JavaVersion.VERSION_1_8
// targetCompatibility JavaVersion.VERSION_1_8
// }

}
// }


dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.7.22'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test:rules:1.2.0'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'org.mockito:mockito-android:2.7.22'
// implementation fileTree(dir: 'libs', include: ['*.jar'])
// implementation 'androidx.appcompat:appcompat:1.1.0'
// implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
// implementation 'com.google.android.material:material:1.0.0'
// testImplementation 'junit:junit:4.12'
// testImplementation 'org.mockito:mockito-core:2.7.22'
// androidTestImplementation 'androidx.test.ext:junit:1.1.1'
// androidTestImplementation 'androidx.test:rules:1.2.0'
// androidTestImplementation 'androidx.test:runner:1.2.0'
// androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
// androidTestImplementation 'org.mockito:mockito-android:2.7.22'
}
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ buildscript {
url = "https://repo1.maven.org/maven2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:7.6.3'
// dependencies {
// classpath 'com.android.tools.build:gradle:6.9.4'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
// }
}

allprojects {
Expand Down
18 changes: 9 additions & 9 deletions flake.lock

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

2 changes: 2 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
pkgs.openjdk8
pkgs.androidsdk_9_0
pkgs.android-studio
pkgs.google-java-format
pkgs.podman
];
androidPackage = (
android-nixpkgs.sdk.${system} (
Expand Down