Skip to content

Commit

Permalink
Merge pull request #1 from sedmess/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
sedmess authored Jun 9, 2021
2 parents c4797b5 + 54f0652 commit 7f9ac19
Show file tree
Hide file tree
Showing 22 changed files with 1,354 additions and 501 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/build_debug_apk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "build debug apk"

on:
push:
branches: [ "develop" ]
tags: [ "d_*" ]

jobs:
buildDebug:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: prepare_vars
id: prepare
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
echo "::set-output name=tag_short::${GITHUB_REF##*/}"
- name: setup_java
uses: actions/setup-java@v2
with:
distribution: zulu
java-version: 11

- name: assemble
run: ./gradlew assembleDebug

- name: upload
uses: wei/curl@v1.1.1
env:
APP_NAME: f1dashboard
APP_VERSION: ${{ steps.prepare.outputs.tag_short }}-${{ steps.prepare.outputs.sha_short }}
URL: https://nexus.n1ks.it
USERNAME: ${{ secrets.NEXUS_USERNAME }}
PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
with:
args: -u $USERNAME:$PASSWORD "$URL//service/rest/v1/components?repository=debugpub" -F "raw.directory=$APP_NAME" -F "raw.asset1=@app/build/outputs/apk/debug/app-debug.apk" -F "raw.asset1.filename=$APP_NAME-$APP_VERSION.apk"
68 changes: 68 additions & 0 deletions .github/workflows/build_release_apk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: "build release apk"

on:
push:
tags: [ "v*" ]

jobs:
buildRelease:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: prepare_vars
id: prepare
run: |
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
echo "::set-output name=tag_short::${GITHUB_REF##*/}"
- name: setup_java
uses: actions/setup-java@v2
with:
distribution: zulu
java-version: 11

- name: assemble
run: ./gradlew assembleRelease

- name: sign
id: sign
uses: r0adkll/sign-android-release@v1
env:
BUILD_TOOLS_VERSION: 30.0.3
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.SIGNING_KEY_ALIAS }}
keyStorePassword: ${{ secrets.SIGING_PASSWORD }}
keyPassword: ${{ secrets.SIGING_PASSWORD }}

- name: apk_rename
id: rename
env:
APP_NAME: f1dashboard
APP_VERSION: ${{ steps.prepare.outputs.tag_short }}
run: |
mv ${{steps.sign.outputs.signedReleaseFile}} $APP_NAME-$APP_VERSION.apk
echo "::set-output name=file_name::$APP_NAME-$APP_VERSION.apk"
- name: upload_nexus
uses: wei/curl@v1.1.1
env:
APP_NAME: f1dashboard
APP_VERSION: ${{ steps.prepare.outputs.tag_short }}
URL: https://nexus.n1ks.it
USERNAME: ${{ secrets.NEXUS_USERNAME }}
PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
with:
args: -u $USERNAME:$PASSWORD "$URL//service/rest/v1/components?repository=public" -F "raw.directory=$APP_NAME" -F "raw.asset1=@${{steps.rename.outputs.file_name}}" -F "raw.asset1.filename=$APP_NAME-$APP_VERSION.apk"


- name: release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: false
title: ${{ steps.prepare.outputs.tag_short }}
files: ${{steps.rename.outputs.file_name}}
23 changes: 23 additions & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "test build"

on:
push:
branches: [ "master", "develop", "feature/*", "bugfix/*" ]
pull_request:
branches: [ "master", "develop" ]
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: setup_java
uses: actions/setup-java@v2
with:
distribution: zulu
java-version: 11

- name: run_tests
run: ./gradlew test
5 changes: 5 additions & 0 deletions .idea/jarRepositories.xml

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

15 changes: 14 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'org.jetbrains.kotlin.kapt'
}

android {
Expand Down Expand Up @@ -29,6 +30,10 @@ android {
}
kotlinOptions {
jvmTarget = '1.8'
freeCompilerArgs = ['-Xjvm-default=enable']
}
lintOptions {
abortOnError false
}
}

Expand All @@ -42,7 +47,15 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'

implementation "ch.acra:acra-core:$acra_version"
implementation("ch.acra:acra-toast:$acra_version")
implementation("ch.acra:acra-dialog:$acra_version")

compileOnly("com.google.auto.service:auto-service-annotations:1.0")
kapt("com.google.auto.service:auto-service:1.0")

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
21 changes: 16 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,41 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ru.n1ks.f1dashboard">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

<application
android:allowBackup="true"
android:name=".DashboardApplication"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.F1dashboard">

<service
android:name=".ListenerService"
android:enabled="true"
android:exported="false" />

<activity android:name=".MainActivity"
<activity
android:name=".MainActivity"
android:screenOrientation="sensorLandscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity
android:name=".reporting.CrashReportActivity"
android:excludeFromRecents="true"
android:finishOnTaskLaunch="true"
android:launchMode="singleInstance"
android:process=":acra" />

</application>

</manifest>
26 changes: 26 additions & 0 deletions app/src/main/java/ru/n1ks/f1dashboard/DashboardApplication.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package ru.n1ks.f1dashboard

import android.app.Application
import android.content.Context
import org.acra.config.dialog
import org.acra.data.StringFormat
import org.acra.ktx.initAcra
import ru.n1ks.f1dashboard.reporting.CrashReportActivity

class DashboardApplication : Application() {

override fun attachBaseContext(base: Context?) {
super.attachBaseContext(base)

initAcra {
//core configuration:
buildConfigClass = BuildConfig::class.java
reportFormat = StringFormat.JSON

dialog {
//allows other customization
reportDialogClass = CrashReportActivity::class.java
}
}
}
}
1 change: 0 additions & 1 deletion app/src/main/java/ru/n1ks/f1dashboard/ListenerService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import java.util.*
import java.util.concurrent.atomic.AtomicLong


@ExperimentalUnsignedTypes
class ListenerService : Service() {

companion object {
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/ru/n1ks/f1dashboard/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import ru.n1ks.f1dashboard.livedata.LiveData
import ru.n1ks.f1dashboard.livedata.LiveDataFields
import java.util.concurrent.TimeUnit

@ExperimentalUnsignedTypes
class MainActivity : AppCompatActivity() {

companion object {
Expand Down
13 changes: 7 additions & 6 deletions app/src/main/java/ru/n1ks/f1dashboard/helpers.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package ru.n1ks.f1dashboard

@ExperimentalUnsignedTypes
internal val UByteOne = 1.toUByte()
internal object Bytes {

@ExperimentalUnsignedTypes
internal fun UByte.plusOne() = this.plus(UByteOne).toUByte()
const val One = 1.toByte()
const val Two = 2.toByte()
}

@ExperimentalUnsignedTypes
internal fun UByte.minusOne() = this.minus(UByteOne).toUByte()
internal infix fun Byte.plusByte(increment: Byte): Byte = this.plus(increment).toByte()

internal infix fun Byte.minusByte(decrement: Byte): Byte = this.minus(decrement).toByte()
Loading

0 comments on commit 7f9ac19

Please sign in to comment.