Alerting: Update Swagger spec #95
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: Frontend tests | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| - release-*.*.* | |
| permissions: {} | |
| jobs: | |
| detect-changes: | |
| # Run on `grafana/grafana` main branch, or on pull requests to prevent double-running on mirrors | |
| if: (github.event_name == 'pull_request' || (github.event_name == 'push' && github.repository == 'grafana/grafana')) | |
| name: Detect whether code changed | |
| runs-on: ubuntu-x64-small | |
| permissions: | |
| contents: read | |
| outputs: | |
| changed: ${{ steps.detect-changes.outputs.frontend }} | |
| devenv-changed: ${{ steps.detect-changes.outputs.devenv }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| persist-credentials: true # required to get more history in the changed-files action | |
| fetch-depth: 2 | |
| - name: Detect changes | |
| id: detect-changes | |
| uses: ./.github/actions/change-detection | |
| with: | |
| self: .github/workflows/pr-frontend-unit-tests.yml | |
| generate-golden-files: | |
| permissions: | |
| contents: read | |
| needs: | |
| - detect-changes | |
| if: needs.detect-changes.outputs.changed == 'true' | |
| runs-on: ubuntu-x64-small | |
| name: Generate golden files | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Go | |
| uses: ./.github/actions/setup-go | |
| with: | |
| cache-build: 'false' | |
| - name: Generate golden files | |
| run: make generate-golden-files | |
| working-directory: apps/dashboard | |
| - name: Upload golden files | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: golden-files | |
| retention-days: 1 | |
| path: | | |
| apps/dashboard/pkg/migration/testdata/output/ | |
| apps/dashboard/pkg/migration/testdata/dev-dashboards-output/ | |
| apps/dashboard/pkg/migration/conversion/testdata/output/ | |
| apps/dashboard/pkg/migration/conversion/testdata/migrated_dashboards_output/ | |
| frontend-unit-tests: | |
| permissions: | |
| contents: read | |
| id-token: write | |
| needs: | |
| - detect-changes | |
| - generate-golden-files | |
| # Run this workflow only for PRs from forks; if it gets merged into `main` or `release-*`, | |
| # the `frontend-unit-tests-enterprise` workflow will run instead | |
| if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true && needs.detect-changes.outputs.changed == 'true' | |
| runs-on: ubuntu-x64-large | |
| name: "Unit tests (${{ matrix.shard }} / ${{ matrix.total }})" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] | |
| total: [16] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| persist-credentials: false | |
| - name: Download golden files | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: golden-files | |
| path: apps/dashboard/pkg/migration | |
| - name: Setup Node.js | |
| uses: ./.github/actions/setup-node | |
| - name: Install yarn dependencies | |
| uses: ./.github/actions/yarn-install | |
| - run: yarn run test:ci | |
| env: | |
| TEST_MAX_WORKERS: 4 | |
| TEST_SHARD: ${{ matrix.shard }} | |
| TEST_SHARD_TOTAL: ${{ matrix.total }} | |
| frontend-unit-tests-enterprise: | |
| permissions: | |
| contents: read | |
| id-token: write | |
| needs: | |
| - detect-changes | |
| - generate-golden-files | |
| # Run this workflow for non-PR events (like pushes to `main` or `release-*`) OR for internal PRs (PRs not from forks) | |
| if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false && needs.detect-changes.outputs.changed == 'true' | |
| runs-on: ubuntu-x64-large | |
| name: "Unit tests (${{ matrix.shard }} / ${{ matrix.total }})" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] | |
| total: [16] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Enterprise | |
| uses: ./.github/actions/setup-enterprise | |
| with: | |
| github-app-name: 'grafana-ci-bot' | |
| - name: Download golden files | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: golden-files | |
| path: apps/dashboard/pkg/migration | |
| - name: Setup Node.js | |
| uses: ./.github/actions/setup-node | |
| - name: Install yarn dependencies | |
| uses: ./.github/actions/yarn-install | |
| - run: yarn run test:ci | |
| env: | |
| TEST_MAX_WORKERS: 4 | |
| TEST_SHARD: ${{ matrix.shard }} | |
| TEST_SHARD_TOTAL: ${{ matrix.total }} | |
| frontend-decoupled-plugin-tests: | |
| needs: | |
| - detect-changes | |
| if: needs.detect-changes.outputs.changed == 'true' | |
| runs-on: ubuntu-x64-large | |
| name: "Decoupled plugin tests" | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Node.js | |
| uses: ./.github/actions/setup-node | |
| - name: Install yarn dependencies | |
| uses: ./.github/actions/yarn-install | |
| - run: yarn run plugin:test:ci | |
| frontend-packages-unit-tests: | |
| needs: | |
| - detect-changes | |
| if: needs.detect-changes.outputs.changed == 'true' | |
| runs-on: ubuntu-x64-large | |
| name: "Packages unit tests" | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Node.js | |
| uses: ./.github/actions/setup-node | |
| - name: Install yarn dependencies | |
| uses: ./.github/actions/yarn-install | |
| - run: yarn run packages:test:ci | |
| # This is the job that is actually required by rulesets. | |
| # We need to require EITHER the OSS or the Enterprise job to pass. | |
| # However, if one is skipped, GitHub won't flat-map the shards, | |
| # so they won't be accepted by a ruleset. | |
| required-frontend-unit-tests: | |
| needs: | |
| - generate-golden-files | |
| - frontend-unit-tests | |
| - frontend-unit-tests-enterprise | |
| - frontend-decoupled-plugin-tests | |
| - frontend-packages-unit-tests | |
| # always() is the best function here. | |
| # success() || failure() will skip this function if any need is also skipped. | |
| # That means conditional test suites will fail the entire requirement check. | |
| if: always() | |
| name: All frontend unit tests complete | |
| runs-on: ubuntu-x64-small | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| persist-credentials: false | |
| - name: Check test suites | |
| uses: ./.github/actions/check-jobs | |
| with: | |
| needs: ${{ toJson(needs) }} | |
| failure-message: "One or more unit test jobs have failed" | |
| success-message: "All unit tests completed successfully" | |
| devenv: | |
| needs: | |
| - detect-changes | |
| if: needs.detect-changes.outputs.devenv-changed == 'true' | |
| runs-on: ubuntu-x64-large | |
| name: "Devenv frontend-service build" | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Docker | |
| uses: docker/setup-docker-action@3fb92d6d9c634363128c8cce4bc3b2826526370a # v4 | |
| - name: Setup Node.js | |
| uses: ./.github/actions/setup-node | |
| - name: Install Tilt | |
| run: curl -fsSL https://raw.githubusercontent.com/tilt-dev/tilt/master/scripts/install.sh | bash | |
| - name: Create empty config files # TODO: the tiltfile should conditionally mount these only if they exist, like the enterprise license | |
| run: | | |
| touch devenv/frontend-service/configs/grafana-api.local.ini | |
| touch devenv/frontend-service/configs/frontend-service.local.ini | |
| - name: Test frontend-service Tiltfile | |
| run: tilt ci --file devenv/frontend-service/Tiltfile |