name: Build

on: [ push, pull_request ]

jobs:
  build-mirai-core:

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Set up JDK 1.8
        uses: actions/setup-java@v1
        with:
          java-version: 1.8

      - name: chmod -R 777 *
        run: chmod -R 777 *

      - name: Init gradle project
        run: ./gradlew clean --scan

      - name: Build mirai-core series
        run: ./gradlew assemble --scan

      - name: mirai-core Tests
        run: ./gradlew check --scan

  build-all:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2

      - name: Checkout submodules
        run: git submodule update --init --recursive --remote

      - name: Set up JDK 1.8
        uses: actions/setup-java@v1
        with:
          java-version: 1.8

      - name: chmod -R 777 *
        run: chmod -R 777 *

      - name: Init gradle project
        run: ./gradlew clean --scan

      - name: Build all
        run: ./gradlew assemble --scan

      - name: All Tests
        run: ./gradlew check --scan
