name: native backend CI

on:
  push:
    paths-ignore:
      - "**.md"
  pull_request:
    paths-ignore:
      - "**.md"

concurrency:
  group: native-backend-ci-${{ github.event.pull_request.number || github.sha }}
  cancel-in-progress: true

jobs:
  native-backend:
    strategy:
      matrix:
        os: [ubuntu-18.04, ubuntu-20.04, macos-10.15, macos-11, macos-12, windows-2016, windows-2019, windows-2022]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v2

      - name: Build V with make.bat
        if: ${{ startsWith(matrix.os, 'windows') }}
        run: |
          .\make.bat
          .\v.exe symlink -githubci
      - name: Build V with make
        if: ${{ !startsWith(matrix.os, 'windows') }}
        run: |
          make
          ./v symlink -githubci

      - name: Test the native backend
        run: v test vlib/v/gen/native/
