Skip to content

Fix CI workflows to properly build and run stremax binary #12

Fix CI workflows to properly build and run stremax binary

Fix CI workflows to properly build and run stremax binary #12

Workflow file for this run

name: Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch: # Allow manual triggering
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.19.x', '1.20.x', '1.21.x']
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Create empty go.sum if it doesn't exist
run: touch go.sum
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
check-latest: true
cache: false # Disable cache to avoid issues
- name: Display Go version
run: go version
- name: Run unit tests
run: go test -v ./...
- name: Run tests with race detection
run: go test -race -v ./...
- name: Run tests with coverage
run: go test -coverprofile=coverage.out -covermode=atomic ./...
- name: Display coverage
run: go tool cover -func=coverage.out
integration-test:
name: Integration Tests
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Create empty go.sum if it doesn't exist
run: touch go.sum
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.21.x'
check-latest: true
cache: false # Disable cache to avoid issues
- name: Display Go version
run: go version
- name: Build
run: go build -v -o stremax ./cmd/stremax
- name: Run example programs
run: |
chmod +x ./stremax
./stremax run -file ./examples/simple.sx
./stremax run -file ./examples/arithmetic.sx
./stremax run -file ./examples/strings.sx
./stremax run -file ./examples/conditionals.sx
./stremax run -file ./examples/boolean.sx
./stremax run -file ./examples/combined.sx
./stremax run -file ./examples/simple_logical.sx
./stremax run -file ./examples/logical.sx
# Skip examples that are expected to fail
# ./stremax run -file ./examples/errors.sx
benchmark:
name: Benchmarks
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Create empty go.sum if it doesn't exist
run: touch go.sum
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.21.x'
check-latest: true
cache: false # Disable cache to avoid issues
- name: Display Go version
run: go version
- name: Run benchmarks
run: go test -bench=. -benchmem ./... > benchmark-result.txt
- name: Display benchmark results
run: cat benchmark-result.txt