add script timeout, integration tests, and cleanup dead code #114
Workflow file for this run
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: Test and coverage | |
| on: [push, pull_request] | |
| jobs: | |
| unit-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 2 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: '1.25' | |
| - name: Run unit tests with coverage | |
| run: go test -coverpkg=./... ./... -race -coverprofile=coverage.out -covermode=atomic | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5.5.1 | |
| with: | |
| verbose: true | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| integration-tests: | |
| runs-on: ubuntu-latest | |
| services: | |
| consul: | |
| image: hashicorp/consul:1.20 | |
| ports: | |
| - 8500:8500 | |
| options: >- | |
| --health-cmd "consul members" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 10 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: '1.25' | |
| - name: Wait for Consul | |
| run: | | |
| until curl -s http://localhost:8500/v1/status/leader | grep -q .; do | |
| echo "Waiting for Consul..." | |
| sleep 2 | |
| done | |
| echo "Consul is ready" | |
| - name: Run integration tests | |
| run: go test -race -tags=integration ./... | |
| env: | |
| CONSUL_ADDR: 127.0.0.1:8500 |