update deprecated upload artifact action (#176) #282
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@v4 | |
- run: ./hack/check-license.sh | |
check-gradle-wrapper: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: gradle/[email protected] | |
build: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
needs: check-gradle-wrapper | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: corretto | |
# Setup Gradle | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
gradle-home-cache-cleanup: true | |
- name: Download OPA | |
run: | | |
OPA_VERSION=v0.61.0 | |
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@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: corretto | |
# Setup Gradle | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
gradle-home-cache-cleanup: true | |
- uses: actions/cache@v2 | |
with: | |
path: ~/.pluginVerifier/ides | |
key: ${{ runner.os }}-plugin-verifier-ides | |
- name: Verify plugin binary compatibility | |
run: ./gradlew :plugin:runPluginVerifier | |
# This job is successful if all dependent 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 |