name: "PR Examples Build"

on:
  pull_request:
    branches:
      - main
    paths:
      - 'examples/**'
jobs:
  build:
    name: Build
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os:
          - macos-latest
          - ubuntu-18.04
    steps:
      - uses: actions/checkout@v2.3.4
      - id: setup-java-11
        name: Setup Java 11
        uses: actions/setup-java@v2
        with:
          distribution: adopt
          java-version: 11
      - uses: burrunan/gradle-cache-action@v1.10
        with:
          remote-build-cache-proxy-enabled: false
          arguments: clean check shadowJar
          build-root-directory: examples
      - run: java -cp examples/sdk-usage/build/libs/opentelemetry-examples-sdk-usage-0.1.0-SNAPSHOT-all.jar io.opentelemetry.sdk.example.ConfigureSpanProcessorExample
