Skip to content

Dependency submission CI #31

Dependency submission CI

Dependency submission CI #31

Workflow file for this run

name: CI tests
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
# Basic sanity tests on JDK 21.
sanity:
name: ${{ matrix.script }} on JDK ${{ matrix.java_version }}
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
script: ['cftests-junit', 'cftests-nonjunit']
java_version: [21]
env:
JAVA_VERSION: ${{ matrix.java_version }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java_version }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java_version }}
distribution: 'temurin'
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/[email protected]
- name: Run test script checker/bin-devel/test-${{ matrix.script }}
run: ./checker/bin-devel/test-${{ matrix.script }}.sh
# The remaining tests for JDK 21. Separate from `sanity` to allow parallelism with `otheros`.
remainder:
name: ${{ matrix.script }} on JDK ${{ matrix.java_version }}
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
# No need to run 'cftests-junit-jdk21' on JDK 21.
script: ['typecheck-part1', 'typecheck-part2', 'guava', 'plume-lib', 'jspecify-conformance']
java_version: [21]
env:
JAVA_VERSION: ${{ matrix.java_version }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java_version }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java_version }}
distribution: 'temurin'
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/[email protected]
- name: Run test script checker/bin-devel/test-${{ matrix.script }}
run: ./checker/bin-devel/test-${{ matrix.script }}.sh
otherjdks:
name: ${{ matrix.script }} on JDK ${{ matrix.java.version }}
runs-on: ubuntu-latest
needs: remainder
permissions:
contents: read
strategy:
fail-fast: false
matrix:
# jspecify-conformance only tested on JDK 21.
script: ['cftests-junit', 'cftests-nonjunit', 'cftests-junit-jdk21', 'typecheck-part1', 'typecheck-part2', 'guava', 'plume-lib']
# JDK 21 used by sanity before
java: [{version: '8', experimental: false},
{version: '11', experimental: false},
{version: '17', experimental: false},
{version: '22', experimental: true},
{version: '23-ea', experimental: true},
{version: '24-ea', experimental: true}]
env:
JAVA_VERSION: ${{ matrix.java.version }}
continue-on-error: ${{ matrix.java.experimental }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java.version }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java.version }}
distribution: 'temurin'
- name: Set up JDK 21 on an experimental platform
if: matrix.java.experimental
uses: actions/setup-java@v4
with:
# Install JDK 21 second, to make it the default on which gradle runs.
# This unfortunately also means that all tests run on JDK 21 instead of the newer version.
java-version: 21
distribution: 'temurin'
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/[email protected]
- name: Run test script checker/bin-devel/test-${{ matrix.script }}
run: ./checker/bin-devel/test-${{ matrix.script }}.sh
# TODO: it would be nicer to not run the job at all, but GH Actions does
# not allow accessing the matrix on the job-if clause. There is also no way
# for an earlier step to stop execution successfully.
#
# At least one plume-lib project no longer works on Java 8.
# Java 8 does not allow toolchains, so testing 'cftests-junit-jdk21' is unnecessary.
if: matrix.java.version != 8 || (matrix.script != 'plume-lib' && matrix.script != 'cftests-junit-jdk21')
# Set the compiler version to use, allowing us to e.g. run Java 23 while gradle does not work
# on Java 23 yet. This only tests the compiler, it does not use that version to run the tests.
env:
ORG_GRADLE_PROJECT_useJdkCompiler: ${{ matrix.java.version }}
# Sanity tests on Windows and MacOS.
otheros:
name: ${{ matrix.script }} on JDK ${{ matrix.java_version }} on ${{ matrix.os }}
runs-on: "${{ matrix.os }}"
needs: sanity
permissions:
contents: read
strategy:
matrix:
os: ['windows-latest', 'macos-latest']
script: ['cftests-junit']
java_version: [21]
env:
JAVA_VERSION: ${{ matrix.java_version }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java_version }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java_version }}
distribution: 'temurin'
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/[email protected]
- name: Install coreutils on MacOS
if: matrix.os == 'macos-latest'
run: brew install coreutils
- name: Run test script checker/bin-devel/test-${{ matrix.script }}
shell: bash
run: ./checker/bin-devel/test-${{ matrix.script }}.sh
dependency-submission:
runs-on: ubuntu-latest
permissions:
contents: write
# Only run on the main repository because forks do not have write access to the main repository.
if: github.event.pull_request.head.repo.fork == false
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md
- name: Generate and submit dependency graph
uses: gradle/actions/[email protected]