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

Always run GitHub action jobs, even on documentation-only jobs #84728

Closed
vstinner opened this issue May 7, 2020 · 17 comments
Closed

Always run GitHub action jobs, even on documentation-only jobs #84728

vstinner opened this issue May 7, 2020 · 17 comments
Labels
3.9 only security fixes build The build process and cross-build

Comments

@vstinner
Copy link
Member

vstinner commented May 7, 2020

BPO 40548
Nosy @vstinner, @jstasiak, @miss-islington, @FFY00
PRs
  • bpo-40548: Always run GitHub action, even on doc PRs #19981
  • bpo-40548: skip build/tests on documentation changes #19983
  • bpo-40548: github actions: pass the changes check on no source changes #20097
  • [3.8] bpo-40548: GitHub Action workflow: skip jobs on doc only PRs #20100
  • [3.7] [3.8] bpo-40548: GitHub Action workflow: skip jobs on doc only PRs (GH-20100) #20101
  • bpo-40548: Github Actions: update actions/checkout to v2 #20164
  • [3.7] bpo-40548: Github Actions: update actions/checkout to v2 (GH-20164) #20178
  • [3.8] bpo-40548: Github Actions: update actions/checkout to v2 (GH-20164) #20179
  • bpo-40548: test for https://github.com/python/core-workflow/issues/368 #20740
  • bpo-40548: Fix "Check for source changes (pull_request)" GH Action job #21806
  • bpo-40548: [WIP] Documentation only PR #21812
  • [3.8] bpo-40548: Fix "Check for source changes (pull_request)" GH Action job (GH-21806) #21813
  • [3.9] bpo-40548: Fix "Check for source changes (pull_request)" GH Action job (GH-21806) #21814
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2020-05-18.14:18:46.803>
    created_at = <Date 2020-05-07.17:39:37.087>
    labels = ['build', '3.9']
    title = 'Always run GitHub action jobs, even on documentation-only jobs'
    updated_at = <Date 2020-08-10.17:09:45.684>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2020-08-10.17:09:45.684>
    actor = 'miss-islington'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-05-18.14:18:46.803>
    closer = 'vstinner'
    components = ['Build']
    creation = <Date 2020-05-07.17:39:37.087>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 40548
    keywords = ['patch']
    message_count = 17.0
    messages = ['368357', '368359', '368361', '368366', '368372', '368384', '368870', '368915', '368922', '368924', '369210', '369225', '369226', '369230', '375129', '375131', '375132']
    nosy_count = 4.0
    nosy_names = ['vstinner', 'jstasiak', 'miss-islington', 'FFY00']
    pr_nums = ['19981', '19983', '20097', '20100', '20101', '20164', '20178', '20179', '20740', '21806', '21812', '21813', '21814']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue40548'
    versions = ['Python 3.9']

    @vstinner
    Copy link
    Member Author

    vstinner commented May 7, 2020

    bpo-39837 made Azure Pipelines CI non-mandatory. Travis CI was made mandatory to have at least one mandatory job: python/core-workflow#365

    I would prefer to have at least one mandatory Windows CI running on Python pull requests. Before we had pre-commit checks, it was too common to break Windows. I would prefer to not regress on that aspect.

    --

    Currently, GitHub action jobs ignore "documentation-only" changes. Extract of .github/workflows/build.yml:

    on:
    push:
    branches:
    - master
    - 3.8
    - 3.7
    paths-ignore:
    - 'Doc/'
    - 'Misc/
    '
    - '**/.md'
    - '**/
    .rst'

    If a job is marked as mandatory but the GitHub action is skipped because of paths-ignore, the PR cannot be merged :-( It seems to be a known GitHub limitation which is not going to be fixed soon:
    https://discuss.python.org/t/make-one-windows-ci-job-mandatory/4047/6

    To workaround is to always run GitHub action jobs, even on documentation-only jobs.

    I propose to always run GitHub actions and then make the Windows (64 bit) job mandatory.

    --

    Sadly, it will waste resources for documentation-only jobs. To avoid that, the Windows job can be modified later to be skipped if it detects that the PR is a documentation-only change.

    Steve Dower wrote:
    "That workaround looks roughly like what is in the Azure Pipelines files. Someone just needs the time to go and migrate it."
    https://discuss.python.org/t/make-one-windows-ci-job-mandatory/4047/6

    Note: the Travis CI job (.travis.yml) uses the following check:

      # Pull requests are slightly complicated because $TRAVIS_COMMIT_RANGE
      # may include more changes than desired if the history is convoluted.
      # Instead, explicitly fetch the base branch and compare against the
      # merge-base commit.
      git fetch -q origin +refs/heads/$TRAVIS_BRANCH
      changes=$(git diff --name-only HEAD $(git merge-base HEAD FETCH_HEAD))
      echo "Files changed:"
      echo "$changes"
      if ! echo "$changes" | grep -qvE '(\.rst$)|(^Doc)|(^Misc)'
      then
        echo "Only docs were updated, stopping build process."
        exit
      fi
    

    --

    More background on these CI issues:

    @vstinner vstinner added 3.9 only security fixes build The build process and cross-build labels May 7, 2020
    @FFY00
    Copy link
    Member

    FFY00 commented May 7, 2020

    The workaround presented at https://github.community/t5/GitHub-Actions/Feature-request-conditional-required-checks/m-p/51344/highlight/true#M8157 seems pretty reasonable. And it seems like travis is alerady doing the same thing as it doesn't have native support to skip runs based on path changes.

    I can open a PR if you want.

    @vstinner
    Copy link
    Member Author

    vstinner commented May 7, 2020

    The workaround presented at https://github.community/t5/GitHub-Actions/Feature-request-conditional-required-checks/m-p/51344/highlight/true#M8157 seems pretty reasonable. And it seems like travis is alerady doing the same thing as it doesn't have native support to skip runs based on path changes.

    I suppose that Steve Dower mentioned the following part of .azure-pipelines/prebuild-checks.yml:
    ----------------

    • script: |
      if ! git diff --name-only $(diffTarget) | grep -qvE '(\.rst$|^Doc|^Misc)'
      then
      echo "Only docs were updated: tests.run=false"
      echo "##vso[task.setvariable variable=run;isOutput=true]false"
      else
      echo "Code was updated: tests.run=true"
      echo "##vso[task.setvariable variable=run;isOutput=true]true"
      fi
      displayName: Detect source changes
      name: tests
      ----------------

    I understood that he proposed to port it inside the Windows job of GitHub actions (.github/workflows/build.yml).

    I propose the following plan:

    • Always run GitHub Action jobs
    • Make Windows 64-bit job mandatory
    • And only then try to skip documentation-only changes

    @FFY00
    Copy link
    Member

    FFY00 commented May 7, 2020

    • And only then try to skip documentation-only changes

    Done :)

    @vstinner
    Copy link
    Member Author

    vstinner commented May 7, 2020

    New changeset 4e36376 by Victor Stinner in branch 'master':
    bpo-40548: Always run GitHub action, even on doc PRs (GH-19981)
    4e36376

    @vstinner
    Copy link
    Member Author

    vstinner commented May 7, 2020

    I propose the following plan:

    • Always run GitHub Action jobs

    Done.

    • Make Windows 64-bit job mandatory

    My request: python/core-workflow#368

    @vstinner
    Copy link
    Member Author

    New changeset 75d7257 by Filipe Laíns in branch 'master':
    bpo-40548: GitHub Action workflow: skip jobs on doc only PRs (GH-19983)
    75d7257

    @vstinner
    Copy link
    Member Author

    New changeset 6a78589 by Filipe Laíns in branch 'master':
    bpo-40548: github actions: pass the changes check on no source changes (GH-20097)
    6a78589

    @vstinner
    Copy link
    Member Author

    New changeset 07bd5cf by Victor Stinner in branch '3.8':
    [3.8] bpo-40548: GitHub Action workflow: skip jobs on doc only PRs (GH-20100)
    07bd5cf

    @miss-islington
    Copy link
    Contributor

    New changeset 6ad51a1 by Miss Islington (bot) in branch '3.7':
    [3.8] bpo-40548: GitHub Action workflow: skip jobs on doc only PRs (GH-20100)
    6ad51a1

    @vstinner
    Copy link
    Member Author

    New changeset c444108 by Filipe Laíns in branch 'master':
    bpo-40548: Github Actions: update actions/checkout to v2 (GH-20164)
    c444108

    @miss-islington
    Copy link
    Contributor

    New changeset 9ecf25e by Miss Islington (bot) in branch '3.7':
    bpo-40548: Github Actions: update actions/checkout to v2 (GH-20164)
    9ecf25e

    @miss-islington
    Copy link
    Contributor

    New changeset d8cbfa2 by Miss Islington (bot) in branch '3.8':
    bpo-40548: Github Actions: update actions/checkout to v2 (GH-20164)
    d8cbfa2

    @vstinner
    Copy link
    Member Author

    The initial issue (be able to make a GitHub action job mandatory) is now fixed, I close the issue.

    Making Windows x64 job mandatory is now tracked at: python/core-workflow#368

    @vstinner
    Copy link
    Member Author

    New changeset eaa5517 by Victor Stinner in branch 'master':
    bpo-40548: Fix "Check for source changes (pull_request)" GH Action job (GH-21806)
    eaa5517

    @miss-islington
    Copy link
    Contributor

    New changeset 09d8260 by Miss Islington (bot) in branch '3.8':
    bpo-40548: Fix "Check for source changes (pull_request)" GH Action job (GH-21806)
    09d8260

    @miss-islington
    Copy link
    Contributor

    New changeset 2cd58d8 by Miss Islington (bot) in branch '3.9':
    bpo-40548: Fix "Check for source changes (pull_request)" GH Action job (GH-21806)
    2cd58d8

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes build The build process and cross-build
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants