
# Workaround for https://status.dev.azure.com/_event/179641421
trigger:
  branches:
    include:
    - '*'
pr:
  branches:
    include:
    - '*'

variables:
  system.debug: true

jobs:

# The dependsOn clauses are:
#  * Everything depends on the canary jobs (the main jdk21 jobs), except those jobs themselves.
#  * Anything *_jdk11 or *_jdk17 or *_jdk23 depends on *_jdk21.

- job: canary_jobs
  dependsOn:
   - junit_jdk21
   - nonjunit_jdk21
   - inference_part1_jdk21
   - inference_part2_jdk21
   - typecheck_part1_jdk21
   - typecheck_part2_jdk21
   - misc_jdk21
   - misc_jdk23
  pool:
    vmImage: 'ubuntu-latest'
  steps:
  - bash: true
    displayName: canary_jobs

- job: junit_jdk21
  pool:
    vmImage: 'ubuntu-latest'
  container: mdernst/cf-ubuntu-jdk21:latest
  timeoutInMinutes: 70
  steps:
  - checkout: self
    fetchDepth: 25
  - bash: ./checker/bin-devel/test-cftests-junit.sh
    displayName: test-cftests-junit.sh

- job: nonjunit_jdk21
  pool:
    vmImage: 'ubuntu-latest'
  container: mdernst/cf-ubuntu-jdk21:latest
  steps:
  - checkout: self
    fetchDepth: 25
  - bash: ./checker/bin-devel/test-cftests-nonjunit.sh
    displayName: test-cftests-nonjunit.sh

# Sometimes one of the invocations of wpi-many in `./gradlew wpiManyTest`
# takes much longer to complete than normal, and this Azure job times out.
# When there is a timeout, one cannot examine wpi or wpi-many logs.
# So use a timeout of 90 minutes, and hope that is enough.
# Split into part1 and part2 only for the inference job that "canary_jobs" depends on.
- job: inference_part1_jdk21
  pool:
    vmImage: 'ubuntu-latest'
  container: mdernst/cf-ubuntu-jdk21:latest
  timeoutInMinutes: 90
  steps:
  - checkout: self
    fetchDepth: 25
  - bash: ./checker/bin-devel/test-cftests-inference-part1.sh
    displayName: test-cftests-inference-part1.sh
- job: inference_part2_jdk21
  pool:
    vmImage: 'ubuntu-latest'
  container: mdernst/cf-ubuntu-jdk21:latest
  timeoutInMinutes: 90
  steps:
  - checkout: self
    fetchDepth: 25
  - bash: ./checker/bin-devel/test-cftests-inference-part2.sh
    displayName: test-cftests-inference-part2.sh


# Unlimited fetchDepth for misc_jobs, because of need to make contributors.tex
- job: misc_jdk11
  dependsOn:
   - canary_jobs
   - misc_jdk21
  pool:
    vmImage: 'ubuntu-latest'
  container: mdernst/cf-ubuntu-jdk11-plus:latest
  steps:
  - checkout: self
  - bash: ./checker/bin-devel/test-misc.sh
    displayName: test-misc.sh
- job: misc_jdk17
  dependsOn:
   - canary_jobs
   - misc_jdk21
  pool:
    vmImage: 'ubuntu-latest'
  container: mdernst/cf-ubuntu-jdk17-plus:latest
  steps:
  - checkout: self
  - bash: ./checker/bin-devel/test-misc.sh
    displayName: test-misc.sh
- job: misc_jdk21
  pool:
    vmImage: 'ubuntu-latest'
  container: mdernst/cf-ubuntu-jdk21-plus:latest
  steps:
  - checkout: self
  - bash: ./checker/bin-devel/test-misc.sh
    displayName: test-misc.sh
- job: misc_jdk23
  pool:
    vmImage: 'ubuntu-latest'
  container: mdernst/cf-ubuntu-jdk23-plus:latest
  steps:
  - checkout: self
  - bash: ./checker/bin-devel/test-misc.sh
    displayName: test-misc.sh

