chore: add ni grafana env for dev and test #3121
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: PR | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| - alpha | |
| workflow_dispatch: | |
| jobs: | |
| build_and_test: | |
| runs-on: ubuntu-latest | |
| # environment: jfrog-ci | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Setup Node.js environment | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Check types | |
| run: npm run typecheck | |
| - name: Lint | |
| run: npm run lint -- --quiet | |
| - name: Unit tests | |
| run: npm run test:ci | |
| - name: Build | |
| run: npm run build | |
| - name: Login to Artifactory | |
| id: artifactory_login | |
| continue-on-error: true | |
| uses: docker/login-action@v1 | |
| with: | |
| registry: niartifacts.jfrog.io | |
| username: ${{ vars.JFROG_USERNAME }} | |
| password: ${{ secrets.JFROG_ACCESS_TOKEN }} | |
| - name: Start NI test environment | |
| if: ${{ steps.artifactory_login.outcome == 'success' }} | |
| run: npm run server:test:ni | |
| - name: Start test environment | |
| if: ${{ steps.artifactory_login.outcome != 'success'}} | |
| run: npm run server:test | |
| - name: Wait for services | |
| run: | | |
| timeout 60 sh -c 'until curl -f http://localhost:4000/api/health > /dev/null 2>&1; do sleep 2; done' | |
| timeout 60 sh -c 'until curl -f http://localhost:5000/up > /dev/null 2>&1; do sleep 2; done' | |
| - name: Show docker logs on failure | |
| if: failure() | |
| run: docker compose -f docker-compose.tests.yaml logs --tail=200 | |
| - name: Acceptance tests (NI) | |
| if: ${{ steps.artifactory_login.outcome == 'success' }} | |
| run: npm run test:acceptance:ni | |
| - name: Acceptance tests | |
| if: ${{ steps.artifactory_login.outcome != 'success' }} | |
| run: npm run test:acceptance | |
| - name: Upload Playwright report | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-report | |
| path: acceptance-tests/playwright-report/ | |
| retention-days: 7 | |
| - name: Stop test environment | |
| if: always() | |
| run: docker compose -f docker-compose.tests.yaml down |