Add retry logic for gateway API client and fix lint issues #65
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: Code Quality | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| - release/** | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| pages: write | |
| id-token: write | |
| jobs: | |
| lint-test-build: | |
| name: Lint, Test, and Build | |
| runs-on: ubuntu-latest | |
| services: | |
| redis: | |
| image: redis:7-alpine | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9.15.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run lint | |
| run: pnpm check-types | |
| - name: Run tests | |
| env: | |
| REDIS_URL: redis://localhost:6379 | |
| DATABASE_URL: postgres://postgres:password@localhost:5432/radix-incentives | |
| TOKEN_PRICE_SERVICE_API_KEY: ${{ secrets.TOKEN_PRICE_SERVICE_API_KEY }} | |
| NODE_ENV: test | |
| SKIP_INTEGRATION_TESTS: true | |
| run: pnpm test:ci | |
| - name: Build applications | |
| run: pnpm build --filter=workers --filter=streamer --filter=incentives --filter=admin | |
| env: | |
| DATABASE_URL: postgres://postgres:password@localhost:5432/radix-incentives | |
| WORKERS_API_BASE_URL: http://localhost:3003 | |
| - name: Upload test coverage | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage | |
| path: packages/api/coverage | |
| retention-days: 7 | |
| - name: Coverage Report as Comment | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| if [ -f packages/api/coverage/coverage-summary.json ]; then | |
| COVERAGE=$(cat packages/api/coverage/coverage-summary.json | jq -r ' | |
| "## 📊 Test Coverage Report\n\n" + | |
| "| Metric | Coverage |\n" + | |
| "|--------|----------|\n" + | |
| "| **Lines** | " + (.total.lines.pct|tostring) + "% |\n" + | |
| "| **Functions** | " + (.total.functions.pct|tostring) + "% |\n" + | |
| "| **Branches** | " + (.total.branches.pct|tostring) + "% |\n" + | |
| "| **Statements** | " + (.total.statements.pct|tostring) + "% |\n\n" + | |
| "### Summary\n" + | |
| "- **Total Lines:** " + (.total.lines.covered|tostring) + "/" + (.total.lines.total|tostring) + "\n" + | |
| "- **Total Functions:** " + (.total.functions.covered|tostring) + "/" + (.total.functions.total|tostring) + "\n" + | |
| "- **Total Branches:** " + (.total.branches.covered|tostring) + "/" + (.total.branches.total|tostring) + "\n" + | |
| "- **Total Statements:** " + (.total.statements.covered|tostring) + "/" + (.total.statements.total|tostring) + "\n\n" + | |
| "📋 **[View Detailed HTML Coverage Report](https://radixdlt.github.io/radix-incentives/)**\n\n" + | |
| "*Coverage report generated by Vitest*" | |
| ') | |
| gh pr comment ${{ github.event.pull_request.number }} --body "$COVERAGE" || echo "Failed to post coverage comment" | |
| else | |
| echo "Coverage summary file not found" | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # TODO: Uncomment this when we have a way to deploy the coverage report to GitHub Pages | |
| # deploy-coverage: | |
| # name: Deploy Coverage Report | |
| # needs: lint-test-build | |
| # runs-on: ubuntu-latest | |
| # if: github.event_name == 'pull_request' && github.repository == 'radixdlt/radix-incentives' | |
| # environment: | |
| # name: github-pages | |
| # url: ${{ steps.deployment.outputs.page_url }} | |
| # steps: | |
| # - name: Download coverage artifact | |
| # uses: actions/download-artifact@v4 | |
| # with: | |
| # name: coverage | |
| # path: ./coverage | |
| # - name: Setup Pages | |
| # uses: actions/configure-pages@v4 | |
| # - name: Upload to GitHub Pages | |
| # uses: actions/upload-pages-artifact@v3 | |
| # with: | |
| # path: ./coverage | |
| # - name: Deploy to GitHub Pages | |
| # id: deployment | |
| # uses: actions/deploy-pages@v4 |