-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
333 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# | ||
# Copyright 2021 Paul Rybitskyi, paul.rybitskyi.work@gmail.com | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
org.gradle.daemon=false | ||
org.gradle.parallel=true | ||
org.gradle.jvmargs=-Xmx5120m | ||
org.gradle.workers.max=2 | ||
|
||
# https://stackoverflow.com/questions/50138863/why-does-my-kotlin-gradle-build-die-with-exit-code-137 | ||
kotlin.compiler.execution.strategy=in-process |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
unit-test: | ||
runs-on: [ubuntu-latest] | ||
if: ${{ !contains(github.event.head_commit.message, '[ci skip]') }} | ||
|
||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK 1.8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.8 | ||
|
||
- name: Generate a Cache Key | ||
run: ./checksum.sh checksum.txt | ||
|
||
- name: Copy CI Gradle Properties | ||
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | ||
|
||
- name: Cache Gradle Folders | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches/ | ||
~/.gradle/wrapper/ | ||
key: cache-gradle-${{ runner.os }}-${{ hashFiles('checksum.txt') }} | ||
restore-keys: | | ||
cache-gradle-${{ runner.os }}- | ||
cache-gradle- | ||
- name: Run all unit tests | ||
run: ./gradlew test | ||
|
||
instrumentation-test: | ||
runs-on: [macos-latest] | ||
if: ${{ !contains(github.event.head_commit.message, '[ci skip]') }} | ||
|
||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK 1.8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.8 | ||
|
||
- name: Generate a Cache Key | ||
run: ./checksum.sh checksum.txt | ||
|
||
- name: Copy CI Gradle Properties | ||
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | ||
|
||
- name: Cache Gradle Folders | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches/ | ||
~/.gradle/wrapper/ | ||
key: cache-gradle-${{ runner.os }}-${{ hashFiles('checksum.txt') }} | ||
restore-keys: | | ||
cache-gradle-${{ runner.os }}- | ||
cache-gradle- | ||
- name: Run all instrumentation tests | ||
uses: reactivecircus/android-emulator-runner@v2 | ||
with: | ||
api-level: 30 | ||
target: google_apis # https://github.com/ReactiveCircus/android-emulator-runner/issues/106 | ||
script: ./gradlew connectedAndroidTest | ||
|
||
assemble: | ||
runs-on: [ubuntu-latest] | ||
if: ${{ !contains(github.event.head_commit.message, '[ci skip]') }} | ||
|
||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK 1.8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.8 | ||
|
||
- name: Generate a Cache Key | ||
run: ./checksum.sh checksum.txt | ||
|
||
- name: Copy CI Gradle Properties | ||
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | ||
|
||
- name: Cache Gradle Folders | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches/ | ||
~/.gradle/wrapper/ | ||
key: cache-gradle-${{ runner.os }}-${{ hashFiles('checksum.txt') }} | ||
restore-keys: | | ||
cache-gradle-${{ runner.os }}- | ||
cache-gradle- | ||
- name: Build Debug APK | ||
run: ./gradlew assembleDebug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Validate Gradle Wrapper | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
validation: | ||
runs-on: ubuntu-latest | ||
if: ${{ !contains(github.event.head_commit.message, '[ci skip]') }} | ||
|
||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Validate Gradle Wrapper | ||
uses: gradle/wrapper-validation-action@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
RESULT_FILE=$1 | ||
|
||
if [ -f $RESULT_FILE ]; then | ||
rm $RESULT_FILE | ||
fi | ||
touch $RESULT_FILE | ||
|
||
checksum_file() { | ||
echo $(openssl md5 $1 | awk '{print $2}') | ||
} | ||
|
||
FILES=() | ||
while read -r -d ''; do | ||
FILES+=("$REPLY") | ||
done < <(find . -type f \( -name "build.gradle*" -o -name "Dependencies.kt" -o -name "gradle-wrapper.properties" \) -print0) | ||
|
||
# Loop through files and append MD5 to result file | ||
for FILE in ${FILES[@]}; do | ||
echo $(checksum_file $FILE) >> $RESULT_FILE | ||
done | ||
# Now sort the file so that it is | ||
sort $RESULT_FILE -o $RESULT_FILE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
core/src/main/java/com/paulrybitskyi/gamedge/core/providers/TimeProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2021 Paul Rybitskyi, paul.rybitskyi.work@gmail.com | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.paulrybitskyi.gamedge.core.providers | ||
|
||
import com.paulrybitskyi.hiltbinder.BindType | ||
import java.time.LocalDateTime | ||
import javax.inject.Inject | ||
|
||
|
||
interface TimeProvider { | ||
|
||
fun getCurrentDateTime(): LocalDateTime | ||
|
||
} | ||
|
||
|
||
@BindType | ||
internal class TimeProviderImpl @Inject constructor() : TimeProvider { | ||
|
||
|
||
override fun getCurrentDateTime(): LocalDateTime { | ||
return LocalDateTime.now() | ||
} | ||
|
||
|
||
} |
25 changes: 25 additions & 0 deletions
25
core/src/main/java/com/paulrybitskyi/gamedge/core/utils/TimeUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright 2021 Paul Rybitskyi, paul.rybitskyi.work@gmail.com | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.paulrybitskyi.gamedge.core.utils | ||
|
||
import java.time.LocalDateTime | ||
import java.time.ZoneId | ||
|
||
|
||
fun LocalDateTime.toMillis(zoneId: ZoneId = ZoneId.systemDefault()): Long { | ||
return atZone(zoneId).toInstant().toEpochMilli() | ||
} |
Oops, something went wrong.