-
Notifications
You must be signed in to change notification settings - Fork 22
101 lines (87 loc) · 3.04 KB
/
pr.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
# GitHub Action Workflow for building a pull request commit and validating that the commit builds for all
# release versions of the plugin.
#
# Workflow is triggered on pull requests to the repo.
#
# Additional Docs:
# - GitHub Actions: https://help.github.com/en/actions
name: build-pr
on:
pull_request:
paths-ignore:
- '*.md'
jobs:
# Run Gradle Wrapper Validation Action to verify the wrapper's checksum
gradleValidation:
name: Gradle Wrapper
runs-on: ubuntu-latest
steps:
# Check out current repository
- name: Fetch sources
uses: actions/checkout@v2
# Validate wrapper
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1
# Build and test plugin and provide artifact.
build:
name: Build
needs: gradleValidation
runs-on: ubuntu-latest
strategy:
matrix:
product: [ "IC-2023.1", "IC-2023.2", "IC-2023.3", "IC-2024.1" ]
max-parallel: 5
env:
PRODUCT_NAME: ${{ matrix.product }}
outputs:
name: ${{ steps.properties.outputs.name }}
version: ${{ steps.properties.outputs.version }}
artifact: ${{ steps.properties.outputs.artifact }}
steps:
# Check out current repository
- name: Fetch Sources
uses: actions/checkout@v2
- name: Setup JDK
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'
# 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') }}
# 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') }}
# Set environment variables
- name: Export Properties
id: properties
shell: bash
run: |
PROPERTIES="$(./gradlew properties --console=plain -q)"
VERSION="$(echo "$PROPERTIES" | grep "^version:" | cut -f2- -d ' ')"
NAME="$(echo "$PROPERTIES" | grep "^pluginName_:" | cut -f2- -d ' ')"
ARTIFACT="${NAME}-${VERSION}.zip"
echo "::set-output name=version::$VERSION"
echo "::set-output name=name::$NAME"
echo "::set-output name=artifact::$ARTIFACT"
# Build artifact using build Gradle task
- name: Build
run: ./gradlew build
# Build artifact using buildPlugin Gradle task
- name: Build Plugin
run: ./gradlew buildPlugin
# Run intellij:verifyPlugin task.
- name: Verify Plugin
run: ./gradlew verifyPlugin
# Upload plugin artifact to make it available in the next jobs
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.product }}-plugin-artifact
path: ./build/distributions/${{ needs.build.outputs.artifact }}