fix(setup): respect PUID/PGID + look up www-data from /etc/passwd #10
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, develop] | |
| pull_request: | |
| branches: [main, develop] | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| go: ['1.24'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ matrix.go }} | |
| - name: Cache Go modules | |
| uses: actions/cache@v4 | |
| 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: Run tests | |
| run: make test | |
| - name: Run race detector | |
| run: go test -race -short ./... | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v4 | |
| if: matrix.os == 'ubuntu-latest' | |
| with: | |
| files: ./coverage.out | |
| flags: unittests | |
| name: codecov-${{ matrix.os }} | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.24' | |
| - name: golangci-lint | |
| uses: golangci/golangci-lint-action@v4 | |
| with: | |
| version: latest | |
| args: --timeout=5m | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| needs: [test, lint] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.24' | |
| - name: Build all platforms | |
| run: make build-all | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: binaries | |
| path: build/cbox-init-* | |
| retention-days: 7 | |
| integration-test: | |
| name: Integration Test (${{ matrix.distro }}) | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| strategy: | |
| matrix: | |
| distro: [alpine, debian, ubuntu] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: binaries | |
| path: build/ | |
| - name: Make binaries executable | |
| run: chmod +x build/cbox-init-* | |
| - name: Run integration tests - ${{ matrix.distro }} | |
| run: | | |
| docker build \ | |
| -f tests/integration/Dockerfile.${{ matrix.distro }} \ | |
| -t cbox-init-test-${{ matrix.distro }} \ | |
| . | |
| docker run --rm \ | |
| --name cbox-init-test-${{ matrix.distro }} \ | |
| cbox-init-test-${{ matrix.distro }} | |
| - name: Test with real workload | |
| run: | | |
| docker run -d \ | |
| --name cbox-init-workload-${{ matrix.distro }} \ | |
| -p 9090:9090 \ | |
| -p 9180:9180 \ | |
| cbox-init-test-${{ matrix.distro }} | |
| # Wait for startup with retries | |
| echo "Waiting for services to be ready..." | |
| for i in {1..30}; do | |
| if curl -sf http://localhost:9090/metrics > /dev/null 2>&1; then | |
| echo "Metrics endpoint ready after ${i}s" | |
| break | |
| fi | |
| sleep 1 | |
| done | |
| # Test metrics endpoint | |
| curl -f http://localhost:9090/metrics || exit 1 | |
| # Wait for API with retries | |
| for i in {1..30}; do | |
| if curl -sf http://localhost:9180/api/v1/health > /dev/null 2>&1; then | |
| echo "API endpoint ready after ${i}s" | |
| break | |
| fi | |
| sleep 1 | |
| done | |
| # Test API endpoint | |
| curl -f http://localhost:9180/api/v1/health || exit 1 | |
| # Cleanup | |
| docker stop cbox-init-workload-${{ matrix.distro }} |