Skip to content

Commit 82a928d

Browse files
authored
Adding build workflows (#1)
* Adding build workflows * Not interested in kover and qodana for now
1 parent 5a33898 commit 82a928d

File tree

2 files changed

+167
-1
lines changed

2 files changed

+167
-1
lines changed

.github/workflows/build.yml

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# GitHub Actions Workflow is created for testing and preparing the plugin release in the following steps:
2+
# - Validate Gradle Wrapper.
3+
# - Run 'test' and 'verifyPlugin' tasks.
4+
# - Run Qodana inspections.
5+
# - Run the 'buildPlugin' task and prepare artifact for further tests.
6+
# - Run the 'runPluginVerifier' task.
7+
# - Create a draft release.
8+
#
9+
# The workflow is triggered on push and pull_request events.
10+
#
11+
# GitHub Actions reference: https://help.github.com/en/actions
12+
#
13+
## JBIJPPTPL
14+
15+
name: Build
16+
on:
17+
# Trigger the workflow on pushes to only the 'main' branch (this avoids duplicate checks being run e.g., for dependabot pull requests)
18+
push:
19+
branches: [ main ]
20+
# Trigger the workflow on any pull request
21+
pull_request:
22+
23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
25+
cancel-in-progress: true
26+
27+
jobs:
28+
29+
# Prepare environment and build the plugin
30+
build:
31+
name: Build
32+
runs-on: ubuntu-latest
33+
outputs:
34+
version: ${{ steps.properties.outputs.version }}
35+
changelog: ${{ steps.properties.outputs.changelog }}
36+
pluginVerifierHomeDir: ${{ steps.properties.outputs.pluginVerifierHomeDir }}
37+
steps:
38+
39+
# Check out the current repository
40+
- name: Fetch Sources
41+
uses: actions/checkout@v4
42+
43+
# Validate wrapper
44+
- name: Gradle Wrapper Validation
45+
uses: gradle/actions/wrapper-validation@v3
46+
47+
# Set up Java environment for the next steps
48+
- name: Setup Java
49+
uses: actions/setup-java@v4
50+
with:
51+
distribution: zulu
52+
java-version: 17
53+
54+
# Setup Gradle
55+
- name: Setup Gradle
56+
uses: gradle/actions/setup-gradle@v3
57+
with:
58+
gradle-home-cache-cleanup: true
59+
60+
# Build plugin
61+
- name: Build plugin
62+
run: ./gradlew buildPlugin
63+
64+
# Prepare plugin archive content for creating artifact
65+
- name: Prepare Plugin Artifact
66+
id: artifact
67+
shell: bash
68+
run: |
69+
cd ${{ github.workspace }}/build/distributions
70+
FILENAME=`ls *.zip`
71+
unzip "$FILENAME" -d content
72+
73+
echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT
74+
75+
# Store already-built plugin as an artifact for downloading
76+
- name: Upload artifact
77+
uses: actions/upload-artifact@v4
78+
with:
79+
name: ${{ steps.artifact.outputs.filename }}
80+
path: ./build/distributions/content/*/*
81+
82+
# Run tests and upload a code coverage report
83+
test:
84+
name: Test
85+
needs: [ build ]
86+
runs-on: ubuntu-latest
87+
steps:
88+
89+
# Check out the current repository
90+
- name: Fetch Sources
91+
uses: actions/checkout@v4
92+
93+
# Set up Java environment for the next steps
94+
- name: Setup Java
95+
uses: actions/setup-java@v4
96+
with:
97+
distribution: zulu
98+
java-version: 17
99+
100+
# Setup Gradle
101+
- name: Setup Gradle
102+
uses: gradle/actions/setup-gradle@v3
103+
with:
104+
gradle-home-cache-cleanup: true
105+
106+
# Run tests
107+
- name: Run Tests
108+
run: ./gradlew check
109+
110+
# Collect Tests Result of failed tests
111+
- name: Collect Tests Result
112+
if: ${{ failure() }}
113+
uses: actions/upload-artifact@v4
114+
with:
115+
name: tests-result
116+
path: ${{ github.workspace }}/build/reports/tests
117+
118+
# Run plugin structure verification along with IntelliJ Plugin Verifier
119+
verify:
120+
name: Verify plugin
121+
needs: [ build ]
122+
runs-on: ubuntu-latest
123+
steps:
124+
125+
# Free GitHub Actions Environment Disk Space
126+
- name: Maximize Build Space
127+
uses: jlumbroso/free-disk-space@main
128+
with:
129+
tool-cache: false
130+
large-packages: false
131+
132+
# Check out the current repository
133+
- name: Fetch Sources
134+
uses: actions/checkout@v4
135+
136+
# Set up Java environment for the next steps
137+
- name: Setup Java
138+
uses: actions/setup-java@v4
139+
with:
140+
distribution: zulu
141+
java-version: 17
142+
143+
# Setup Gradle
144+
- name: Setup Gradle
145+
uses: gradle/actions/setup-gradle@v3
146+
with:
147+
gradle-home-cache-cleanup: true
148+
149+
# Cache Plugin Verifier IDEs
150+
- name: Setup Plugin Verifier IDEs Cache
151+
uses: actions/cache@v4
152+
with:
153+
path: ${{ needs.build.outputs.pluginVerifierHomeDir }}/ides
154+
key: plugin-verifier-${{ hashFiles('build/listProductsReleases.txt') }}
155+
156+
# Run Verify Plugin task and IntelliJ Plugin Verifier tool
157+
- name: Run Plugin Verification tasks
158+
run: ./gradlew verifyPlugin -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
159+
160+
# Collect Plugin Verifier Result
161+
- name: Collect Plugin Verifier Result
162+
if: ${{ always() }}
163+
uses: actions/upload-artifact@v4
164+
with:
165+
name: pluginVerifier-result
166+
path: ${{ github.workspace }}/build/reports/pluginVerifier

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Running the publishPlugin task requires all following secrets to be provided: PUBLISH_TOKEN, PRIVATE_KEY, PRIVATE_KEY_PASSWORD, CERTIFICATE_CHAIN.
33
# See https://plugins.jetbrains.com/docs/intellij/plugin-signing.html for more information.
44

5-
name: Release
5+
name: Build Release
66
on:
77
push:
88
tags:

0 commit comments

Comments
 (0)