2023-01-13 20:34:46 +00:00
|
|
|
# GitHub Actions Workflow is created for testing and preparing the plugin release in the following steps:
|
2023-08-07 13:20:46 +00:00
|
|
|
# - Validate Gradle Wrapper.
|
|
|
|
# - Run 'test' and 'verifyPlugin' tasks.
|
|
|
|
# - Run Qodana inspections.
|
|
|
|
# - Run the 'buildPlugin' task and prepare artifact for further tests.
|
|
|
|
# - Run the 'runPluginVerifier' task.
|
|
|
|
# - Create a draft release.
|
2020-04-22 07:11:33 +00:00
|
|
|
#
|
2023-08-07 13:20:46 +00:00
|
|
|
# The workflow is triggered on push and pull_request events.
|
2020-04-22 07:11:33 +00:00
|
|
|
#
|
2021-09-30 13:04:21 +00:00
|
|
|
# GitHub Actions reference: https://help.github.com/en/actions
|
2020-06-24 13:04:54 +00:00
|
|
|
#
|
|
|
|
## JBIJPPTPL
|
2020-04-22 07:11:33 +00:00
|
|
|
|
2020-05-06 07:34:35 +00:00
|
|
|
name: Build
|
2021-04-05 19:18:54 +00:00
|
|
|
on:
|
2023-08-07 13:20:46 +00:00
|
|
|
# Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g., for dependabot pull requests)
|
2021-04-05 19:18:54 +00:00
|
|
|
push:
|
2023-06-14 11:40:51 +00:00
|
|
|
branches: [ main ]
|
2021-04-05 19:18:54 +00:00
|
|
|
# Trigger the workflow on any pull request
|
|
|
|
pull_request:
|
|
|
|
|
2020-04-21 20:31:52 +00:00
|
|
|
jobs:
|
2020-04-22 07:11:33 +00:00
|
|
|
|
2023-06-14 11:40:51 +00:00
|
|
|
# Prepare environment and build the plugin
|
2021-09-30 13:32:04 +00:00
|
|
|
build:
|
|
|
|
name: Build
|
2020-06-16 09:09:54 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-09-30 13:32:04 +00:00
|
|
|
outputs:
|
|
|
|
version: ${{ steps.properties.outputs.version }}
|
|
|
|
changelog: ${{ steps.properties.outputs.changelog }}
|
2023-06-14 11:40:51 +00:00
|
|
|
pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }}
|
2020-06-16 09:09:54 +00:00
|
|
|
steps:
|
2020-06-17 05:19:59 +00:00
|
|
|
|
2020-06-16 09:09:54 +00:00
|
|
|
# Check out current repository
|
|
|
|
- name: Fetch Sources
|
2023-09-05 06:17:09 +00:00
|
|
|
uses: actions/checkout@v4
|
2020-06-17 05:19:59 +00:00
|
|
|
|
2020-06-16 09:09:54 +00:00
|
|
|
# Validate wrapper
|
|
|
|
- name: Gradle Wrapper Validation
|
2023-07-24 06:43:14 +00:00
|
|
|
uses: gradle/wrapper-validation-action@v1.1.0
|
2020-06-16 09:09:54 +00:00
|
|
|
|
2023-08-07 13:20:46 +00:00
|
|
|
# Set up Java environment for the next steps
|
2023-07-10 14:55:15 +00:00
|
|
|
- name: Setup Java
|
2023-11-30 06:30:47 +00:00
|
|
|
uses: actions/setup-java@v4
|
2023-07-10 14:55:15 +00:00
|
|
|
with:
|
|
|
|
distribution: zulu
|
|
|
|
java-version: 17
|
|
|
|
|
2023-06-14 11:40:51 +00:00
|
|
|
# Setup Gradle
|
|
|
|
- name: Setup Gradle
|
|
|
|
uses: gradle/gradle-build-action@v2
|
2023-08-04 09:58:42 +00:00
|
|
|
with:
|
|
|
|
gradle-home-cache-cleanup: true
|
2020-06-17 05:19:59 +00:00
|
|
|
|
2021-08-26 14:48:38 +00:00
|
|
|
# Set environment variables
|
|
|
|
- name: Export Properties
|
|
|
|
id: properties
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
PROPERTIES="$(./gradlew properties --console=plain -q)"
|
2021-09-30 13:32:04 +00:00
|
|
|
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
|
|
|
|
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
|
2021-08-26 14:48:38 +00:00
|
|
|
|
2022-11-26 16:30:37 +00:00
|
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
|
2022-12-05 13:22:56 +00:00
|
|
|
|
|
|
|
echo "changelog<<EOF" >> $GITHUB_OUTPUT
|
|
|
|
echo "$CHANGELOG" >> $GITHUB_OUTPUT
|
|
|
|
echo "EOF" >> $GITHUB_OUTPUT
|
2021-08-26 14:48:38 +00:00
|
|
|
|
2021-09-30 13:32:04 +00:00
|
|
|
./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
|
2021-09-08 09:42:30 +00:00
|
|
|
|
2023-06-14 11:40:51 +00:00
|
|
|
# Build plugin
|
|
|
|
- name: Build plugin
|
|
|
|
run: ./gradlew buildPlugin
|
|
|
|
|
|
|
|
# Prepare plugin archive content for creating artifact
|
|
|
|
- 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
|
|
|
|
|
|
|
|
# Store already-built plugin as an artifact for downloading
|
|
|
|
- name: Upload artifact
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: ${{ steps.artifact.outputs.filename }}
|
|
|
|
path: ./build/distributions/content/*/*
|
|
|
|
|
|
|
|
# Run tests and upload a code coverage report
|
|
|
|
test:
|
|
|
|
name: Test
|
2023-07-11 13:59:41 +00:00
|
|
|
needs: [ build ]
|
2023-06-14 11:40:51 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
|
|
|
|
# Check out current repository
|
|
|
|
- name: Fetch Sources
|
2023-09-05 06:17:09 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-06-14 11:40:51 +00:00
|
|
|
|
2023-08-07 13:20:46 +00:00
|
|
|
# Set up Java environment for the next steps
|
2023-07-10 14:55:15 +00:00
|
|
|
- name: Setup Java
|
2023-11-30 06:30:47 +00:00
|
|
|
uses: actions/setup-java@v4
|
2023-07-10 14:55:15 +00:00
|
|
|
with:
|
|
|
|
distribution: zulu
|
|
|
|
java-version: 17
|
|
|
|
|
2023-06-14 11:40:51 +00:00
|
|
|
# Setup Gradle
|
|
|
|
- name: Setup Gradle
|
|
|
|
uses: gradle/gradle-build-action@v2
|
2023-08-04 09:58:42 +00:00
|
|
|
with:
|
|
|
|
gradle-home-cache-cleanup: true
|
2023-06-14 11:40:51 +00:00
|
|
|
|
2021-07-23 19:27:22 +00:00
|
|
|
# Run tests
|
|
|
|
- name: Run Tests
|
2022-09-20 10:11:24 +00:00
|
|
|
run: ./gradlew check
|
2020-06-17 05:19:59 +00:00
|
|
|
|
2021-09-08 09:42:30 +00:00
|
|
|
# Collect Tests Result of failed tests
|
|
|
|
- name: Collect Tests Result
|
|
|
|
if: ${{ failure() }}
|
2022-04-11 06:13:05 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-09-08 09:42:30 +00:00
|
|
|
with:
|
|
|
|
name: tests-result
|
|
|
|
path: ${{ github.workspace }}/build/reports/tests
|
|
|
|
|
2023-08-07 13:20:46 +00:00
|
|
|
# Upload the Kover report to CodeCov
|
2022-09-20 12:47:28 +00:00
|
|
|
- name: Upload Code Coverage Report
|
|
|
|
uses: codecov/codecov-action@v3
|
2022-09-20 10:11:24 +00:00
|
|
|
with:
|
2023-07-15 11:09:39 +00:00
|
|
|
files: ${{ github.workspace }}/build/reports/kover/report.xml
|
2022-09-20 10:11:24 +00:00
|
|
|
|
2023-07-11 13:59:41 +00:00
|
|
|
# Run Qodana inspections and provide report
|
|
|
|
inspectCode:
|
|
|
|
name: Inspect code
|
|
|
|
needs: [ build ]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
checks: write
|
|
|
|
pull-requests: write
|
|
|
|
steps:
|
|
|
|
|
2023-08-07 11:25:59 +00:00
|
|
|
# Free GitHub Actions Environment Disk Space
|
|
|
|
- name: Maximize Build Space
|
|
|
|
uses: jlumbroso/free-disk-space@main
|
|
|
|
with:
|
|
|
|
tool-cache: false
|
|
|
|
large-packages: false
|
|
|
|
|
2023-07-11 13:59:41 +00:00
|
|
|
# Check out current repository
|
|
|
|
- name: Fetch Sources
|
2023-09-05 06:17:09 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-07-11 13:59:41 +00:00
|
|
|
|
2023-08-07 13:20:46 +00:00
|
|
|
# Set up Java environment for the next steps
|
2023-07-11 13:59:41 +00:00
|
|
|
- name: Setup Java
|
2023-11-30 06:30:47 +00:00
|
|
|
uses: actions/setup-java@v4
|
2023-07-11 13:59:41 +00:00
|
|
|
with:
|
|
|
|
distribution: zulu
|
|
|
|
java-version: 17
|
|
|
|
|
|
|
|
# Run Qodana inspections
|
|
|
|
- name: Qodana - Code Inspection
|
2023-10-16 06:31:44 +00:00
|
|
|
uses: JetBrains/qodana-action@v2023.2.8
|
2023-07-11 13:59:41 +00:00
|
|
|
with:
|
|
|
|
cache-default-branch-only: true
|
|
|
|
|
2023-06-14 11:40:51 +00:00
|
|
|
# Run plugin structure verification along with IntelliJ Plugin Verifier
|
|
|
|
verify:
|
|
|
|
name: Verify plugin
|
2023-08-04 10:31:24 +00:00
|
|
|
needs: [ build ]
|
2023-06-14 11:40:51 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
|
2023-08-07 11:25:59 +00:00
|
|
|
# Free GitHub Actions Environment Disk Space
|
|
|
|
- name: Maximize Build Space
|
|
|
|
uses: jlumbroso/free-disk-space@main
|
|
|
|
with:
|
|
|
|
tool-cache: false
|
|
|
|
large-packages: false
|
|
|
|
|
2023-06-14 11:40:51 +00:00
|
|
|
# Check out current repository
|
|
|
|
- name: Fetch Sources
|
2023-09-05 06:17:09 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-06-14 11:40:51 +00:00
|
|
|
|
2023-08-07 13:20:46 +00:00
|
|
|
# Set up Java environment for the next steps
|
2023-07-10 14:55:15 +00:00
|
|
|
- name: Setup Java
|
2023-11-30 06:30:47 +00:00
|
|
|
uses: actions/setup-java@v4
|
2023-07-10 14:55:15 +00:00
|
|
|
with:
|
|
|
|
distribution: zulu
|
|
|
|
java-version: 17
|
|
|
|
|
2023-06-14 11:40:51 +00:00
|
|
|
# Setup Gradle
|
|
|
|
- name: Setup Gradle
|
|
|
|
uses: gradle/gradle-build-action@v2
|
2023-08-04 09:58:42 +00:00
|
|
|
with:
|
|
|
|
gradle-home-cache-cleanup: true
|
2023-06-14 11:40:51 +00:00
|
|
|
|
2021-09-30 13:32:04 +00:00
|
|
|
# Cache Plugin Verifier IDEs
|
|
|
|
- name: Setup Plugin Verifier IDEs Cache
|
2022-03-22 06:11:32 +00:00
|
|
|
uses: actions/cache@v3
|
2021-09-30 13:32:04 +00:00
|
|
|
with:
|
2023-06-14 11:40:51 +00:00
|
|
|
path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides
|
2021-09-30 13:39:13 +00:00
|
|
|
key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
|
2020-06-17 05:19:59 +00:00
|
|
|
|
2021-09-30 13:32:04 +00:00
|
|
|
# Run Verify Plugin task and IntelliJ Plugin Verifier tool
|
|
|
|
- name: Run Plugin Verification tasks
|
2023-06-14 11:40:51 +00:00
|
|
|
run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
|
2021-08-26 14:48:38 +00:00
|
|
|
|
2021-09-08 09:42:30 +00:00
|
|
|
# Collect Plugin Verifier Result
|
|
|
|
- name: Collect Plugin Verifier Result
|
|
|
|
if: ${{ always() }}
|
2022-04-11 06:13:05 +00:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-09-08 09:42:30 +00:00
|
|
|
with:
|
|
|
|
name: pluginVerifier-result
|
|
|
|
path: ${{ github.workspace }}/build/reports/pluginVerifier
|
|
|
|
|
2020-06-19 07:51:04 +00:00
|
|
|
# Prepare a draft release for GitHub Releases page for the manual verification
|
|
|
|
# If accepted and published, release workflow would be triggered
|
2020-06-16 09:09:54 +00:00
|
|
|
releaseDraft:
|
2023-06-14 11:40:51 +00:00
|
|
|
name: Release draft
|
2020-10-05 07:25:03 +00:00
|
|
|
if: github.event_name != 'pull_request'
|
2023-08-04 10:31:24 +00:00
|
|
|
needs: [ build, test, inspectCode, verify ]
|
2020-06-16 09:09:54 +00:00
|
|
|
runs-on: ubuntu-latest
|
2022-05-05 12:13:53 +00:00
|
|
|
permissions:
|
|
|
|
contents: write
|
2020-06-16 09:09:54 +00:00
|
|
|
steps:
|
2020-06-17 05:19:59 +00:00
|
|
|
|
2021-10-04 08:23:58 +00:00
|
|
|
# Check out current repository
|
|
|
|
- name: Fetch Sources
|
2023-09-05 06:17:09 +00:00
|
|
|
uses: actions/checkout@v4
|
2021-10-04 08:23:58 +00:00
|
|
|
|
2023-08-07 13:20:46 +00:00
|
|
|
# Set up Java environment for the next steps
|
2023-07-10 14:55:15 +00:00
|
|
|
- name: Setup Java
|
2023-11-30 06:30:47 +00:00
|
|
|
uses: actions/setup-java@v4
|
2023-07-10 14:55:15 +00:00
|
|
|
with:
|
|
|
|
distribution: zulu
|
|
|
|
java-version: 17
|
|
|
|
|
2023-01-13 20:34:46 +00:00
|
|
|
# Remove old release drafts by using the curl request for the available releases with a draft flag
|
2020-06-16 09:09:54 +00:00
|
|
|
- name: Remove Old Release Drafts
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
run: |
|
2021-08-26 14:48:38 +00:00
|
|
|
gh api repos/{owner}/{repo}/releases \
|
|
|
|
--jq '.[] | select(.draft == true) | .id' \
|
|
|
|
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
|
2020-06-17 05:19:59 +00:00
|
|
|
|
2023-01-13 20:34:46 +00:00
|
|
|
# Create a new release draft which is not publicly visible and requires manual acceptance
|
2020-06-16 09:09:54 +00:00
|
|
|
- name: Create Release Draft
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2021-08-26 14:48:38 +00:00
|
|
|
run: |
|
|
|
|
gh release create v${{ needs.build.outputs.version }} \
|
|
|
|
--draft \
|
|
|
|
--title "v${{ needs.build.outputs.version }}" \
|
2021-10-13 21:21:28 +00:00
|
|
|
--notes "$(cat << 'EOM'
|
|
|
|
${{ needs.build.outputs.changelog }}
|
|
|
|
EOM
|
|
|
|
)"
|