Skip to content

Commit

Permalink
IJMP-1655 Build and release automation fixed
Browse files Browse the repository at this point in the history
Signed-off-by: Uladzislau <leksilonchikk@gmail.com>
  • Loading branch information
KUGDev committed Apr 12, 2024
1 parent 236da8e commit 15b68d8
Show file tree
Hide file tree
Showing 9 changed files with 296 additions and 356 deletions.
30 changes: 0 additions & 30 deletions .github/actions/setup/action.yml

This file was deleted.

10 changes: 5 additions & 5 deletions .github/actions/sonar/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ runs:
using: composite
steps:
- name: Cache SonarCloud packages
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ~/.sonar/caches
key: ${{ runner.os }}-sonar
Expand All @@ -15,8 +15,8 @@ runs:
- name: Code coverage and publish results
shell: bash
run: >
./gradlew --info sonarqube
./gradlew --info sonar
-Dorg.gradle.jvmargs="-XX:MaxMetaspaceSize=512m"
-Dresults="build/reports/tests/test,build/test-results/test,build/reports/jacoco/test/html"
-Psonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_TOKEN
-Dsonar.coverage.jacoco.xmlReportPaths="build/reports/jacoco.xml"
-Dresults="build/reports/tests/test,build/test-results/test,build/reports/kover/html"
-Psonar.host.url=$SONAR_HOST_URL -Dsonar.token=$SONAR_TOKEN
-Dsonar.coverage.jacoco.xmlReportPaths="build/reports/kover/xml/report.xml"
165 changes: 165 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# 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 + Test&Sonar + Verify

on: [push, workflow_dispatch]

permissions:
contents: read

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
outputs:
pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }}
steps:

- name: Checkout the plugin GitHub repository
uses: actions/checkout@v4

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v2

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 11

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-home-cache-cleanup: true

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

- name: Fetch Gradle properties
id: properties
env:
AUTO_SNAPSHOT_VERSION: false
shell: bash
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
# prepare list of IDEs to use by plugin verifier:
./gradlew listProductsReleases
- name: Build plugin
shell: bash
run: ./gradlew buildPlugin

- name: Prepare Plugin Artifact
id: artifact
shell: bash
run: |
cd ${{ github.workspace }}/build/distributions
FILENAME=`ls *.zip`
unzip "$FILENAME" -d content
echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT
echo "zip artifact name:"
echo "$FILENAME"
- name: Publish built plugin to artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.artifact.outputs.filename }}
path: ./build/distributions/content/*/*

test_and_sonar:
needs: [build]
runs-on: ubuntu-latest
steps:

- name: Checkout the plugin GitHub repository
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 11

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-home-cache-cleanup: true

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

- name: Publish tests result to artifacts
uses: actions/upload-artifact@v4
with:
name: tests-report
path: ${{ github.workspace }}/build/reports/tests

- name: Publish code coverage report to artifacts
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: ${{ github.workspace }}/build/reports/kover/html

- name: SonarCloud scans
continue-on-error: true
uses: ./.github/actions/sonar
env:
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}

verify:
if: ${{ contains(github.ref, 'refs/heads/release/') }}
needs: [build]
runs-on: ubuntu-latest
steps:

- name: Maximize Build Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
large-packages: false

- name: Checkout the plugin GitHub repository
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 11

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-home-cache-cleanup: true

- name: Setup Plugin Verifier IDEs Cache
uses: actions/cache@v4
with:
path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides
key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}

- name: Verify plugin against IntelliJ IDEA IDE's
continue-on-error: true
shell: bash
run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}

- name: Collect Plugin Verifier Result
uses: actions/upload-artifact@v4
with:
name: plugin-verifier-report
path: ${{ github.workspace }}/build/reports/pluginVerifier
132 changes: 0 additions & 132 deletions .github/workflows/gradle.yml

This file was deleted.

Loading

0 comments on commit 15b68d8

Please sign in to comment.