1
0
Fork 0

GitHub actions (#167)

* added a github workflow for closing stale issues

* added github PR validation workflows

* fixed the dictionary validator missing digits in words

* fixed the build failing completely when there no git tags

* updated androidx.room 2.4.3 -> 2.5.0
This commit is contained in:
Dimo Karaivanov 2023-01-31 17:58:40 +02:00 committed by GitHub
parent 2510aba58a
commit a419a6c4cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 56 additions and 9 deletions

19
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,19 @@
name: Build the Project
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
# setup
- name: Checkout project sources
uses: actions/checkout@v2
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
# validation
- name: Validate Dictionaries
run: ./gradlew validateDictionaries
- name: Build Release APK
run: ./gradlew assemble

View file

@ -0,0 +1,22 @@
name: Close inactive issues
on:
schedule:
- cron: "21 0 * * *"
jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v4
with:
days-before-issue-stale: 100
days-before-issue-close: 100
stale-issue-label: "stale"
stale-issue-message: "This issue is stale because it has been open for 100 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for 100 days since being marked as stale."
days-before-pr-stale: -1
days-before-pr-close: -1
repo-token: ${{ secrets.GITHUB_TOKEN }}

View file

@ -12,8 +12,8 @@ apply plugin: 'com.android.application'
dependencies {
implementation "androidx.core:core:1.9.0"
implementation 'androidx.preference:preference:1.2.0'
implementation "androidx.room:room-runtime:2.4.3"
annotationProcessor "androidx.room:room-compiler:2.4.3"
implementation "androidx.room:room-runtime:2.5.0"
annotationProcessor "androidx.room:room-compiler:2.5.0"
}
repositories {
@ -50,18 +50,24 @@ def getVersionCode = { ->
def getVersionName = { ->
// major version
String versionTagsCount = execThing('git tag --list v[0-9]*').split('\n').size()
String versionTagsRaw = execThing('git tag --list v[0-9]*')
int versionTagsCount = versionTagsRaw == "" ? 0 : versionTagsRaw.split('\n').size()
// minor version
String lastVersionTag = execThing('git describe --match v[0-9]* --tags --abbrev=0')
String gitLogResult = execThing("git log $lastVersionTag..HEAD --oneline")
String commitsSinceLastTag = gitLogResult == '' ? "0" : gitLogResult.split('\n').size()
String commitsSinceLastTag = "0"
if (versionTagsCount > 1) {
println "VERSION TAG: " + versionTagsCount
String lastVersionTag = execThing('git describe --match v[0-9]* --tags --abbrev=0')
String gitLogResult = execThing("git log $lastVersionTag..HEAD --oneline")
commitsSinceLastTag = gitLogResult == '' ? "0" : gitLogResult.split('\n').size()
}
// the commit we are building from
// beta string, if this is a beta
String lastTagName = execThing('git describe --tags --abbrev=0')
String lastTagHash = execThing("git log -1 --format=%h $lastTagName")
String lastTagName = (execThing('git tag --list') == "") ? "" : execThing('git describe --tags --abbrev=0')
String lastTagHash = (lastTagName == "") ? "" : execThing("git log -1 --format=%h $lastTagName")
String betaString = lastTagHash == getCurrentGitHash() && lastTagName.contains("-beta") ? '-beta' : ''
return "$versionTagsCount.$commitsSinceLastTag$betaString"
@ -175,7 +181,7 @@ task validateDictionaries {
errors += "Dictionary '" + file.name + "' is invalid. Found out-of-range word frequency: '" + frequency + "' on line " + lineNumber + ". Frequency must be a non-negative integer. \n"
}
if (word.matches("\\d")) {
if (word.matches("(\\d.+?|.+?\\d|\\d)")) {
errorCount++
errors += "Dictionary '" + file.name + "' is invalid. Found numbers on line " + lineNumber + ". Please, remove all numbers.\n"
}