name: ALU Test

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout do código
        uses: actions/checkout@v4

      - name: Instalar Icarus Verilog (iverilog)
        run: sudo apt update && sudo apt install -y iverilog

      - name: Criar diretório de build
        run: mkdir -p build

      - name: Compilar o testbench
        run: iverilog -o build/alu_tb -s alu_tb -g2005-sv -Irtl/core testbenchs/alu_tb.sv rtl/core/alu.sv

      - name: Executar o testbench
        run: vvp build/alu_tb

      - name: Salvar VCD como artefato
        uses: actions/upload-artifact@v4
        with:
          name: alu_waveform
          path: build/alu_tb.vcd
