name: macOS

on: 
  pull_request:
  push:
    branches: main

jobs:
  build:
    strategy:
      fail-fast: false

    runs-on: macos-latest

    concurrency:
        group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-macOS
        cancel-in-progress: true

    steps:
      - uses: actions/checkout@v1
      - uses: xmake-io/github-action-setup-xmake@v1
        with:
          xmake-version: branch@master

      - name: Prepare XMake
        run: xmake f -p macosx -y

      - name: Build
        run: xmake

      - name: Test
        run: xmake test
