name: Build
on:
  push:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-18.04
    steps:
      - uses:   actions/checkout@v2.3.4
        with:
          repository: openrndr/openrndr
          path: ./openrndr
          ref: master
      - uses: actions/checkout@v2.3.4
        with:
          path: orx
      - uses: actions/setup-java@v2
        with:
          distribution: 'adopt'
          java-version: '16'
      - uses: actions/cache@v2
        with:
          path: |
            ~/.gradle/caches
            ~/.gradle/wrapper
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
          restore-keys: |
            ${{ runner.os }}-gradle-

      - name: Build OPENRNDR snapshot
        run: |
          cd ./openrndr
          ./gradlew publishToMavenLocal -Prelease.version=0.5.1-SNAPSHOT
          cd ..
      - name: Build ORX
        run: |
          cd ./orx
          ./gradlew build
