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

ci: Refactor workflows so that they are usable by forks #981

Merged
merged 9 commits into from
Jan 9, 2025

Conversation

thomass-dev
Copy link
Collaborator

@thomass-dev thomass-dev commented Dec 18, 2024

This PR addresses several issues concerning the CI in PR from forks:

  • Refactor workflows so that they are usable in every PR

    • assignee can be added to every PR
    • coverage comments can be send to every PR
  • Add workflow to serve documentation preview and send a comment with the corresponding link in PR

  • Add workflow to clean documentation preview and GH artifacts after closing a PR

@thomass-dev thomass-dev force-pushed the fix-ci-on-fork branch 2 times, most recently from 0436ef4 to 47a7b9f Compare December 18, 2024 10:37
thomass-dev added a commit to thomass-dev/skore-fork that referenced this pull request Dec 18, 2024
thomass-dev added a commit to thomass-dev/skore-fork that referenced this pull request Dec 18, 2024
@thomass-dev thomass-dev force-pushed the fix-ci-on-fork branch 2 times, most recently from b85e586 to 4721ba9 Compare December 18, 2024 20:09
thomass-dev added a commit to thomass-dev/skore-fork that referenced this pull request Dec 19, 2024
thomass-dev added a commit to thomass-dev/skore-fork that referenced this pull request Dec 19, 2024
thomass-dev added a commit to thomass-dev/skore-fork that referenced this pull request Dec 19, 2024
@thomass-dev thomass-dev self-assigned this Dec 26, 2024
@thomass-dev thomass-dev force-pushed the fix-ci-on-fork branch 12 times, most recently from 5f7d570 to 5d6b2f5 Compare December 26, 2024 19:23
@thomass-dev thomass-dev force-pushed the fix-ci-on-fork branch 3 times, most recently from 0f30aa2 to 58d9cfd Compare December 27, 2024 08:31
if: ${{ ! matrix.coverage }}
timeout-minutes: 10
working-directory: skore/
run: python -m pytest -n auto --no-cov src/ tests/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something that I wondered: why not always testing with the coverage? In scikit-learn, we have some build jobs that don't do so to speed-up the CI but because we are at almost 25 minutes otherwise.

So if you are still in a reasonable time, I would not bother and always collect coverage.

HEAD_REPOSITORY_ID: ${{ github.event.pull_request.head.repo.id }}
HEAD_BRANCH: ${{ github.head_ref }}

clean-documentation-preview:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you use this to clean the buckets. Would it be easier to set up a time-based purge like in Azure or CircleCI that delete your preview after a week or so. In this way you don't have to maintain this script?

- name: Clean documentation preview
run: rclone --config rclone.configuration purge "${PROVIDER}:${BUCKET}/${PULL_REQUEST_NUMBER}"
env:
PROVIDER: scaleway
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering now what is the expected cost to store the buckets given a certain activity. It is just to have an idea.

@lesteve
Copy link

lesteve commented Jan 6, 2025

I haven't had a detailed look 😓 but based on my personal experience with CI (and biases thereof), I would suggest the following for the doc preview rather than maintaining a custom setup:

  • readthedocs has built-in support for doc preview. The limitation is build time (15 minutes) and memory (7GB) see doc. We do this for joblib.
  • Github action + Netlify (or Vercel). We do this for the scikit-learn MOOC. Limitation is that there are some limits in Netlify but I don't remember them very well (maybe some kind of size limit if you upload too many times). Also IIRC you need to apply for an open-source plan and the rules are not super clear. IIRC you are supposed to acknowledge Netlify so I think we put links into the preview somewhere to try to follow them (I took this from another project).
  • CircleCI for doc preview + redirect-action for link inside CI statuses. We do this for scikit-learn.

Of course, do what you think is best for skore and very happy to chat about what you learn if you take another road. Out of curiosity did you draw for inspiration from an existing project for the doc preview?

Comment on lines +3 to +8
Acquire the PR number and the PR commit HEAD sha, after a "workflow_run" event.

The "workflow_run" context differs from the "pull_request" context and doesn't contain
PR basic information. This action intends to provide some missing information in the
"workflow_run" context, without having to explicitly record them in the workflow that
triggered the "workflow_run" event.
Copy link
Contributor

@rouk1 rouk1 Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment should express the difference between "workflow_run" and other execution context.


on:
pull_request:
pull_request_target:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may document here that no user code should be executed in this action.

name: cleanup PR

on:
pull_request_target:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should document that no user code should be run in this PR.

@glemaitre
Copy link
Member

@thomass-dev do you want to move forward on this PR. I can later help at having a spin on #916 because it looks this one will be a blocker.

@thomass-dev thomass-dev marked this pull request as draft January 8, 2025 11:19
# Conflicts:
#	.github/workflows/skore.yml
@thomass-dev
Copy link
Collaborator Author

@rouk1 i want to postpone the writing of the ADR in #1066. Are you okay to merge in state?

@thomass-dev thomass-dev marked this pull request as ready for review January 9, 2025 14:53
@rouk1
Copy link
Contributor

rouk1 commented Jan 9, 2025

@rouk1 i want to postpone the writing of the ADR in #1066. Are you okay to merge in state?

ok lgtm then !

@thomass-dev thomass-dev merged commit be1aec3 into main Jan 9, 2025
27 checks passed
@thomass-dev thomass-dev deleted the fix-ci-on-fork branch January 9, 2025 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Having documentation preview in PR would be really handy for reviewing
4 participants