name: C/C++ CI

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

jobs:
  windows:
    name: Windows Build
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@v3
    - name: configure
      run: |
        ./premake5.exe vs2022
    - uses: ilammy/msvc-dev-cmd@v1.12.1
    - name: compile 
      run: | 
        msbuild 8085_emulator.sln /p:Configuration=Dist
    - name: upload executable
      uses: actions/upload-artifact@v3.1.2
      with:
        name: 8085sim-window.exe
        path: Binaries/Windows/8085sim.exe
  linux:
    name: Linux Build
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3
    - name: install dependencies
      run: sudo apt-get update && sudo apt-get install -y g++ libxi-dev libgl-dev libxcursor-dev libxrandr-dev libxinerama-dev
    - name: configure
      run: |
        ./premake5 gmake2 
    - name: make 
      run: make config=dist
    - name: upload executable
      uses: actions/upload-artifact@v3.1.2
      with:
        name: 8085sim-linux
        path: Binaries/Linux/8085sim
