Skip to content

Commit

Permalink
workflows: Skip jobs instead of workflows
Browse files Browse the repository at this point in the history
[ upstream commit b08f700 ]

In its initial version, commit 3ceb742 (".github: Skip unnecessary docs
test") skipped the job instead of the whole workflow, based on changed
code paths. After discussion on the pull request [1], we figured we
could save some seconds by skipping the whole workflow instead of the
job. Skipping the job requires adding a new job to check the code paths.

However, if we skip the whole workflow, the job status is never reported
on GitHub. Since the documentation job is required to merge, that means
maintainer's little helper will never mark the pull request as ready to
merge.

Thus, this commit reverts back to skipping the jobs instead of the whole
workflows. To that end, we use paths-filter GitHub Action instead of the
direct GitHub integration (since the GitHub path filters can only skip
the whole workflow).

1 - #16157 (comment)
Signed-off-by: Paul Chaignon <paul@cilium.io>
Signed-off-by: Nate Sweet <nathanjsweet@pm.me>
  • Loading branch information
pchaigno authored and christarazi committed Jun 22, 2021
1 parent 1d2fb40 commit 17c72c8
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 45 deletions.
42 changes: 25 additions & 17 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,41 @@ name: Documentation Updates

# Any change in triggers needs to be reflected in the concurrency group.
on:
pull_request:
paths:
- 'Documentation/**'
- 'bugtool/cmd/**'
- 'cilium/cmd/**'
- 'cilium-health/cmd/**'
- 'daemon/cmd/**'
- 'hubble-relay/cmd/**'
- 'operator/cmd/**'
pull_request: {}
push:
branches:
- master
paths:
- 'Documentation/**'
- 'bugtool/cmd/**'
- 'cilium/cmd/**'
- 'cilium-health/cmd/**'
- 'daemon/cmd/**'
- 'hubble-relay/cmd/**'
- 'operator/cmd/**'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.after }}
cancel-in-progress: true

jobs:
check_changes:
name: Deduce required tests from code changes
runs-on: ubuntu-18.04
outputs:
docs-tree: ${{ steps.docs-tree.outputs.src }}
steps:
- name: Check code changes
uses: dorny/paths-filter@78ab00f87740f82aec8ed8826eb4c3c851044126
id: docs-tree
with:
filters: |
src:
- 'Documentation/**'
- 'bugtool/cmd/**'
- 'cilium/cmd/**'
- 'cilium-health/cmd/**'
- 'daemon/cmd/**'
- 'hubble-relay/cmd/**'
- 'operator/cmd/**'
# Runs only if code under Documentation or */cmd/ is changed as the docs
# should be unaffected otherwise.
build-html:
needs: check_changes
if: ${{ needs.check_changes.outputs.docs-tree == 'true' }}
name: Validate & Build HTML
runs-on: ubuntu-18.04
steps:
Expand Down
38 changes: 26 additions & 12 deletions .github/workflows/lint-codeql.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
name: codeql

on:
push:
branches:
- master
- v1.9
- v1.8
- v1.7
pull_request:
branches:
- master
push: {}
pull_request: {}
schedule:
- cron: "45 6 * * 3"

jobs:
check_changes:
name: Deduce required tests from code changes
runs-on: ubuntu-18.04
outputs:
go-changes: ${{ steps.go-changes.outputs.src }}
steps:
- name: Checkout code
if: ${{ !github.event.pull_request }}
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
persist-credentials: false
- name: Check code changes
uses: dorny/paths-filter@b2feaf19c27470162a626bd6fa8438ae5b263721
id: go-changes
with:
filters: |
src:
- '*.go'
- 'go.mod'
- 'go.sum'
analyze:
if: github.repository == 'cilium/cilium'
needs: check_changes
if: github.repository == 'cilium/cilium' && needs.check_changes.outputs.go-changes == 'true'
runs-on: ubuntu-18.04
strategy:
fail-fast: false
steps:
- name: Checkout repo
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
Expand All @@ -31,3 +44,4 @@ jobs:
languages: go
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@b7dd4a6f2c343e29a9ab8e181b2f540816f28bd7

25 changes: 17 additions & 8 deletions .github/workflows/tests-smoke-ipv6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,10 @@ name: Smoke Test with IPv6

# Any change in triggers needs to be reflected in the concurrency group.
on:
pull_request:
paths-ignore:
- 'Documentation/**'
- 'test/**'
pull_request: {}
push:
branches:
- master
paths-ignore:
- 'Documentation/**'
- 'test/**'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.after }}
Expand All @@ -26,8 +20,23 @@ env:
LOG_TIME: 30m

jobs:
check_changes:
name: Deduce required tests from code changes
runs-on: ubuntu-18.04
outputs:
tested: ${{ steps.tested-tree.outputs.src }}
steps:
- name: Check code changes
uses: dorny/paths-filter@78ab00f87740f82aec8ed8826eb4c3c851044126
id: tested-tree
with:
filters: |
src:
- '!(test|Documentation)/**'
conformance-test-ipv6:
if: ${{ github.repository == 'cilium/cilium' }}
needs: check_changes
if: ${{ github.repository == 'cilium/cilium' && needs.check_changes.outputs.tested == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
25 changes: 17 additions & 8 deletions .github/workflows/tests-smoke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,10 @@ name: Smoke test

# Any change in triggers needs to be reflected in the concurrency group.
on:
pull_request:
paths-ignore:
- 'Documentation/**'
- 'test/**'
pull_request: {}
push:
branches:
- master
paths-ignore:
- 'Documentation/**'
- 'test/**'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.after }}
Expand All @@ -25,6 +19,20 @@ env:
LOG_TIME: 30m

jobs:
check_changes:
name: Deduce required tests from code changes
runs-on: ubuntu-18.04
outputs:
tested: ${{ steps.tested-tree.outputs.src }}
steps:
- name: Check code changes
uses: dorny/paths-filter@78ab00f87740f82aec8ed8826eb4c3c851044126
id: tested-tree
with:
filters: |
src:
- '!(test|Documentation)/**'
preflight-clusterrole:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -69,7 +77,8 @@ jobs:
git diff --exit-code || (echo "please run 'make -C install/kubernetes docs' and submit your changes"; exit 1)
conformance-test:
if: ${{ github.repository == 'cilium/cilium' }}
needs: check_changes
if: ${{ github.repository == 'cilium/cilium' && needs.check_changes.outputs.tested == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down

0 comments on commit 17c72c8

Please sign in to comment.