|
| 1 | +name: API CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - prod-* |
| 7 | + branches: |
| 8 | + - main |
| 9 | + - staging |
| 10 | + paths: |
| 11 | + - 'apps/codecov-api/**' |
| 12 | + - 'apps/codecov-api' |
| 13 | + - 'libs/**' |
| 14 | + pull_request: |
| 15 | + paths: |
| 16 | + - 'apps/codecov-api/**' |
| 17 | + - 'apps/codecov-api' |
| 18 | + - 'libs/**' |
| 19 | + merge_group: |
| 20 | + paths: |
| 21 | + - 'apps/codecov-api/**' |
| 22 | + - 'apps/codecov-api' |
| 23 | + - 'libs/**' |
| 24 | + |
| 25 | +permissions: |
| 26 | + contents: "read" |
| 27 | + id-token: "write" |
| 28 | + issues: "write" |
| 29 | + pull-requests: "write" |
| 30 | + |
| 31 | +concurrency: |
| 32 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 33 | + cancel-in-progress: true |
| 34 | + |
| 35 | +jobs: |
| 36 | + api-lint: |
| 37 | + name: Run Lint (API) |
| 38 | + uses: codecov/gha-workflows/.github/workflows/[email protected] |
| 39 | + with: |
| 40 | + working_directory: apps/codecov-api |
| 41 | + |
| 42 | + api-mypy: |
| 43 | + name: Patch typing (API) |
| 44 | + uses: codecov/gha-workflows/.github/workflows/[email protected] |
| 45 | + with: |
| 46 | + working_directory: apps/codecov-api |
| 47 | + |
| 48 | + api-build: |
| 49 | + name: Build App (API) |
| 50 | + uses: codecov/gha-workflows/.github/workflows/[email protected] |
| 51 | + secrets: inherit |
| 52 | + with: |
| 53 | + repo: ${{ vars.CODECOV_API_IMAGE_V2 || 'codecov/self-hosted-api' }} |
| 54 | + working_directory: apps/codecov-api |
| 55 | + |
| 56 | + # Runs create-commit, create-report |
| 57 | + api-codecovstartup: |
| 58 | + name: Codecov Startup (API) |
| 59 | + needs: api-build |
| 60 | + uses: codecov/gha-workflows/.github/workflows/[email protected] |
| 61 | + secrets: inherit |
| 62 | + with: |
| 63 | + working_directory: apps/codecov-api |
| 64 | + |
| 65 | + api-test: |
| 66 | + name: Test (API) |
| 67 | + needs: [api-build, api-codecovstartup] |
| 68 | + uses: codecov/gha-workflows/.github/workflows/[email protected] |
| 69 | + secrets: inherit |
| 70 | + with: |
| 71 | + run_integration: false |
| 72 | + repo: ${{ vars.CODECOV_API_IMAGE_V2 || 'codecov/self-hosted-api' }} |
| 73 | + working_directory: apps/codecov-api |
| 74 | + |
| 75 | + api-build-self-hosted: |
| 76 | + name: Build Self Hosted (API) |
| 77 | + needs: [api-build, api-test] |
| 78 | + uses: codecov/gha-workflows/.github/workflows/[email protected] |
| 79 | + secrets: inherit |
| 80 | + with: |
| 81 | + repo: ${{ vars.CODECOV_API_IMAGE_V2 || 'codecov/self-hosted-api' }} |
| 82 | + working_directory: apps/codecov-api |
| 83 | + |
| 84 | + api-staging: |
| 85 | + name: Push Staging Image (API) |
| 86 | + needs: [api-build, api-test] |
| 87 | + if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/staging' && github.repository_owner == 'codecov' }} |
| 88 | + uses: codecov/gha-workflows/.github/workflows/[email protected] |
| 89 | + secrets: inherit |
| 90 | + with: |
| 91 | + environment: staging |
| 92 | + repo: ${{ vars.CODECOV_API_IMAGE_V2 || 'codecov/self-hosted-api' }} |
| 93 | + working_directory: apps/codecov-api |
| 94 | + sentry_project: api |
| 95 | + |
| 96 | + api-production: |
| 97 | + name: Push Production Image (API) |
| 98 | + needs: [api-build, api-test] |
| 99 | + if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' && github.repository_owner == 'codecov' }} |
| 100 | + uses: codecov/gha-workflows/.github/workflows/[email protected] |
| 101 | + secrets: inherit |
| 102 | + with: |
| 103 | + environment: production |
| 104 | + repo: ${{ vars.CODECOV_API_IMAGE_V2 || 'codecov/self-hosted-api' }} |
| 105 | + working_directory: apps/codecov-api |
| 106 | + sentry_project: api |
| 107 | + |
| 108 | + api-self-hosted: |
| 109 | + name: Push Self Hosted Image (API) |
| 110 | + needs: [api-build-self-hosted, api-test] |
| 111 | + secrets: inherit |
| 112 | + if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' && github.repository_owner == 'codecov' }} |
| 113 | + uses: codecov/gha-workflows/.github/workflows/[email protected] |
| 114 | + with: |
| 115 | + push_rolling: true |
| 116 | + repo: ${{ vars.CODECOV_API_IMAGE_V2 || 'codecov/self-hosted-api' }} |
| 117 | + working_directory: apps/codecov-api |
0 commit comments