Skip to content

Create CI/CD job in setup wizard #1246

@matejchalk

Description

@matejchalk

User story

After initial setup, Code PushUp is typically run automatically as a CI/CD job. The setup wizard could generate the YAML configuration for GitHub Actions or GitLab CI/CD.

Outputs

GitHub Actions

name: Code PushUp

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

permissions:
  contents: read
  actions: read
  pull-requests: write

jobs:
  code-pushup:
    runs-on: ubuntu-latest
    steps:
      - name: Clone repository
        uses: actions/checkout@v5
      - name: Set up Node.js
        uses: actions/setup-node@v6
      - name: Install dependencies
        run: npm ci
      - name: Code PushUp
        uses: code-pushup/github-action@v0

GitLab CI/CD

workflow:
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'

include:
  - https://gitlab.com/code-pushup/gitlab-pipelines-template/-/raw/latest/code-pushup.yml

Acceptance criteria

  • The user is prompted to select GitHub Action or GitLab CI/CD for integrating Code PushUp in their CI pipeline. The user may choose not to integrate either of these tools.
    • Alternatively, the CI tool may be selected via a CLI argument.
  • If GitHub Actions are selected, a .github/workflows/code-pushup.yml workflow is generated.
    • The workflow is triggered by push and pull_request events on the default branch.
    • The workflow job uses the code-pushup/github-action.
  • If GitLab CI/CD is selected, a code-pushup job is added to .gitlab-ci.yml.
    • If there is .gitlab-ci.yml present, then a new file is created.
    • The job is triggered by pushing to the default branch, or creating/updating a merge request.
    • The code-pushup/gitlab-pipelines-template is included as a template.
  • The CI job inputs are configured for standalone or monorepo mode, based on what the user selected in a previous prompt (see Monorepo support in setup wizard #1245).

Metadata

Metadata

Assignees

No one assigned

    Labels

    🤓 UXUX improvement for CLI users🦾 CI/CDContinuous integration and deployment🧩 create-cli

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions