name: Build

on:
  pull_request:
  push:
    branches:
      - dev
      - release
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    container:
      image: ghcr.io/tinygo-org/tinygo:latest
      options: --user root
    steps:
      - name: Checkout
        uses: actions/checkout@v6
      - name: TinyGo version check
        run: tinygo version
      - name: Enforce Go Formatted Code
        run: make fmt-check
      - name: Run unit tests
        run: make unit-test
      - name: Run build and smoke tests
        run: |
          go env -w GOFLAGS=-buildvcs=false
          make smoke-test
