Skip to content

Commit

Permalink
feat: update build
Browse files Browse the repository at this point in the history
  • Loading branch information
cvette committed Jul 20, 2023
1 parent fc0e69c commit 86bde95
Show file tree
Hide file tree
Showing 11 changed files with 222 additions and 41 deletions.
149 changes: 120 additions & 29 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
outputs:
version: ${{ steps.properties.outputs.version }}
changelog: ${{ steps.properties.outputs.changelog }}
pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }}
steps:
# Free GitHub Actions Environment Disk Space
- name: Maximize Build Space
Expand All @@ -53,7 +54,10 @@ jobs:
with:
distribution: zulu
java-version: 17
cache: gradle

# Setup Gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

# Set environment variables
- name: Export Properties
Expand All @@ -62,11 +66,9 @@ jobs:
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
NAME="$(echo "$PROPERTIES" | grep "^pluginName:" | cut -f2- -d ' ')"
CHANGELOG="$(./gradlew getChangelog --unreleased --no-header --console=plain -q)"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "name=$NAME" >> $GITHUB_OUTPUT
echo "pluginVerifierHomeDir=~/.pluginVerifier" >> $GITHUB_OUTPUT
echo "changelog<<EOF" >> $GITHUB_OUTPUT
Expand All @@ -75,9 +77,53 @@ jobs:
./gradlew listProductsReleases # prepare list of IDEs for Plugin Verifier
# 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
needs: [ build ]
runs-on: ubuntu-latest
steps:

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3

# Setup Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17

# Setup Gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

# Run tests
- name: Run Tests
run: ./gradlew test
run: ./gradlew check

# Collect Tests Result of failed tests
- name: Collect Tests Result
Expand All @@ -87,16 +133,72 @@ jobs:
name: tests-result
path: ${{ github.workspace }}/build/reports/tests

# Upload Kover report to CodeCov
- name: Upload Code Coverage Report
uses: codecov/codecov-action@v3
with:
files: ${{ github.workspace }}/build/reports/kover/xml/report.xml

# 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:

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3

# Setup Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17

# Run Qodana inspections
- name: Qodana - Code Inspection
uses: JetBrains/[email protected]
with:
cache-default-branch-only: true

# Run plugin structure verification along with IntelliJ Plugin Verifier
verify:
name: Verify plugin
needs: [ build, test, inspectCode ]
runs-on: ubuntu-latest
steps:

# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v3

# Setup Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17

# Setup Gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

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

# Run Verify Plugin task and IntelliJ Plugin Verifier tool
- name: Run Plugin Verification tasks
run: ./gradlew runPluginVerifier -Pplugin.verifier.home.dir=${{ steps.properties.outputs.pluginVerifierHomeDir }}
run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}

# Collect Plugin Verifier Result
- name: Collect Plugin Verifier Result
Expand All @@ -106,30 +208,12 @@ jobs:
name: pluginVerifier-result
path: ${{ github.workspace }}/build/reports/pluginVerifier

# 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/*/*

# Prepare a draft release for GitHub Releases page for the manual verification
# If accepted and published, release workflow would be triggered
releaseDraft:
name: Release Draft
name: Release draft
if: github.event_name != 'pull_request'
needs: build
needs: [ build, verify ]
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -139,7 +223,14 @@ jobs:
- name: Fetch Sources
uses: actions/checkout@v3

# Remove old release drafts by using the curl request for the available releases with draft flag
# Setup Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17