- job: typecheck_part1_jdk21
  pool:
    vmImage: 'ubuntu-latest'
  container: mdernst/cf-ubuntu-jdk21-plus:latest
  steps:
  - checkout: self
    fetchDepth: 1000
  - bash: ./checker/bin-devel/test-typecheck-part1.sh
    displayName: test-typecheck-part1.sh
- job: typecheck_part2_jdk21
  pool:
    vmImage: 'ubuntu-latest'
  container: mdernst/cf-ubuntu-jdk21-plus:latest
  steps:
  - checkout: self
    fetchDepth: 1000
  - bash: ./checker/bin-devel/test-typecheck-part2.sh
    displayName: test-typecheck-part2.sh

- job: daikon_part1_jdk21
  dependsOn:
   - canary_jobs
  pool:
    vmImage: 'ubuntu-latest'
  container: mdernst/cf-ubuntu-jdk21:latest
  timeoutInMinutes: 70
  steps:
  - checkout: self
    fetchDepth: 25
  - bash: ./checker/bin-devel/test-daikon-part1.sh
    displayName: test-daikon.sh
- job: daikon_part2_jdk21
  dependsOn:
   - canary_jobs
  pool:
    vmImage: 'ubuntu-latest'
  container: mdernst/cf-ubuntu-jdk21:latest
  timeoutInMinutes: 80
  steps:
  - checkout: self
    fetchDepth: 25
  - bash: ./checker/bin-devel/test-daikon.sh
    displayName: test-daikon-part2.sh

## I'm not sure why the guava_jdk11 job is failing (it's due to Error Prone).
- job: guava_jdk21
  dependsOn:
   - canary_jobs
  pool:
    vmImage: 'ubuntu-latest'
  container: mdernst/cf-ubuntu-jdk21:latest
  timeoutInMinutes: 70
  steps:
  - checkout: self
    fetchDepth: 25
  - bash: ./checker/bin-devel/test-guava.sh
    displayName: test-guava.sh

- job: plume_lib_jdk21
  dependsOn:
   - canary_jobs
  pool:
    vmImage: 'ubuntu-latest'
  container: mdernst/cf-ubuntu-jdk21:latest
  steps:
  - checkout: self
    fetchDepth: 25
  - bash: ./checker/bin-devel/test-plume-lib.sh
    displayName: test-plume-lib.sh

## The downstream jobs are not currently needed because test-downstream.sh is empty.
# - job: downstream_jdk11
#   dependsOn:
#    - canary_jobs
#    - downstream_jdk21
#   pool:
#     vmImage: 'ubuntu-latest'
#   container: mdernst/cf-ubuntu-jdk11:latest
#   steps:
#   - checkout: self
#     fetchDepth: 25
#   - bash: ./checker/bin-devel/test-downstream.sh
#     displayName: test-downstream.sh
# - job: downstream_jdk17
#   dependsOn:
#    - canary_jobs
#    - downstream_jdk21
#   pool:
#     vmImage: 'ubuntu-latest'
#   container: mdernst/cf-ubuntu-jdk17:latest
#   steps:
#   - checkout: self
#     fetchDepth: 25
#   - bash: ./checker/bin-devel/test-downstream.sh
#     displayName: test-downstream.sh
# - job: downstream_jdk21
#   dependsOn:
#    - canary_jobs
#   pool:
#     vmImage: 'ubuntu-latest'
#   container: mdernst/cf-ubuntu-jdk21:latest
#   steps:
#   - checkout: self
#     fetchDepth: 25
#   - bash: ./checker/bin-devel/test-downstream.sh
#     displayName: test-downstream.sh
# - job: downstream_jdk23
#   dependsOn:
#    - canary_jobs
#    - downstream_jdk21
#   pool:
#     vmImage: 'ubuntu-latest'
#   container: mdernst/cf-ubuntu-jdk23:latest
#   steps:
#   - checkout: self
#     fetchDepth: 25
#   - bash: ./checker/bin-devel/test-downstream.sh
#     displayName: test-downstream.sh

