name: native backend CI

on:
  push:
    paths:
      - '!**'
      - '!**.md'
      - 'vlib/v/gen/native/'
      - 'cmd/tools/builders/**.v'
      - 'vlib/builtin/**.v'
      - 'vlib/v/ast/**.v'
      - 'vlib/v/scanner/**.v'
      - 'vlib/v/parser/**.v'
      - 'vlib/v/checker/**.v'
      - 'vlib/v/gen/c/**.v'
      - 'vlib/v/builder/**.v'
      - 'vlib/v/cflag/**.v'
      - 'vlib/v/live/**.v'
      - 'vlib/v/util/**.v'
      - 'vlib/v/markused/**.v'
      - 'vlib/v/preludes/**.v'
      - 'vlib/v/gen/native/**.v'
      - 'vlib/v/gen/native/tests/**.v'
      - '.github/workflows/native_backend_ci.yml'
  pull_request:
    paths:
      - '!**'
      - '!**.md'
      - 'vlib/v/gen/native/'
      - 'cmd/tools/builders/**.v'
      - 'vlib/builtin/**.v'
      - 'vlib/v/ast/**.v'
      - 'vlib/v/scanner/**.v'
      - 'vlib/v/parser/**.v'
      - 'vlib/v/checker/**.v'
      - 'vlib/v/gen/c/**.v'
      - 'vlib/v/builder/**.v'
      - 'vlib/v/cflag/**.v'
      - 'vlib/v/live/**.v'
      - 'vlib/v/util/**.v'
      - 'vlib/v/markused/**.v'
      - 'vlib/v/preludes/**.v'
      - 'vlib/v/gen/native/**.v'
      - 'vlib/v/gen/native/tests/**.v'
      - '.github/workflows/native_backend_ci.yml'

concurrency:
  group: native_backend-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }}
  cancel-in-progress: true

jobs:
  native-backend-ubuntu:
    runs-on: ubuntu-24.04
    env:
      VJOBS: 1
    steps:
      - uses: actions/checkout@v4
      - name: Build V
        run: make && ./v symlink
      - name: Install linker
        run: v retry -- sudo apt -qq install binutils
      - name: Rebuild V with -g, for better stacktraces on compiler panics
        run: v -g self
      - name: Run the native backend tests serially with more details
        run: v test vlib/v/gen/native/

  native-backend-windows:
    runs-on: windows-2022
    env:
      VJOBS: 1
    steps:
      - uses: actions/checkout@v4
      - name: Build V (Windows)
        run: ./make.bat && ./v symlink
      - name: Rebuild V with -g, for better stacktraces on compiler panics
        run: v -g self
      - name: Run the native backend tests serially with more details
        run: v test vlib/v/gen/native/
