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

Reorganize github workflows and use specific label [skip circleci] #2297

Merged
merged 22 commits into from Oct 28, 2021

Conversation

jneira
Copy link
Member

@jneira jneira commented Oct 24, 2021

  • With this pr circle ci and github workflow will be skipped with left bracket skip ci right bracket in the title or description

@pepeiborra
Copy link
Collaborator

Instead of adding a condition to every step, would it be possible to generate the empty matrix?

@jneira
Copy link
Member Author

jneira commented Oct 24, 2021

hmm interesting suggestion, not sure if it is possible, will investigate

@jneira jneira changed the title Make github workflow honour skip ci Make github workflow honour [skip ci] Oct 24, 2021
@jneira
Copy link
Member Author

jneira commented Oct 24, 2021

hmm interesting suggestion, not sure if it is possible, will investigate

I've investigated a little bit and it seems you can set the matrix contents in a previous job. However it seems to be a little bit complex: https://stackoverflow.com/a/65434401/49554
But i've checked the behavior making the matrix empty and it seems it is not possible: https://github.com/jneira/haskell-language-server/actions/runs/1378514886

@jneira
Copy link
Member Author

jneira commented Oct 26, 2021

I've tried another approach to make cleaner main job steps: create a post_job which will be a summary of all main jobs and will be succesful if those jobs are skipped by the pre_job.
This not only will clean out the skipping logic from main jobs but will let us have only three jobs as required to merge a pr: the three summary post jobs. We will not have to update required checks when adding jobs.

The caveat is we will not be able to remove specific jobs as required in the github project settings but only in the workflow file.

@jneira jneira changed the title Make github workflow honour [skip ci] Reorganize github workflows and make them honour [skip ci] Oct 26, 2021
@jneira
Copy link
Member Author

jneira commented Oct 26, 2021

Examples from my repo:

I've still not tested a cancelled job (when you cancel in the github gui you cancel the entire workflow) but i think it will work too

@jneira jneira added the merge me Label to trigger pull request merge label Oct 26, 2021
@jneira
Copy link
Member Author

jneira commented Oct 26, 2021

Will have to update required checks after merging this. Will force push without skipping ci

@jneira jneira changed the title Reorganize github workflows and make them honour [skip ci] Reorganize github workflows and make them honour skip ci Oct 26, 2021
@jneira
Copy link
Member Author

jneira commented Oct 27, 2021

I've found a issue with the [skip ci] label, it seems once you have a run with the label in the title or body, you cant revert it deleting it and rerunning jobs. The skip-duplicate-jobs skips the build cause it find another previous one with the same files, even if the commit is different (with a force push or an empty commit):

Skip execution because the exact same files have been successfully checked in https://github.com/haskell/haskell-language-server/actions/runs/1387152272

https://github.com/haskell/haskell-language-server/runs/4018414106 was skipped in this pr cause at that time the pr had [skip ci] in its title. But if you rerun it again, it does not take in account the actual title/desc without [skip ci]

So if someone uses that label incorrectly the pr could not be changed to not skip ci, but changing some file.
Not sure if this can be a problem in practice tohugh.

@jneira
Copy link
Member Author

jneira commented Oct 27, 2021

I think it is better to remove manual skip ci, let skip-dplicate-jobs do its job and use a specific label for circle ci
But i will keep post_job's as they are an improvement in its own.

@jneira jneira changed the title Reorganize github workflows and make them honour skip ci Reorganize github workflows and use specific label [skip circleci] Oct 27, 2021
@jneira
Copy link
Member Author

jneira commented Oct 27, 2021

@pepeiborra i removed the setup ci cache step here, as it seems is a no-op, let me know if you think it should be kept

@jneira
Copy link
Member Author

jneira commented Oct 27, 2021

The github workflow will make a comment in the pr to skip circleci as well. circli will look at comments too

See example here: jneira#44

@jneira jneira merged commit 2feabf3 into haskell:master Oct 28, 2021
pepeiborra pushed a commit that referenced this pull request Nov 2, 2021
…2297)

* Use post job to set workflow status

* Apply post_job trick to bench and nix

* Change label to skip circleci

* Delete setup cache ide step

* Skip circle ci when skipping gh

* No skip circleci if its config change

* Look for skip label in comments as well

* Add missing condition

* Use a explicit github token
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge me Label to trigger pull request merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants