Some refactoring and simplifications #202
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] | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| - name: Vet | |
| run: go vet ./... | |
| - name: Lint | |
| uses: golangci/golangci-lint-action@v7 | |
| test: | |
| needs: lint | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| - name: Build | |
| run: go build ./cmd/ember/ | |
| - name: Test | |
| run: go test ./... -race -v -coverprofile=coverage.txt | |
| - name: Upload coverage | |
| if: matrix.os == 'ubuntu-latest' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| integration: | |
| needs: lint | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| - name: Install Caddy | |
| run: | | |
| sudo apt-get install -y debian-keyring debian-archive-keyring apt-transport-https curl | |
| curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg | |
| curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list | |
| sudo apt-get update | |
| sudo apt-get install -y caddy | |
| - name: Start Caddy | |
| run: | | |
| cat > /tmp/Caddyfile <<'CADDYFILE' | |
| { | |
| admin localhost:2099 | |
| metrics | |
| } | |
| :8080 { | |
| respond "OK" 200 | |
| } | |
| CADDYFILE | |
| caddy fmt --overwrite /tmp/Caddyfile | |
| caddy start --config /tmp/Caddyfile | |
| - name: Wait for Caddy | |
| run: | | |
| for i in $(seq 1 30); do | |
| curl -sf http://localhost:2099/config/ > /dev/null 2>&1 && exit 0 | |
| sleep 1 | |
| done | |
| echo "::error::Caddy failed to start within 30s" | |
| exit 1 | |
| - name: Integration tests | |
| run: go test -tags integration -race -v -coverprofile=integration-coverage.txt ./internal/app/ | |
| env: | |
| EMBER_TEST_CADDY_ADDR: http://localhost:2099 | |
| - name: Upload integration coverage | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: integration-coverage.txt | |
| flags: integration |