Skip to content

Add help command and debugging steps to CI workflows #14

Add help command and debugging steps to CI workflows

Add help command and debugging steps to CI workflows #14

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch: # Allow manual triggering
schedule:
- cron: '0 0 * * 0' # Run weekly on Sundays at midnight UTC
jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
timeout-minutes: 10 # Add timeout to prevent hanging jobs
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.19
cache: true # Enable cache now that we have a go.sum file
# We don't need go mod download since we don't have external dependencies
- name: Build
run: go build -v ./cmd/stremax
- 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
- name: Run example programs
run: |
go build -o stremax ./cmd/stremax
chmod +x ./stremax
ls -la
file ./stremax
ldd ./stremax || echo "ldd not available"
./stremax help || echo "Help command failed"
ls -la ./examples/
./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
- name: Run benchmarks
run: go test -bench=. -benchmem ./... > benchmark-result.txt
- name: Display benchmark results
run: cat benchmark-result.txt
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 5
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.19
cache: true # Enable cache now that we have a go.sum file
- name: Install golint
run: go install golang.org/x/lint/golint@latest
- name: Run gofmt
run: |
if [ "$(gofmt -l . | wc -l)" -gt 0 ]; then
echo "The following files need formatting:"
gofmt -l .
echo "Please run 'gofmt -w .' to fix these issues"
exit 1
fi
- name: Run golint
run: $(go env GOPATH)/bin/golint -set_exit_status ./...
- name: Run go vet
run: go vet ./...