# https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Native Libraries

on:
    push:
        branches:
            - '*'
        tags:
            - '[0-9]*'
        paths:
            - 'flatlaf-natives/flatlaf-natives-windows/**'
            - '.github/workflows/natives.yml'
    pull_request:
        branches:
            - '*'
        paths:
            - 'flatlaf-natives/flatlaf-natives-windows/**'
            - '.github/workflows/natives.yml'

jobs:
    Windows:
        runs-on: windows-latest

        steps:
            - uses: actions/checkout@v2

            - uses: gradle/wrapper-validation-action@v1

            - name: Setup Java 1.8
              uses: actions/setup-java@v1
              with:
                  java-version: 1.8

            - name: Cache Gradle wrapper
              uses: actions/cache@v1
              with:
                  path: ~/.gradle/wrapper
                  key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}

            - name: Cache Gradle cache
              uses: actions/cache@v2
              with:
                  path: |
                    ~/.gradle/caches
                    !~/.gradle/caches/modules-2/modules-2.lock
                  key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
                  restore-keys: ${{ runner.os }}-gradle

            - name: Build with Gradle
              run: ./gradlew :flatlaf-natives-windows:build

            - name: Upload artifacts
              uses: actions/upload-artifact@v2
              with:
                  name: FlatLaf-natives-windows-build-artifacts
                  path: |
                      flatlaf-natives/flatlaf-natives-windows/build
