From a0ef0f2de5f68a5413f80cc74ba29950c7cade33 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Nov 2024 12:37:28 +0100 Subject: [PATCH 1/3] Try to run windows-ci only if travis ok first. --- .github/workflows/gh-travis.yml | 1 + .github/workflows/phan.yml | 1 + .github/workflows/phpstan.yml | 4 ++-- .github/workflows/pre-commit.yml | 1 + .github/workflows/windows-ci.yml | 7 +++++++ 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gh-travis.yml b/.github/workflows/gh-travis.yml index 30c10765f07..529e261cf18 100644 --- a/.github/workflows/gh-travis.yml +++ b/.github/workflows/gh-travis.yml @@ -10,6 +10,7 @@ on: gh_event: required: true type: string + # can run job manually workflow_dispatch: concurrency: diff --git a/.github/workflows/phan.yml b/.github/workflows/phan.yml index 56a33ef76c7..66faba3a577 100644 --- a/.github/workflows/phan.yml +++ b/.github/workflows/phan.yml @@ -10,6 +10,7 @@ on: gh_event: required: true type: string + # can run job manually workflow_dispatch: concurrency: diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index c638ee83e50..e1f2749566d 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -10,11 +10,11 @@ on: gh_event: required: true type: string + # can run job manually workflow_dispatch: concurrency: - group: stan-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref - }} + group: stan-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true env: gh_event: ${{ inputs.gh_event || github.event_name }} diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 8adc5051bc2..da71822c32b 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -8,6 +8,7 @@ on: gh_event: required: true type: string + # can run job manually workflow_dispatch: concurrency: diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml index e7d330324dd..daa81ada250 100644 --- a/.github/workflows/windows-ci.yml +++ b/.github/workflows/windows-ci.yml @@ -9,7 +9,13 @@ on: gh_event: required: true type: string + # can run job manually workflow_dispatch: + # Run if workflow is Travis is ok only + workflow_run: + workflows: ["Travis"] + types: + - completed concurrency: group: win-ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref @@ -27,6 +33,7 @@ env: GITHUB_JSON: ${{ toJSON(github) }} # Helps in debugging Github Action jobs: win-test: + if: ${{ github.event.workflow_run.conclusion == 'success' }} strategy: matrix: os: [windows-latest] From e04ca761032e4ca5b891facfb3db95724405c3a7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Nov 2024 12:49:30 +0100 Subject: [PATCH 2/3] Doc github actions --- .github/workflows/gh-travis.yml | 3 +-- .github/workflows/phan.yml | 6 +----- .github/workflows/phpstan.yml | 3 +-- .github/workflows/pre-commit.yml | 3 +-- .github/workflows/windows-ci.yml | 9 +-------- 5 files changed, 5 insertions(+), 19 deletions(-) diff --git a/.github/workflows/gh-travis.yml b/.github/workflows/gh-travis.yml index 529e261cf18..9d1d6aa4de0 100644 --- a/.github/workflows/gh-travis.yml +++ b/.github/workflows/gh-travis.yml @@ -3,8 +3,7 @@ name: Travis # Controls when the workflow will run on: - # push: - # pull_request: + # workflow called by the parent workflow ci.yml workflow_call: inputs: gh_event: diff --git a/.github/workflows/phan.yml b/.github/workflows/phan.yml index 66faba3a577..e2ce5a75443 100644 --- a/.github/workflows/phan.yml +++ b/.github/workflows/phan.yml @@ -1,10 +1,6 @@ --- on: - # pull_request: - # push: - # schedule: - # # execute once a day, the 1st - # - cron: 10 9 * * * + # workflow called by the parent workflow ci.yml workflow_call: inputs: gh_event: diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index e1f2749566d..83f070aba44 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -3,8 +3,7 @@ name: PHPStan # Controls when the workflow will run on: - # push: - # pull_request: + # workflow called by the parent workflow ci.yml workflow_call: inputs: gh_event: diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index da71822c32b..e07dfabf259 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -1,8 +1,7 @@ --- name: pre-commit on: - # pull_request: - # push: + # workflow called by the parent workflow ci.yml workflow_call: inputs: gh_event: diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml index daa81ada250..50d9d4386f9 100644 --- a/.github/workflows/windows-ci.yml +++ b/.github/workflows/windows-ci.yml @@ -2,8 +2,7 @@ name: Win CI # yamllint disable-line rule:truthy on: - # push: - # pull_request: + # workflow called by the parent workflow ci.yml workflow_call: inputs: gh_event: @@ -11,11 +10,6 @@ on: type: string # can run job manually workflow_dispatch: - # Run if workflow is Travis is ok only - workflow_run: - workflows: ["Travis"] - types: - - completed concurrency: group: win-ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref @@ -33,7 +27,6 @@ env: GITHUB_JSON: ${{ toJSON(github) }} # Helps in debugging Github Action jobs: win-test: - if: ${{ github.event.workflow_run.conclusion == 'success' }} strategy: matrix: os: [windows-latest] From 85108b974f17e13f47c9beeb8ef6699c5b26a265 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Nov 2024 12:54:42 +0100 Subject: [PATCH 3/3] Split ci sheduler in 2 files --- .github/workflows/ci-on-pull_request.yml | 39 ++++++++++++++++++++ .github/workflows/{ci.yml => ci-on-push.yml} | 3 +- 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci-on-pull_request.yml rename .github/workflows/{ci.yml => ci-on-push.yml} (97%) diff --git a/.github/workflows/ci-on-pull_request.yml b/.github/workflows/ci-on-pull_request.yml new file mode 100644 index 00000000000..79f6ee9a2a5 --- /dev/null +++ b/.github/workflows/ci-on-pull_request.yml @@ -0,0 +1,39 @@ +name: "CI" + +on: [pull_request] +jobs: + pre-commit: + uses: ./.github/workflows/pre-commit.yml + secrets: inherit + with: + gh_event: ${{ github.event_name }} + phan: + uses: ./.github/workflows/phan.yml + secrets: inherit + with: + gh_event: ${{ github.event_name }} + phpstan: + uses: ./.github/workflows/phpstan.yml + secrets: inherit + needs: [pre-commit, phan] + with: + gh_event: ${{ github.event_name }} + #windows-ci: + # needs: [pre-commit, phan] + # secrets: inherit + # uses: ./.github/workflows/windows-ci.yml + # with: + # gh_event: ${{ github.event_name }} + gh-travis: # Runs travis script on github runner (not on travis) + if: false + # needs: [pre-commit, phan] + # needs: [windows-ci] + secrets: inherit + uses: ./.github/workflows/gh-travis.yml + with: + gh_event: ${{ github.event_name }} + +# Note (not tested, from https://github.com/orgs/community/discussions/38361) +# To cancel jobs if one failes, the following action may help +# - if: "failure()" +# uses: "andymckay/cancel-action@0.3" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci-on-push.yml similarity index 97% rename from .github/workflows/ci.yml rename to .github/workflows/ci-on-push.yml index 39edbc3496b..69582c7f927 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci-on-push.yml @@ -1,6 +1,6 @@ name: "CI" -on: [push, pull_request] +on: [push] jobs: pre-commit: uses: ./.github/workflows/pre-commit.yml @@ -33,7 +33,6 @@ jobs: with: gh_event: ${{ github.event_name }} - # Note (not tested, from https://github.com/orgs/community/discussions/38361) # To cancel jobs if one failes, the following action may help # - if: "failure()"