# Remove old release drafts by using the curl request for the available releases with a draft flag
- name: Remove Old Release Drafts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -148,7 +239,7 @@ jobs:
--jq '.[] | select(.draft == true) | .id' \
| xargs -I '{}' gh api -X DELETE repos/{owner}/{repo}/releases/{}
# Create new release draft - which is not publicly visible and requires manual acceptance
# Create a new release draft which is not publicly visible and requires manual acceptance
- name: Create Release Draft
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -159,4 +250,4 @@ jobs:
--notes "$(cat << 'EOM'
${{ needs.build.outputs.changelog }}
EOM
)"
)"
24 changes: 18 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# GitHub Actions Workflow created for handling the release process based on the draft release prepared
# with the Build workflow. Running the publishPlugin task requires the PUBLISH_TOKEN secret provided.
# GitHub Actions Workflow created for handling the release process based on the draft release prepared with the Build workflow.
# Running the publishPlugin task requires all following secrets to be provided: PUBLISH_TOKEN, PRIVATE_KEY, PRIVATE_KEY_PASSWORD, CERTIFICATE_CHAIN.
# See https://plugins.jetbrains.com/docs/intellij/plugin-signing.html for more information.

name: Release
on:
Expand All @@ -23,13 +24,16 @@ jobs:
with:
ref: ${{ github.event.release.tag_name }}

# Setup Java 17 environment for the next steps
# Setup Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17
cache: gradle

# Setup Gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

# Set environment variables
- name: Export Properties
Expand Down Expand Up @@ -57,6 +61,9 @@ jobs:
- name: Publish Plugin
env:
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }}
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }}
run: ./gradlew publishPlugin

# Upload artifact as a release asset
Expand All @@ -73,16 +80,21 @@ jobs:
run: |
VERSION="${{ github.event.release.tag_name }}"
BRANCH="changelog-update-$VERSION"
LABEL="release changelog"
git config user.email "[email protected]"
git config user.name "GitHub Action"
git checkout -b $BRANCH
git commit -am "Changelog update - $VERSION"
git push --set-upstream origin $BRANCH
gh label create "$LABEL" \
--description "Pull requests with release changelog update" \
|| true
gh pr create \
--title "Changelog update - \`$VERSION\`" \
--body "Current pull request contains patched \`CHANGELOG.md\` file for the \`$VERSION\` version." \
--base main \
--head $BRANCH
--label "$LABEL" \
--head $BRANCH
7 changes: 5 additions & 2 deletions .github/workflows/run-ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,16 @@ jobs:
- name: Fetch Sources
uses: actions/checkout@v3

# Setup Java 17 environment for the next steps
# Setup Java environment for the next steps
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17
cache: gradle

# Setup Gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

# Run IDEA prepared for UI testing
- name: Run IDE
Expand Down
25 changes: 25 additions & 0 deletions .run/Run IDE for UI Tests.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run IDE for UI Tests" type="GradleRunConfiguration" factoryName="Gradle">
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" />
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="runIdeForUiTests" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
File renamed without changes.
30 changes: 30 additions & 0 deletions .run/Run Qodana.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Qodana" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="env">
<map>
<entry key="QODANA_SHOW_REPORT" value="true" />
</map>
</option>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="cleanInspections" />
<option value="runInspections" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
</component>
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ pluginSinceBuild = 223
pluginUntilBuild = 232.*

platformType = IU
platformVersion = 2022.3
platformVersion = 2023.1.1
platformDownloadSources = true

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22IntelliLang
platformPlugins = org.intellij.intelliLang,com.intellij.css,com.jetbrains.hackathon.indices.viewer:1.23,PsiViewer:223-SNAPSHOT,yaml,java,java-i18n,properties,com.jetbrains.php:223.7571.182
platformPlugins = org.intellij.intelliLang,com.intellij.css,com.jetbrains.hackathon.indices.viewer:1.23,PsiViewer:231-SNAPSHOT,yaml,java,java-i18n,properties,com.jetbrains.php:231.8770.68
grammarKitVersion = 2022.3.1
jFlexVersion = 1.9.0

javaVersion = 17

gradleVersion = 8.0.2
gradleVersion = 8.2.1

# Opt-out flag for bundling Kotlin standard library.
# See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details.
Expand Down
Loading

0 comments on commit 86bde95

Please sign in to comment.