Skip to content

Commit

Permalink
change test
Browse files Browse the repository at this point in the history
  • Loading branch information
matheus-corregiari committed Nov 9, 2023
1 parent e2830e7 commit 3ecf655
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 58 deletions.
24 changes: 24 additions & 0 deletions .github/actions/version-name/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
name: "Gets and stores the new version name so we can use it do deploy"
description: "Boilerplate steps"

inputs:
ossrh_username:
description: User
required: false
ossrh_password:
description: Pass
required: false
sign_keyid:
description: Id
required: false
sign_password:
description: Other Pass
required: false
sign_filename:
description: file name
required: false

runs:
using: "composite"
steps:
Expand All @@ -20,6 +38,12 @@ runs:
# Put everything we need into gradle.properties to build properly
- name: Inject sign into gradle.properties
shell: bash
env:
OSSRH_USERNAME: ${{ inputs.ossrh_username}}
OSSRH_PASSWORD: ${{ inputs.ossrh_password}}
SIGN_KEYID: ${{ inputs.sign_keyid}}
SIGN_PASSWORD: ${{ inputs.sign_password}}
SIGN_FILENAME: ${{ inputs.sign_filename}}
run: |
echo "OSSRH_USERNAME=$OSSRH_USERNAME" >> gradle.properties
echo "OSSRH_PASSWORD=$OSSRH_PASSWORD" >> gradle.properties
Expand Down
19 changes: 9 additions & 10 deletions .github/workflows/generate-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,6 @@ on:
branches:
- master

# Load Secrets
env:
# Sonatype Credentials
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
# Sign Credentials
SIGN_FILENAME: ${{ secrets.SIGN_FILENAME }}
SIGN_KEYID: ${{ secrets.SIGN_KEYID }}
SIGN_PASSWORD: ${{ secrets.SIGN_PASSWORD }}

jobs:

generate-tag:
Expand Down Expand Up @@ -68,6 +58,15 @@ jobs:
- name: Version Name
id: version-name
uses: ./.github/actions/version-name
with:
# Sonatype Credentials
ossrh_username: ${{ secrets.OSSRH_USERNAME }}
ossrh_password: ${{ secrets.OSSRH_PASSWORD }}

# Sign Credentials
sign_keyid: ${{ secrets.SIGN_FILENAME }}
sign_password: ${{ secrets.SIGN_KEYID }}
sign_filename: ${{ secrets.SIGN_PASSWORD }}

- name: Build ${{ matrix.module }}
run: ./gradlew :${{ matrix.module }}:assembleRelease
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/teste.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ jobs:
- name: Version Name
id: version-name
uses: ./.github/actions/version-name
with:
# Sonatype Credentials
ossrh_username: ${{ secrets.OSSRH_USERNAME }}
ossrh_password: ${{ secrets.OSSRH_PASSWORD }}

# Sign Credentials
sign_keyid: ${{ secrets.SIGN_FILENAME }}
sign_password: ${{ secrets.SIGN_KEYID }}
sign_filename: ${{ secrets.SIGN_PASSWORD }}

- name: Teste Version2
run: ./gradlew :toolkit:testeVersion
53 changes: 5 additions & 48 deletions plugin/src/main/kotlin/com/toolkit/plugin/util/_requireEnv.kt
Original file line number Diff line number Diff line change
@@ -1,57 +1,14 @@
package com.toolkit.plugin.util

import com.toolkit.plugin.androidLibrary
import org.gradle.api.Project
import org.gradle.api.tasks.javadoc.Javadoc
import org.gradle.jvm.tasks.Jar
import org.jetbrains.kotlin.konan.file.File

internal fun Project.missing(vararg name: String): Boolean {
return name.map(::containsEnv).any {
if (it.not()) {
println("Missing Variable: $it")
true
} else {
false
}
}
}
internal fun Project.missing(vararg name: String) =
name.map(::containsEnv).any { it.not() }

internal fun Project.containsEnv(name: String): Boolean {
val env = System.getenv("name") ?: (properties[name] as? String)
return env.isNullOrBlank().not()
}

private fun Project.setupJavadoc(): Jar {
configurations.maybeCreate("jacocoDeps")

val javadoc = tasks.register("javadoc", Javadoc::class.java) {
val list = ArrayList<java.io.File>()
androidLibrary.sourceSets.forEach { set -> list.addAll(set.java.srcDirs) }

it.isFailOnError = false
it.setExcludes(listOf("**/*.kt", "**/*.java"))
it.source(list)
it.classpath += files(androidLibrary.bootClasspath.joinToString(separator = File.separator))
it.classpath += configurations.named("jacocoDeps").get()
}.get()

return tasks.register("javadocJar", Jar::class.java) {
it.dependsOn(javadoc)
it.archiveClassifier.set("javadoc")
it.from(javadoc.destinationDir)
}.get()
}

private fun Project.setupSources() = tasks.register("sourcesJar", Jar::class.java) {
val mainSource = androidLibrary.sourceSets.named("main").get().java.srcDirs
it.from(mainSource)
it.archiveClassifier.set("sources")
}.get()

private fun Project.setupArtifacts(javadoc: Jar, sources: Jar) {
artifacts {
it.add("archives", javadoc)
it.add("archives", sources)
if (env.isNullOrBlank()) {
println("Missing Variable: $name")
}
return env.isNullOrBlank().not()
}

0 comments on commit 3ecf655

Please sign in to comment.