task: add sort and custom metadata filters to list app runs #355
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/CD Pipeline | |
| permissions: {} | |
| on: | |
| schedule: | |
| # run every day at 7:00 AM UTC | |
| - cron: '0 7 * * *' | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| permissions: | |
| contents: read | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [18.x, 20.x] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Generate SDK code from OpenAPI | |
| run: npx nx codegen sdk | |
| - name: Build packages | |
| run: npx nx run-many -t build | |
| - name: Run linting | |
| run: npx nx run-many -t lint | |
| - name: Run formatting check | |
| run: npm run format:check | |
| - name: Run type checking | |
| run: npx nx run-many -t typecheck | |
| - name: Run tests with coverage | |
| run: npx nx run-many -t test --coverage | |
| - name: Run CLI E2E tests | |
| run: npm run test:cli:e2e | |
| env: | |
| E2E_REFRESH_TOKEN: ${{ secrets.E2E_REFRESH_TOKEN }} | |
| E2E_TEST_ENVIRONMENT: ${{ secrets.E2E_TEST_ENVIRONMENT }} | |
| - name: Upload SDK test results | |
| if: matrix.node-version == '20.x' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-sdk | |
| path: packages/sdk/test-results/*.xml | |
| - name: Upload CLI test results | |
| if: matrix.node-version == '20.x' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-cli | |
| path: packages/cli/test-results/*.xml | |
| - name: Upload coverage to Codecov | |
| if: matrix.node-version == '20.x' | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| files: ./packages/sdk/coverage/lcov.info,./packages/cli/coverage/lcov.info | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| - name: SonarQube Scan | |
| if: matrix.node-version == '20.x' | |
| uses: SonarSource/sonarqube-scan-action@v6 | |
| with: | |
| args: > | |
| -Dsonar.javascript.lcov.reportPaths=packages/sdk/coverage/lcov.info,packages/cli/coverage/lcov.info | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| build-docs: | |
| permissions: | |
| contents: write | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Generate SDK code from OpenAPI | |
| run: npx nx codegen sdk | |
| - name: Build SDK package | |
| run: npx nx build sdk | |
| - name: Generate documentation | |
| run: npm run docs | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./docs | |
| cname: aignostics-platform-sdk.github.io | |
| run-ketryx-report: | |
| needs: test | |
| if: github.ref == 'refs/heads/main' | |
| uses: ./.github/workflows/_report-to-ketryx.yml | |
| with: | |
| build-name: 'pre-release' | |
| secrets: | |
| KETRYX_PROJECT: KXPRJ7NZ5C47Q0Q84FTG9AZ2T17N8J2 # not a secret | |
| KETRYX_API_KEY: ${{ secrets.KETRYX_API_KEY }} | |
| release: | |
| permissions: | |
| contents: write | |
| runs-on: ubuntu-latest | |
| needs: [test, build-docs, run-ketryx-report] | |
| if: github.ref == 'refs/heads/main' | |
| environment: | |
| name: production | |
| url: https://github.com/aignostics/typescript-sdk/releases | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Generate SDK code from OpenAPI | |
| run: npx nx codegen sdk | |
| - name: Build all packages | |
| run: npx nx run-many -t build | |
| - name: Release SDK | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| working-directory: packages/sdk | |
| run: npx semantic-release | |
| - name: Release CLI | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| working-directory: packages/cli | |
| run: npx semantic-release | |
| codeql: | |
| if: (!contains(github.event.head_commit.message, 'skip:ci')) | |
| uses: ./.github/workflows/_codeql.yml | |
| permissions: | |
| actions: read | |
| contents: read | |
| packages: read | |
| security-events: write | |
| secrets: inherit |