Add Prometheus query as new monitor type #217
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: CI Pipeline | |
| on: | |
| push: | |
| branches: ["main"] | |
| paths-ignore: | |
| - "etc/**" | |
| - "api/**" | |
| - "deploy/**" | |
| - "scripts/**" | |
| - "tests/**" | |
| - ".vscode/**" | |
| - "**/*.md" | |
| - "justfile" | |
| pull_request: | |
| branches: ["main"] | |
| permissions: | |
| packages: write | |
| checks: write | |
| env: | |
| IMAGE_REG: ghcr.io | |
| IMAGE_NAME: benc-uk/nanomon | |
| IMAGE_TAG: dev | |
| VERSION: dev | |
| POSTGRES_DSN: "host=localhost port=5432 user=nanomon dbname=nanomon sslmode=disable" | |
| POSTGRES_PASSWORD: notsecret123 # This is used to integration test against a local Postgres instance | |
| jobs: | |
| lint-build: | |
| name: Lint & Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Install just | |
| uses: taiki-e/install-action@just | |
| - name: Install tools | |
| run: just dev-tools | |
| - name: Check the build | |
| env: | |
| BUILD_INFO: "ignore me" | |
| run: just build | |
| - name: Linting & formatting | |
| run: just lint | |
| tests: | |
| name: Unit & Integration Tests | |
| runs-on: ubuntu-latest | |
| needs: lint-build | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Install just | |
| uses: taiki-e/install-action@just | |
| - name: Install tools | |
| run: just dev-tools | |
| # Run tests and filter the output to JUnit format | |
| - name: Run unit tests | |
| run: | | |
| go install github.com/jstemmer/go-junit-report/v2@latest | |
| go test -v 2>&1 ./... | go-junit-report -set-exit-code > unit-test-results.xml | |
| - name: Test Report (Unit) | |
| uses: phoenix-actions/test-reporting@v8 | |
| if: success() || failure() | |
| with: | |
| name: Unit Tests | |
| path: unit-test-results.xml | |
| reporter: java-junit | |
| # Run API integration tests with output in JUnit format | |
| - name: Run API integration tests | |
| env: | |
| PROMETHEUS_ENABLED: "1" | |
| API_ENDPOINT: http://localhost:8000/api | |
| run: | | |
| just run-all & | |
| sleep 35 | |
| just test-api true | |
| - name: Test Report (Integration) | |
| uses: phoenix-actions/test-reporting@v8 | |
| if: success() || failure() | |
| with: | |
| name: Integration Tests | |
| path: api-test-results.xml | |
| reporter: java-junit | |
| image-build: | |
| name: Build and push images | |
| if: github.ref == 'refs/heads/main' | |
| env: | |
| BUILD_INFO: "CI build, SHA:${{ github.sha }}" | |
| runs-on: ubuntu-latest | |
| needs: tests | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install just | |
| uses: taiki-e/install-action@just | |
| - name: Build & push images | |
| run: | | |
| echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u USERNAME --password-stdin | |
| just images | |
| just --yes push |