Skip to content

CI

CI #4475

Workflow file for this run

name: CI
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
schedule:
- cron: '0 0 * * *'
env:
NX_CLOUD_DISTRIBUTED_EXECUTION: ${{ !contains(github.event.pull_request.user.login, 'dependabot') && !contains(github.event.pull_request.user.login, 'renovate') }}
NX_CLOUD_AUTH_TOKEN: ${{ startsWith(github.repository, 'jmcdo29') && secrets.NX_CLOUD_TOKEN || 'OTRjNTE0ZTgtNmVjOC00NjNmLWFkYzctYWM0MDlhM2VmNzMyfHJlYWQ=' }}
jobs:
main:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' }}
steps:
- uses: actions/checkout@v4
name: Checkout [main]
with:
fetch-depth: 0
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v3
- name: Setup
uses: ./.github/actions/setup
- name: Lint, Build, Test
uses: ./.github/actions/lint-build-test
- name: Stop Nx Cloud Agents
run: pnpm nx-cloud stop-all-agents
- name: Tag main branch if all jobs succeed
uses: nrwl/nx-tag-successful-ci-run@v1
pr:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- uses: actions/checkout@v4
with:
# ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v3
- name: Setup
uses: ./.github/actions/setup
- name: Lint, Build, Test
uses: ./.github/actions/lint-build-test
- name: Stop Nx Cloud Agents
run: pnpm nx-cloud stop-all-agents
analyze:
name: Analyze
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: javascript
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
auto-merge:
needs: pr
if: contains(github.event.pull_request.user.login, 'dependabot') || contains(github.event.pull_request.user.login, 'renovate')
runs-on: ubuntu-latest
steps:
- name: automerge
uses: pascalgn/[email protected]
env:
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
MERGE_LABELS: ''
MERGE_METHOD: rebase
send-coverage:
runs-on: ubuntu-latest
needs: [pr, main]
if: always()
steps:
- name: Download Coverage
uses: actions/download-artifact@v4
with:
name: coverage
path: coverage/
- name: Send Coverage
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r coverage/lcov.info
shell: bash
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
agents:
runs-on: ubuntu-latest
name: Nx Agent
strategy:
matrix:
agent: [1, 2, 3]
steps:
- uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
- name: Start Nx Agent ${{ matrix.agent }}
run: pnpm nx-cloud start-agent