try to fix cd #259
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |