-
-
Notifications
You must be signed in to change notification settings - Fork 6
159 lines (138 loc) · 4.65 KB
/
build_plugin.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: Build Plugin
on:
push:
branches:
- main
pull_request:
jobs:
# Run Gradle Wrapper Validation Action to verify the wrapper's checksum
gradleValidation:
name: Gradle Wrapper
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Validate wrapper
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1
# Run verifyPlugin and test Gradle tasks
test:
name: Test
needs: gradleValidation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Verify no java files committed. Note this is run before any gen/* files are created
- name: Verify Kotlin Source Files Only
run: |
javafiles=(`find src -iname *.java`)
if [ ${#javafiles[@]} -gt 0 ]
then
echo "ERROR: Detected a java file in the committed source code! Only kotlin files are allowed." >&2
printf '%s\n' "${javafiles[@]}" 1>&2
exit 1
fi
echo "SUCCESS: No java files detected in the committed source code"
# Setup Java 17 environment for the next steps
- name: Setup Java 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
cache: gradle
# Cache Gradle dependencies
- name: Setup Cache
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }}
# Cache Gradle Wrapper
- name: Setup Gradle Wrapper Cache
uses: actions/cache@v2
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
# Run EditorConfig Linter
- name: Run EditorConfig Linter
uses: editorconfig-checker/action-editorconfig-checker@main
# Run ktlint
- name: Run KtLinter
run: ./gradlew ktlintCheck
# Run test Gradle task
- name: Run Tests
run: ./gradlew test
# Verify code coverage
- name: Check Code Coverage
run: ./gradlew jacocoTestCoverageVerification
# Run verifyPlugin Gradle task
- name: Verify Plugin
run: ./gradlew verifyPlugin
# Build plugin with buildPlugin Gradle task and provide the artifact for the next workflow jobs
# Requires test job to be passed
build:
name: Build
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
cache: gradle
# Cache Gradle Dependencies
- name: Setup Gradle Dependencies Cache
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle', '**/*.gradle.kts', 'gradle.properties') }}
# Cache Gradle Wrapper
- name: Setup Gradle Wrapper Cache
uses: actions/cache@v2
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
# Build artifact using buildPlugin Gradle task
- name: Build Plugin
run: ./gradlew buildPlugin
# Upload plugin artifact to make it available in the next jobs
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: plugin-artifact
path: ./build/distributions
# Verify built plugin using IntelliJ Plugin Verifier tool
# Requires build job to be passed
verify:
name: Verify
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout "ide-versions" File for the Verifier Action to Use
uses: actions/checkout@v2
# Download plugin artifact provided by the previous job.
# This will auto-extract zip contents into the current directory
- name: Download Artifact
uses: actions/download-artifact@v2
with:
name: plugin-artifact
# Run IntelliJ Plugin Verifier action using GitHub Action
- name: Verify Plugin Compatibility
id: verify
uses: ChrisCarini/intellij-platform-plugin-verifier-action@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
plugin-location: '*.zip'
# NOTE: For ide-versions, we just need to verify IJ community & one non-IJ IDE.
ide-versions: .github/workflows/ide_versions_to_verify.txt
failure-levels: |
COMPATIBILITY_WARNINGS
COMPATIBILITY_PROBLEMS
DEPRECATED_API_USAGES
INTERNAL_API_USAGES
OVERRIDE_ONLY_API_USAGES
NON_EXTENDABLE_API_USAGES
PLUGIN_STRUCTURE_WARNINGS
MISSING_DEPENDENCIES
INVALID_PLUGIN
NOT_DYNAMIC