Skip to content

Add tests

Add tests #1

name: Cross-Platform Tests
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
schedule:
# Run tests daily at 2 AM UTC
- cron: '0 2 * * *'
jobs:
test-cross-platform:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
go-version: ['1.21']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go-version }}-
- name: Download dependencies
run: go mod download
- name: Run unit tests
run: go test -v ./internal/...
- name: Run integration tests
run: go test -v ./test/...
- name: Run all tests with race detector
run: go test -race ./...
- name: Build application
run: go build -v ./cmd/devbox
- name: Test binary execution (Unix)
if: runner.os != 'Windows'
run: |
./devbox version || echo "Expected failure on non-Linux systems"
./devbox --help
- name: Test binary execution (Windows)
if: runner.os == 'Windows'
run: |
.\devbox.exe version
.\devbox.exe --help