Fix JSON log attribute consistency and double encoding #64
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.22' | |
| - name: Cache Go modules | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/go/pkg/mod | |
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-go- | |
| - name: Download dependencies | |
| run: go mod download | |
| - name: Verify dependencies | |
| run: go mod verify | |
| - name: Run vet | |
| run: go vet ./... | |
| - name: Run tests | |
| run: go test -race -cover ./... | |
| - name: Build | |
| run: go build -o navigator ./cmd/navigator | |
| - name: Test binary | |
| run: | | |
| # Create minimal test environment with YAML configuration | |
| mkdir -p /tmp/test-rails/config | |
| cat > /tmp/test-rails/config/navigator.yml << 'EOF' | |
| server: | |
| listen: 0 # Use port 0 for testing | |
| hostname: localhost | |
| public_dir: /tmp/test-rails/public | |
| pools: | |
| max_size: 1 | |
| idle_timeout: 300 | |
| start_port: 4000 | |
| auth: | |
| enabled: false | |
| static: | |
| directories: [] | |
| extensions: [html, css, js] | |
| try_files: | |
| enabled: false | |
| applications: | |
| env: {} | |
| tenants: [] | |
| managed_processes: [] | |
| EOF | |
| mkdir -p /tmp/test-rails/public | |
| # Test that binary starts and exits cleanly with YAML config | |
| timeout 5s ./navigator /tmp/test-rails/config/navigator.yml || [ $? -eq 124 ] | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.22' | |
| - name: Build binaries | |
| run: | | |
| # Linux AMD64 | |
| GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o navigator-linux-amd64 ./cmd/navigator | |
| # Linux ARM64 | |
| GOOS=linux GOARCH=arm64 go build -ldflags "-s -w" -o navigator-linux-arm64 ./cmd/navigator | |
| # macOS AMD64 | |
| GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w" -o navigator-darwin-amd64 ./cmd/navigator | |
| # macOS ARM64 | |
| GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w" -o navigator-darwin-arm64 ./cmd/navigator | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: navigator-binaries | |
| path: navigator-* |