-
Notifications
You must be signed in to change notification settings - Fork 125
85 lines (73 loc) · 2.54 KB
/
build.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
name: Build + SonarCloud Analysis
on:
push:
branches:
- master
- release/**
- sonar/**
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Analyse with SonarCloud
runs-on: ubuntu-latest
if: (github.actor != 'dependabot[bot]')
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
# Validate wrapper
- name: Gradle Wrapper Validation
uses: gradle/[email protected]
- name: Setup Java 17
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17
cache: gradle
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle
- name: Build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew listProductsReleases buildPlugin
- name: Test and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew jacocoTestReport sonar --info
# 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@v4
with:
name: ${{ steps.artifact.outputs.filename }}
path: ./build/distributions/content/*/*
- name: Cleanup Cache
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -fr ~/.gradle/caches/*/plugin-resolution/
rm -fr ~/.gradle/caches/modules-2/files-*/com.jetbrains.intellij.idea/
rm -fr ~/.gradle/caches/modules-2/metadata-*/descriptors/com.jetbrains.intellij.idea/