name: CI

on:
  push:
    branches:
      - master
      - 'v*'
  pull_request: {}
  schedule:
    - cron:  '0 3 * * *' # daily, at 3am

jobs:
  test:
    name: Tests
    runs-on: ${{ matrix.os }}

    strategy:
       matrix:
         os: [ubuntu-latest, windows-latest]

    steps:
      - uses: actions/checkout@v1
        with:
          submodules: true

      - uses: actions/setup-java@v1
        with:
          java-version: '1.8'

      - uses: actions/cache@v1
        with:
          path: ~/.gradle/caches
          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
          restore-keys: |
            ${{ runner.os }}-gradle-

      - run: ./gradlew assemble
      - run: ./gradlew check
