1name: Build 2 3# Requires: 4# 5# * A repository variable named REFERENCE_CHECKER_REPO with the name of the reference checker repo 6# within this fork of JSpecify. 7 8on: 9 push: 10 branches: [main, 'dev-*'] 11 paths-ignore: 12 - 'docs/**' 13 pull_request: 14 branches: [main, 'dev-*'] 15 paths-ignore: 16 - 'docs/**' 17 18defaults: 19 run: 20 shell: bash --noprofile --norc -e -o pipefail -x {0} 21 22jobs: 23 build: 24 name: JDK ${{ matrix.java_version }} 25 runs-on: ubuntu-latest 26 strategy: 27 matrix: 28 java_version: [11, 17, 21] 29 experimental: [false] 30 env: 31 JAVA_VERSION: ${{ matrix.java_version }} 32 continue-on-error: ${{ matrix.experimental }} 33 steps: 34 - uses: actions/checkout@v4 35 - uses: gradle/wrapper-validation-action@v3 36 - name: Set up JDK ${{ matrix.java_version }} 37 uses: actions/setup-java@v4 38 with: 39 distribution: temurin 40 java-version: ${{ matrix.java_version }} 41 cache: gradle 42 - run: | 43 ./gradlew spotlessCheck build publishToMavenLocal --no-daemon 44 45 publish-snapshot: 46 name: Publish Conformance Tests Snapshot 47 runs-on: ubuntu-latest 48 needs: build 49 if: github.repository == 'jspecify/jspecify' && github.ref_name == 'main' && github.event_name == 'push' 50 env: 51 JAVA_VERSION: 17 52 steps: 53 - name: Check out the code 54 uses: actions/checkout@v4 55 - name: Set up Java 56 uses: actions/setup-java@v4 57 with: 58 distribution: temurin 59 java-version: ${{ env.JAVA_VERSION }} 60 - name: Set up Gradle 61 uses: gradle/gradle-build-action@v3 62 - name: Publish conformance tests snapshot 63 run: ./gradlew publishConformanceTestsPublicationToSonatypeRepository 64 env: 65 ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.sonatype_username }} 66 ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.sonatype_password }} 67 68 reference-checker-tests: 69 name: Run Reference Checker Tests 70 runs-on: ubuntu-latest 71 env: 72 reference_checker_repo: ${{ vars.reference_checker_repo || 'jspecify-reference-checker' }} 73 JAVA_VERSION: 17 74 steps: 75 - name: Check out the code 76 uses: actions/checkout@v4 77 with: 78 path: jspecify 79 - name: Check out the reference checker 80 uses: actions/checkout@v4 81 with: 82 repository: ${{ github.repository_owner }}/${{ env.reference_checker_repo }} 83 path: ${{ env.reference_checker_repo }} 84 - name: Set up Java 85 uses: actions/setup-java@v4 86 with: 87 distribution: temurin 88 java-version: ${{ env.JAVA_VERSION }} 89 - name: Run Conformance Tests 90 if: github.base_ref == 'main' # only PRs onto main 91 continue-on-error: true 92 uses: gradle/gradle-build-action@v3 93 with: 94 arguments: conformanceTests 95 build-root-directory: ${{ env.reference_checker_repo }} 96 - name: Run Samples Tests 97 # only PRs onto samples-google-prototype 98 if: github.base_ref == 'samples-google-prototype' 99 continue-on-error: true 100 uses: gradle/gradle-build-action@v3 101 with: 102 arguments: jspecifySamplesTest 103 build-root-directory: ${{ env.reference_checker_repo }} 104