From 3fe63796a050539323652168753d288be240dfed Mon Sep 17 00:00:00 2001 From: Nikita Samoylov Date: Mon, 3 Jun 2024 22:19:45 +0300 Subject: [PATCH] CI change --- .github/DISCUSSION_TEMPLATE/questions.yml | 16 ---- .github/ISSUE_TEMPLATE/bug.yml | 39 --------- .github/ISSUE_TEMPLATE/config.yml | 5 -- .../ISSUE_TEMPLATE/documentation-error.yml | 19 ----- .github/workflows/build-debug-apk.yml | 5 +- .github/workflows/check-formatting.yml | 16 ---- .github/workflows/neutral-build.yml | 66 +++++++++++++++ .github/workflows/release-update.yml | 56 ------------- .github/workflows/run-tests.yml | 9 -- common-scripts.gradle | 84 ++----------------- gradle.properties | 3 + versions.gradle | 2 +- 12 files changed, 82 insertions(+), 238 deletions(-) delete mode 100644 .github/DISCUSSION_TEMPLATE/questions.yml delete mode 100644 .github/ISSUE_TEMPLATE/bug.yml delete mode 100644 .github/ISSUE_TEMPLATE/config.yml delete mode 100644 .github/ISSUE_TEMPLATE/documentation-error.yml delete mode 100644 .github/workflows/check-formatting.yml create mode 100644 .github/workflows/neutral-build.yml delete mode 100644 .github/workflows/release-update.yml diff --git a/.github/DISCUSSION_TEMPLATE/questions.yml b/.github/DISCUSSION_TEMPLATE/questions.yml deleted file mode 100644 index e9b796947..000000000 --- a/.github/DISCUSSION_TEMPLATE/questions.yml +++ /dev/null @@ -1,16 +0,0 @@ -body: - - type: textarea - attributes: - label: Question - validations: - required: true - - type: input - attributes: - label: Vico version(s) - - type: dropdown - attributes: - label: UI framework(s) - multiple: true - options: - - Jetpack Compose - - Views diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml deleted file mode 100644 index 71e62a188..000000000 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Bug -description: Report incorrect behavior. -labels: ["bug"] -body: - - type: textarea - attributes: - label: How to reproduce - description: Please provide a detailed description of how to reproduce the bug. - validations: - required: true - - type: textarea - attributes: - label: Observed behavior - validations: - required: true - - type: textarea - attributes: - label: Expected behavior - validations: - required: true - - type: dropdown - attributes: - label: Vico version(s) - description: If you’re using an outdated version, please try updating Vico first. - multiple: true - options: - - 2.0.0-alpha.20 - - 1.15.0-alpha.1 - - 1.14.0 - validations: - required: true - - type: input - attributes: - label: Android version(s) - validations: - required: true - - type: textarea - attributes: - label: Additional information diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index 6f33698aa..000000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,5 +0,0 @@ -blank_issues_enabled: false -contact_links: - - name: Something else - about: Please create a discussion. - url: https://github.com/patrykandpatrick/vico/discussions/new/choose diff --git a/.github/ISSUE_TEMPLATE/documentation-error.yml b/.github/ISSUE_TEMPLATE/documentation-error.yml deleted file mode 100644 index 37d922040..000000000 --- a/.github/ISSUE_TEMPLATE/documentation-error.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Documentation error -description: Report a mistake in the documentation. -labels: ["documentation error"] -body: - - type: textarea - attributes: - label: Area - description: Which part of the documentation is affected? - validations: - required: true - - type: textarea - attributes: - label: Error - description: What’s wrong? - validations: - required: true - - type: textarea - attributes: - label: Additional information diff --git a/.github/workflows/build-debug-apk.yml b/.github/workflows/build-debug-apk.yml index 5e0bd55e0..d9c505bf6 100644 --- a/.github/workflows/build-debug-apk.yml +++ b/.github/workflows/build-debug-apk.yml @@ -1,6 +1,5 @@ name: Build debug APK on: - push: pull_request: jobs: build-debug-apk: @@ -17,3 +16,7 @@ jobs: with: name: Debug APK path: sample/build/outputs/apk/debug/**.apk + - uses: actions/upload-artifact@v4 + with: + name: Debug Tangem Demo APK + path: tangem-demo/build/outputs/apk/debug/**.apk diff --git a/.github/workflows/check-formatting.yml b/.github/workflows/check-formatting.yml deleted file mode 100644 index be0534620..000000000 --- a/.github/workflows/check-formatting.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Check formatting -on: - push: - pull_request: -jobs: - check-formatting: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 - with: - java-version: 21 - distribution: zulu - - run: | - curl -sSL -o ktfmt.jar https://github.com/facebook/ktfmt/releases/download/v0.49/ktfmt-0.49-jar-with-dependencies.jar - java -jar ktfmt.jar --dry-run --google-style --set-exit-if-changed . diff --git a/.github/workflows/neutral-build.yml b/.github/workflows/neutral-build.yml new file mode 100644 index 000000000..9bf7c7a5a --- /dev/null +++ b/.github/workflows/neutral-build.yml @@ -0,0 +1,66 @@ +name: Neutral Build + +on: + push: + branches: + - 'tangem-master' + workflow_dispatch: + +env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_DVELOPMENT_ANDROID }} + +jobs: + tag: + name: Create tag + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + path: vico + + - name: set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: zulu + + - uses: gradle/gradle-build-action@v3 + - run: | + VERSION_NAME=$(grep -oP "(?<=version_name).*(?=\",)" versions.gradle | grep -oP "(?<=\").*") + echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV + echo "TAG_NAME=v$VERSION_NAME" >> $GITHUB_ENV + ./gradlew assembleDebug + + - name: Create tag + uses: actions/github-script@v3 + with: + github-token: ${{ github.token }} + script: | + github.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: "refs/tags/${{ env.VERSION_NAME }}", + sha: context.sha + }) + + - name: Build and publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} + run: | + echo sdk.dir = $ANDROID_HOME > local.properties + ./gradlew -PgithubUser=${{ secrets.GITHUB_ACTOR }} -PgithubPass=${{ secrets.GITHUB_TOKEN }} -PartifactVersion=${{ env.VERSION_NAME }} publish + + - name: Build notification + if: always() + uses: adamkdean/simple-slack-notify@master + with: + channel: '#development-android' + status: ${{ job.status }} + success_text: 'Tangem Vico library build (${{ env.VERSION_NAME }}) has been created and uploaded to Nexus.' + failure_text: 'GitHub Action #${{ github.run_number }} failed. Tag has not been not created.' + cancelled_text: 'GitHub Action #${{ github.run_number }} was cancelled' + fields: | + [{"title": "TAG", "value": "${{ env.VERSION_NAME }}"}, + {"title": "Action URL", "value": "${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}"}] diff --git a/.github/workflows/release-update.yml b/.github/workflows/release-update.yml deleted file mode 100644 index 350e3dd2a..000000000 --- a/.github/workflows/release-update.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: Release update -on: - workflow_dispatch: -jobs: - release-update: - runs-on: ubuntu-latest - if: github.repository == 'patrykandpatrick/vico' - permissions: - contents: write - steps: - - uses: actions/checkout@v4 - with: - path: vico - - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: zulu - - uses: gradle/gradle-build-action@v3 - - run: | - git config --global user.email "96002241+patrykandpatrickbot@users.noreply.github.com" - git config --global user.name "Patryk & Patrick Bot" - git clone https://${{ secrets.BOT_PAT }}@github.com/patrykandpatrick/patrykandpatrick.com - cd ${{ github.workspace }}/vico - VERSION_NAME=$(grep -oP "(?<=version_name).*(?=\",)" versions.gradle | grep -oP "(?<=\").*") - echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV - echo "TAG_NAME=v$VERSION_NAME" >> $GITHUB_ENV - IS_PRERELEASE=false - echo $VERSION_NAME | grep -q "alpha\|beta" && IS_PRERELEASE=true - echo "IS_PRERELEASE=$IS_PRERELEASE" >> $GITHUB_ENV - ./gradlew assembleDebug - - uses: softprops/action-gh-release@v2 - with: - tag_name: ${{ env.TAG_NAME }} - token: ${{ secrets.BOT_PAT }} - prerelease: ${{ env.IS_PRERELEASE }} - draft: true - files: ${{ github.workspace }}/vico/sample/build/outputs/apk/debug/*.apk - - run: | - cd ${{ github.workspace }}/vico - git remote set-url origin https://patrykandpatrickbot:${{ secrets.BOT_PAT }}@github.com/patrykandpatrick/vico.git - ./gradlew dokkaHtmlMultiModule - API_REFERENCE_DESTINATION=${{ github.workspace }}/patrykandpatrick.com/src/vico/static/api/$(if $IS_PRERELEASE; then echo $VERSION_NAME; else echo main; fi) - rm -fr $API_REFERENCE_DESTINATION/* - cp -R ${{ github.workspace }}/vico/vico/build/dokka/htmlMultiModule/. $API_REFERENCE_DESTINATION - cd ${{ github.workspace }}/patrykandpatrick.com - git remote set-url origin https://patrykandpatrickbot:${{ secrets.BOT_PAT }}@github.com/patrykandpatrick/patrykandpatrick.com.git - git add src/vico/static/api - git diff --staged --quiet HEAD || git commit -m "Update Vico API reference" - git push origin - cd ${{ github.workspace }}/vico - git push origin - ./gradlew publish - env: - ORG_GRADLE_PROJECT_GPG_KEY: ${{ secrets.GPG_KEY }} - ORG_GRADLE_PROJECT_GPG_KEY_PASSWORD: ${{ secrets.GPG_KEY_PASSWORD }} - ORG_GRADLE_PROJECT_OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 6e1e358aa..4a6e5f0a0 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -1,6 +1,5 @@ name: Run tests on: - push: pull_request: jobs: run-tests: @@ -16,11 +15,3 @@ jobs: - run: chmod +x gradlew - id: unit-tests run: ./gradlew vico:core:testDebug - - id: paparazzi - if: ${{ success() || steps.unit-tests.conclusion == 'failure' }} - run: ./gradlew sample:verifyPaparazziDebug - - uses: actions/upload-artifact@v4 - if: ${{ !cancelled() && steps.paparazzi.conclusion == 'failure' }} - with: - name: Paparazzi deltas - path: sample/build/paparazzi/failures/delta-*.png diff --git a/common-scripts.gradle b/common-scripts.gradle index 74c93ce99..436fe022a 100644 --- a/common-scripts.gradle +++ b/common-scripts.gradle @@ -64,9 +64,9 @@ String getArtifactId(Project project) { void customizePom(MavenPom pom) { - pom.name = "Vico" + pom.name = "Tangem Vico" pom.description = "A light and extensible chart library for Android." - pom.url = "https://github.com/patrykandpatrick/vico" + pom.url = "https://github.com/tangem/vico" pom.licenses { @@ -77,25 +77,10 @@ void customizePom(MavenPom pom) { } pom.scm { - connection = "scm:git:git://github.com/patrykandpatrick/vico.git" - developerConnection = "scm:git:ssh://github.com/patrykandpatrick/vico.git" + connection = "scm:git:git://github.com/tangem/vico.git" + developerConnection = "scm:git:ssh://github.com/tangem/vico.git" url = "https://github.com/patrykandpatrick/vico" } - - pom.developers { - - developer { - id = "patrykgoworowski" - name = "Patryk Goworowski" - email = "contact@patrykgoworowski.pl" - } - - developer { - id = "patrickmichalik" - name = "Patrick Michalik" - email = "contact@patrickmichalik.com" - } - } } boolean isReleaseVersion() { @@ -104,68 +89,15 @@ boolean isReleaseVersion() { void setUpRepositories(RepositoryHandler handler) { handler.maven { - def releaseUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" - def snapshotUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/" - url = isReleaseVersion() ? releaseUrl : snapshotUrl - + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/tangem/vico") credentials { - username = "patrykandpatrick" - password = findProperty("OSSRH_PASSWORD") + username = "$githubUser" + password = "$githubPass" } } } void setUpSigning(SigningExtension signing, MavenPublication publication) { - signing.setRequired { - isReleaseVersion() && gradle.taskGraph.allTasks.any { it.is(PublishToMavenRepository) } - } - def gpgKey = findProperty("GPG_KEY") - def gpgKeyPassword = findProperty("GPG_KEY_PASSWORD") - - signing.useInMemoryPgpKeys(gpgKey, gpgKeyPassword) - signing.sign publication } - -//apply from: '../artifactConfig.gradle' -//apply plugin: 'maven-publish' -// -//afterEvaluate { -// publishing { -// publications { -// maven(MavenPublication) { -// groupId = "$artifactConfig.group" -// artifactId = "$project.artifactId" -// version = "$artifactConfig.version" -// -// if (artifactId == "android") { -// from components.release -// artifact(sourceJar) -// -// pom.withXml { -// Node pomNode = asNode() -// pomNode.dependencies.'*'.findAll() { -// it.groupId.text() == artifactConfig.group -// }.each() { it.parent().remove(it) } -// -// pomNode.dependencies.'*'.findAll() { -// it.scope.text() == 'runtime' -// }.each { it.scope*.value = 'compile' } -// } -// } else if (artifactId == "core") { -// from components.java -// } -// } -// } -// repositories { -// maven { -// name = "GitHubPackages" -// url = uri("https://maven.pkg.github.com/tangem/tangem-sdk-android") -// credentials { -// username = "$githubUser" -// password = "$githubPass" -// } -// } -// } -// } -//} diff --git a/gradle.properties b/gradle.properties index 153f79ef9..5de7e47f8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -26,3 +26,6 @@ android.useAndroidX=true kotlin.code.style=official # https://blog.jetbrains.com/kotlin/2022/07/a-new-approach-to-incremental-compilation-in-kotlin/ kotlin.incremental.useClasspathSnapshot=true + +githubUser=github_user +githubPass=github_pass diff --git a/versions.gradle b/versions.gradle index b358940d6..c1722bdb9 100644 --- a/versions.gradle +++ b/versions.gradle @@ -18,7 +18,7 @@ ext { library = [ groupId : "com.patrykandpatrick.vico", - version_name : "2.0.0-alpha.21", + version_name : "2.0.0-alpha.21-tangem1", version_code : 1, target_sdk : 34, min_sdk : 19,