name: Build

on:
  push:
    branches: [master, main]
    tags:
      - "*"
  pull_request:
    branches: [master, main]

jobs:
  windows:
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v4
      - name: Build
        run: |
          cmake -B ${{github.workspace}}/Analyzer/raw/PulseLengthStat/build -S ${{github.workspace}}/Analyzer/raw/PulseLengthStat -A x64
          cmake --build ${{github.workspace}}/Analyzer/raw/PulseLengthStat/build --config Release
      - uses: actions/upload-artifact@v4
        with:
          name: windows
          path: ${{github.workspace}}/Analyzer/raw/dll/*.dll

  macos:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v4
      - name: Build
        run: |
          cmake -B ${{github.workspace}}/Analyzer/raw/PulseLengthStat/build -S ${{github.workspace}}/Analyzer/raw/PulseLengthStat -DCMAKE_BUILD_TYPE=Release
          cmake --build ${{github.workspace}}/Analyzer/raw/PulseLengthStat/build
      - uses: actions/upload-artifact@v4
        with:
          name: macos
          path: ${{github.workspace}}/Analyzer/raw/dll/*.so

  linux:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Build
        run: |
          cmake -B ${{github.workspace}}/Analyzer/raw/PulseLengthStat/build -S ${{github.workspace}}/Analyzer/raw/PulseLengthStat -DCMAKE_BUILD_TYPE=Release
          cmake --build ${{github.workspace}}/Analyzer/raw/PulseLengthStat/build
        env:
          CC: gcc-10
          CXX: g++-10
      - uses: actions/upload-artifact@v4
        with:
          name: linux
          path: ${{github.workspace}}/Analyzer/raw/dll/*.so
