-
Notifications
You must be signed in to change notification settings - Fork 23
118 lines (101 loc) · 3.08 KB
/
test.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
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: test
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
paths-ignore: [ CHANGELOG.md ]
jobs:
check-license:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: ./hack/check-license.sh
check-gradle-wrapper:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
build:
strategy:
fail-fast: false
timeout-minutes: 60
runs-on: ubuntu-latest
needs: check-gradle-wrapper
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: corretto
# Cache gradle dependencies
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Download OPA
run: |
OPA_VERSION=v0.47.4
mkdir -p /tmp/opa_bin
curl -L -o /tmp/opa_bin/opa https://github.com/open-policy-agent/opa/releases/download/$OPA_VERSION/opa_linux_amd64
chmod +x /tmp/opa_bin/opa
- name: Build and test
run: |
export PATH=/tmp/opa_bin:$PATH
./gradlew :test
- name: Verify plugin.xml
run: ./gradlew :plugin:verifyPlugin
verify:
timeout-minutes: 60
runs-on: ubuntu-latest
needs: [check-gradle-wrapper, build ]
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: corretto
# Cache gradle dependencies
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/cache@v2
with:
path: ~/.pluginVerifier/ides
key: ${{ runner.os }}-plugin-verifier-ides
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Verify plugin binany compatibility
run: ./gradlew :plugin:runPluginVerifier
# This job is successful if all depend jobs are successful. To be able to merge the PR, this job must be successful
all-checks:
needs: [build, check-license, check-gradle-wrapper, verify]
runs-on: ubuntu-latest
if: ${{ always() }}
env:
NEEDS_CONTEXT: ${{ toJson(needs) }}
steps:
- name: Finish check
run: |
if jq -r '.[] | .result ' <<<"${NEEDS_CONTEXT}" | grep -iq failure ; then
echo "Error some check are failed"
exit 1
else
echo "All checks ok"
exit 0
fi