Skip to content

CI: fix when GitHub Actions builds trigger, and allow ci skips #18333

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

Merged
merged 1 commit into from
Feb 5, 2021

Conversation

rgommers
Copy link
Member

@rgommers rgommers commented Feb 4, 2021

Similar to what SciPy does. Right now, it triggers even on pushes to branches on forks, which is useless and generates lots of notifications on failures and wasted resources if no failures.

Similar to what SciPy does. Right now, it triggers even on pushes
to branches on forks, which is useless and generates lots of
notifications on failures and wasted resources if no failures.
@@ -12,6 +20,7 @@ env:

jobs:
smoke_test:
if: "github.repository == 'numpy/numpy' && !contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip github]')"
runs-on: ubuntu-latest
Copy link
Member

Choose a reason for hiding this comment

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

I think this line can be broken, see https://stackoverflow.com/a/3790497.

Copy link
Member Author

Choose a reason for hiding this comment

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

I did this on purpose actually. It may be necessary to copy this to each job (it is in SciPy, it may not be needed here because the other jobs depend on smoke_test), and then longer vertical blocks for what's basically boilerplate becomes annoying.

I'd prefer to leave it as is for now.

@mattip
Copy link
Member

mattip commented Feb 4, 2021

Is this the same text used to skip CI on travis and/or Azure and/or shippable? It would be nice to have a github-specific skip phrase as well, so we could select which CI service to skip. We should also document the skip phrases somewhere. Where would be a better place than googling it each time?

@rgommers
Copy link
Member Author

rgommers commented Feb 5, 2021

Is this the same text used to skip CI on travis and/or Azure and/or shippable? It would be nice to have a github-specific skip phrase as well, so we could select which CI service to skip.

Yes, this PR contains a check for [skip github] which is specific.

@rgommers
Copy link
Member Author

rgommers commented Feb 5, 2021

We should also document the skip phrases somewhere. Where would be a better place than googling it each time?

Good idea. How about https://numpy.org/devdocs/dev/development_workflow.html?

@mattip
Copy link
Member

mattip commented Feb 5, 2021

Documenting it either in Asking for your changes to be merged or Additional things ... sounds good, with a small preference for the former. Would you like to add that here or in a separate PR?

@rgommers
Copy link
Member Author

rgommers commented Feb 5, 2021

Documenting it either in Asking for your changes to be merged or Additional things ... sounds good, with a small preference for the former. Would you like to add that here or in a separate PR?

Agree, I can put it there. Prefer a follow-up PR. This is actively annoying me with failed builds whenever I push any commit to my own fork, so I'd like to get it in as is.

@mattip mattip merged commit 2f466b3 into numpy:master Feb 5, 2021
@mattip
Copy link
Member

mattip commented Feb 5, 2021

Thanks @rgommers

@rgommers rgommers deleted the fix-ghactions-trigger branch February 5, 2021 14:55
@charris
Copy link
Member

charris commented Feb 5, 2021

it may be necessary to copy this to each job

Appveyor is the only platform that may need copies and a yml alias would be easier to maintain than multiple long strings.

@rgommers
Copy link
Member Author

rgommers commented Feb 5, 2021

Verified it works as expected on my fork:

image

image

@rgommers
Copy link
Member Author

rgommers commented Feb 5, 2021

@charris what's a yml alias?

What I meant is, you can only put this under a job, so may need to repeat it multiple times in a file (example: https://github.com/scipy/scipy/blob/master/.github/workflows/linux.yml#L16) and per yml file.

@charris
Copy link
Member

charris commented Feb 5, 2021

@rgommers
Copy link
Member Author

rgommers commented Feb 5, 2021

Thanks, learned something. Likely won't work though, from the atlassian link:

YAML anchors and aliases cannot contain the ' [ ', ' ] ', ' { ', ' } ', and ' , ' characters.

So looks like you cannot encode [ci skip] et al.

@charris
Copy link
Member

charris commented Feb 5, 2021

@rgommers I think that refers to the variable names, not the values. Strings are strings.

@charris
Copy link
Member

charris commented Feb 5, 2021

aliases:
    - &test "[hi]"

hi: &test

Passed a yaml validator.

@charris charris added the 09 - Backport-Candidate PRs tagged should be backported label Feb 5, 2021
@charris charris added this to the 1.20.1 release milestone Feb 5, 2021
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Feb 5, 2021
@charris charris removed this from the 1.20.1 release milestone Feb 5, 2021
@rgommers
Copy link
Member Author

rgommers commented Feb 6, 2021

Looked into it, it's valid yaml but not supported by GitHub Actions: https://github.community/t/support-for-yaml-anchors/16128/20. Looks like that's still the status today, which explains why I've never seen that syntax before.

I'll send a PR for the docs.

rgommers added a commit to rgommers/numpy that referenced this pull request Feb 6, 2021
This is a follow-up to numpygh-18333.

Self-test: docs get built on CircleCI, so let's skip the other
platforms:

[skip github]
[skip azurepipelines]
[skip appveyor]
[skip travis]
seberg pushed a commit to rgommers/numpy that referenced this pull request Oct 20, 2021
This is a follow-up to numpygh-18333.

Self-test: docs get built on CircleCI, so let's skip the other
platforms:

[skip github]
[skip azurepipelines]
[skip appveyor]
[skip travis]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants