Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitLab template #58

Closed
7 tasks done
matejchalk opened this issue Sep 12, 2024 · 0 comments
Closed
7 tasks done

GitLab template #58

matejchalk opened this issue Sep 12, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request gitlab GitLab pipelines template (https://gitlab.com/code-pushup/gitlab-pipelines-template)

Comments

@matejchalk
Copy link
Contributor

matejchalk commented Sep 12, 2024

As a GitLab user, I would like to easily configure Code PushUp comparison comments in GitLab CI/CD, similarly to how GitHub users have a simple setup using code-pushup/github-action.

Unfortunately, GitLab pipelines don't offer anything as comprehensive as shared actions in GitHub. The closest equivalent is to distribute a GitLab template.

GitLab docs:

The GitLab template would include a script to run equivalent logic as in the GitHub Action. Configuration should be possible via inputs or overriding template properties (e.g. setting custom image or adding a before_script).

To be able to easily test the template end-to-end, it would be best to develop this template in a GitLab repository, so that it can run Code PushUp on itself.

current GitLab CI/CD integrations (no comparisons, only upload)

In React repo:

code-pushup:
  <<: *rule-main-and-release-on-success
  <<: *resolve-deps
  <<: *cache-pull
  stage: pre-deploy
  allow_failure: true
  tags: [high-performance]
  script:
    - yarn -s run code-pushup
  artifacts:
    expire_in: 1 days
    paths:
      - .code-pushup/

In PHP repo where Code PushUp is run only on tests in Cypress folder:

# cypress/.gitlab-ci.yml

code-pushup:
  stage: report
  image: node:lts
  cache:
    <<: *global_cache
  allow_failure: true
  script:
    - !reference [.create_npmrc, script]
    - yarn install --frozen-lockfile
    - cd cypress
    - yarn code-pushup
  artifacts:
    expire_in: 1 days
    paths:
      - cypress/.code-pushup/

In Python repo (needs image with both Node.js and Python installed):

code-pushup:
  stage: code_review
  extends: .base-job
  image: nikolaik/python-nodejs:python3.11-nodejs20
  allow_failure: true
  before_script:
  - export POETRY_HTTP_BASIC_SKYPICKER_USERNAME=${CI_REGISTRY_USER}
  - export POETRY_HTTP_BASIC_SKYPICKER_PASSWORD=${CI_JOB_TOKEN}
  - poetry install
  - poetry self add poetry-audit-plugin
  - python -m pip install pylint
  - cd code-pushup
  - yarn install --frozen-lockfile
  script:
  - yarn code-pushup
  artifacts:
    expire_in: 1 days
    paths:
    - code-pushup/.code-pushup/

Acceptance criteria

  • new Code PushUp GitLab organization is created
  • new repository for GitLab template is created
  • template can be included in any GitLab project via URL
  • script runs Code PushUp on source and target branches and uploads to portal and/or artifacts (artifact downloaded for caching)
  • if a MR is open, script compares reports and posts Markdown summary as MR comment using GitLab API
  • investigate GitHub annotations equivalent and plan follow-up issue
  • consider how to integrate GitHub Action's monorepo mode (Multi-project mode for GitHub Action #35), incl. how can we best handle shared code, and plan follow-up issue
@matejchalk matejchalk self-assigned this Oct 30, 2024
@matejchalk matejchalk added the enhancement New feature or request label Oct 30, 2024
@matejchalk matejchalk added the gitlab GitLab pipelines template (https://gitlab.com/code-pushup/gitlab-pipelines-template) label Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request gitlab GitLab pipelines template (https://gitlab.com/code-pushup/gitlab-pipelines-template)
Projects
None yet
Development

No branches or pull requests

1 participant