Skip to content

Commit

Permalink
Merge branch 'zowe-release/v1.1.0-223' into zowe-release/v1.1.0-231
Browse files Browse the repository at this point in the history
  • Loading branch information
KUGDev committed Aug 17, 2023
2 parents 1ff744b + 60214d2 commit 336d1d3
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ runs:
distribution: 'zulu'
java-version: ${{ inputs.jdkVersion }}

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: 7.6.1

- name: Grant execute permission for gradlew
run: chmod +x gradlew
shell: bash
Expand Down
22 changes: 22 additions & 0 deletions .github/actions/sonar/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Setup action"
description: "Runs sonar scans"


runs:
using: composite
steps:
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar/caches
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Code coverage and publish results
shell: bash
run: >
./gradlew --info sonarqube
-Dorg.gradle.jvmargs="-XX:MaxMetaspaceSize=512m"
-Dresults="build/reports/tests/test,build/test-results/test,build/reports/kover/html"
-Psonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_TOKEN
-Dsonar.coverage.jacoco.xmlReportPaths="build/reports/kover/xml/report.xml"
113 changes: 113 additions & 0 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: Build with Gradle + Deploy

on:
push:
workflow_dispatch:

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout of github repository
uses: actions/checkout@v3

- name: Setup of environment
uses: ./.github/actions/setup

- name: Check repopository content
shell: bash
run: pwd && ls -la

- name: Cache Gradle packages
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle

- name: Build with Gradle
run: gradle wrapper && ./gradlew buildPlugin
shell: bash

- name: Run tests
run: ./gradlew test
shell: bash

- name: Sonarcloud scans
uses: ./.github/actions/sonar
env:
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}

- name: Publish built plugin
uses: actions/upload-artifact@v3
with:
name: builtPlugin
path: ./build/distributions/


deploy:
needs: build

runs-on: XBY_IJMP_machine

concurrency: built-plugin
environment:
name: built-plugin
url: http://178.172.233.157/plugin-builds/${{steps.extract_branch.outputs.BRANCH_NAME}}/${{ steps.generate_file_name.outputs.NEW_FILE_NAME }}

steps:
- name: Extract branch name
id: extract_branch
shell: bash
run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT

- name: Check current directory
shell: bash
run: pwd && ls -la

- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: builtPlugin
path: ./build/distributions/

- name: Check plugin built availability
shell: bash
run: ls -la ./build/distributions

- name: Get name of build plugin archive
id: getting_file_name
shell: bash
run: >
CURRENT_FILE_NAME_PATH=$(echo $(find build -name "zowe-explorer*")) &&
echo "Name of current file: $CURRENT_FILE_NAME_PATH" &&
echo "CURRENT_FILE_NAME_PATH=$CURRENT_FILE_NAME_PATH" >> $GITHUB_OUTPUT
- name: Generate new name for built plugin
id: generate_file_name
shell: bash
run: >
TEMP_VAR=${{ steps.getting_file_name.outputs.CURRENT_FILE_NAME_PATH }}
NEW_FILE_NAME="$(echo ${TEMP_VAR%.zip*})."$(date +"%Y-%m-%dT%H:%M:%S%:z" | tr ':' _)".zip" &&
NEW_FILE_NAME=${NEW_FILE_NAME##*/} &&
echo "Name of new file: $NEW_FILE_NAME" &&
echo "NEW_FILE_NAME=$NEW_FILE_NAME" >> $GITHUB_OUTPUT
- name: Move built plugin to destination folder
shell: bash
run: >
mkdir -p /var/www/plugin-builds/${{ steps.extract_branch.outputs.BRANCH_NAME }} &&
mv ${{ steps.getting_file_name.outputs.CURRENT_FILE_NAME_PATH }} /var/www/plugin-builds/${{ steps.extract_branch.outputs.BRANCH_NAME }}/${{ steps.generate_file_name.outputs.NEW_FILE_NAME }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ gradle/wrapper/*
!gradle/
!gradle/wrapper/
!gradle/wrapper/gradle-wrapper.properties
!gradle/sonar.gradle
/build

verifier-all.jar
Expand Down
6 changes: 1 addition & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ tasks {
// ignoreFailures = true

finalizedBy("koverHtmlReport")
finalizedBy("koverXmlReport")
systemProperty("idea.force.use.core.classloader", "true")
systemProperty("idea.use.core.classloader.for.plugin.path", "true")
systemProperty("java.awt.headless", "true")
Expand All @@ -182,11 +183,6 @@ tasks {
}
})
)
// TODO: setup Kover
// reports {
// xml.required.set(true)
// xml.outputLocation.set(File("${buildDir}/reports/jacoco.xml"))
// }
}

val createOpenApiSourceJar by registering(Jar::class) {
Expand Down
6 changes: 4 additions & 2 deletions gradle/sonar.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ sonarqube {
property "sonar.sourceEncoding", "UTF-8"
property "sonar.organization", "zowe"
property "sonar.projectKey", "zowe_zowe-explorer-intellij"
property "sonar.projectName", "Zowe Explorer for IntelliJ"
property "sonar.projectName", "Zowe Explorer plug-in for IntelliJ IDEA"
property "sonar.projectVersion", project.version
property "sonar.language", "kotlin"
property "sonar.links.scm", "https://github.com/zowe/zowe-explorer-intellij"
property "sonar.links.ci", System.getenv()['BUILD_URL'] ?: null
property "sonar.core.codeCoveragePlugin", "jacoco"
property "sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/reports/kover/report.xml"
if (pullRequest != null) {
property "sonar.pullrequest.key", System.getenv()['CHANGE_ID'] ?: null
property "sonar.pullrequest.branch", System.getenv()['CHANGE_BRANCH'] ?: null
Expand All @@ -34,4 +36,4 @@ subprojects {
property "sonar.tests", "src/test/kotlin"
}
}
}
}

0 comments on commit 336d1d3

Please sign in to comment.