@cryptotaxi247 / netdata-1 / commits / a4b568f90

Attempt to more aggressively skip CI jobs on PRs if those jobs are irrelevant to the PR. (#15341)

* Skip checks workflow cleanly for non-code PRs. * Skip build workflow for PRs that it is not relevant on. * Skip docker CI workflow on PRs when it’s not relevant. * Skip packaging workflow on PRs that it is not relevant for. * Fix actionlint errors. * Fix typos.

Austin S. Hemmelgarn committed Jul 11, 2023 at 10:08 UTC a4b568f9047c7ab86d5d0c1e3813bd31b5befc06
8 files changed +421 -3
.github/workflows/build-dummy.yml new
+141
@@ -0,0 +1,141 @@
1 +---
2 +# Ci code for building release artifacts.
3 +#
4 +# This workflow exists so we can require these checks to pass, but skip
5 +# them on PRs that have nothing to do with the source code.
6 +name: Build
7 +on:
8 + pull_request: # PR checks only validate the build and generate artifacts for testing.
9 + paths-ignore: # This MUST be kept in-sync with the paths-ignore key for the build-dummy.yml workflow.
10 + - '**.c'
11 + - '**.cc'
12 + - '**.h'
13 + - '**.hh'
14 + - '**.in'
15 + - '!netdata.spec.in'
16 + - 'configure.ac'
17 + - 'netdata-installer.sh'
18 + - '**/Makefile*'
19 + - 'Makefile*'
20 + - '.github/workflows/build.yml'
21 + - '.github/scripts/build-static.sh'
22 + - '.github/scripts/get-static-cache-key.sh'
23 + - '.github/scripts/gen-matrix-build.py'
24 + - '.github/scripts/run-updater-check.sh'
25 + - 'build/**'
26 + - 'packaging/makeself/**'
27 + - 'packaging/installer/**'
28 + - 'aclk/aclk-schemas/'
29 + - 'ml/dlib/'
30 + - 'mqtt_websockets'
31 + - 'web/server/h2o/libh2o'
32 + - '!**.md'
33 +concurrency: # This keeps multiple instances of the job from running concurrently for the same ref and event type.
34 + group: build-${{ github.ref }}-${{ github.event_name }}
35 + cancel-in-progress: true
36 +jobs:
37 + build-dist: # Build the distribution tarball and store it as an artifact.
38 + name: Build Distribution Tarball
39 + runs-on: ubuntu-latest
40 + steps:
41 + - run: echo 'NOT REQUIRED'
42 +
43 + build-static: # Build the static binary archives, and store them as artifacts.
44 + name: Build Static
45 + runs-on: ubuntu-latest
46 + strategy:
47 + matrix:
48 + arch:
49 + - x86_64
50 + - armv7l
51 + - aarch64
52 + - ppc64le
53 + steps:
54 + - run: echo 'NOT REQUIRED'
55 +
56 + matrix: # Generate the shared build matrix for our build tests.
57 + name: Prepare Build Matrix
58 + runs-on: ubuntu-latest
59 + outputs:
60 + matrix: ${{ steps.set-matrix.outputs.matrix }}
61 + steps:
62 + - name: Checkout
63 + id: checkout
64 + uses: actions/checkout@v3
65 + - name: Prepare tools
66 + id: prepare
67 + run: |
68 + sudo apt-get update && sudo apt-get install -y python3-ruamel.yaml
69 + - name: Read build matrix
70 + id: set-matrix
71 + run: |
72 + matrix="$(.github/scripts/gen-matrix-build.py)"
73 + echo "Generated matrix: ${matrix}"
74 + echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}"
75 +
76 + prepare-test-images: # Prepare the test environments for our build checks. This also checks dependency handling code for each tested environment.
77 + name: Prepare Test Environments
78 + runs-on: ubuntu-latest
79 + needs:
80 + - matrix
81 + env:
82 + RETRY_DELAY: 300
83 + strategy:
84 + # Unlike the actual build tests, this completes _very_ fast (average of about 3 minutes for each job), so we
85 + # just run everything in parallel instead lof limiting job concurrency.
86 + fail-fast: false
87 + matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
88 + steps:
89 + - run: echo 'NOT REQUIRED'
90 +
91 + source-build: # Test various source build arrangements.
92 + name: Test Source Build
93 + runs-on: ubuntu-latest
94 + needs:
95 + - matrix
96 + - prepare-test-images
97 + strategy:
98 + fail-fast: false
99 + max-parallel: 8
100 + matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
101 + steps:
102 + - run: echo 'NOT REQUIRED'
103 +
104 + updater-check: # Test the generated dist archive using the updater code.
105 + name: Test Generated Distfile and Updater Code
106 + runs-on: ubuntu-latest
107 + needs:
108 + - build-dist
109 + - matrix
110 + - prepare-test-images
111 + strategy:
112 + fail-fast: false
113 + max-parallel: 8
114 + matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
115 + steps:
116 + - run: echo 'NOT REQUIRED'
117 +
118 + prepare-upload: # Consolidate the artifacts for uploading or releasing.
119 + name: Prepare Artifacts
120 + runs-on: ubuntu-latest
121 + needs:
122 + - build-dist
123 + - build-static
124 + steps:
125 + - run: echo 'NOT REQUIRED'
126 +
127 + artifact-verification-dist: # Verify the regular installer works with the consolidated artifacts.
128 + name: Test Consolidated Artifacts (Source)
129 + runs-on: ubuntu-latest
130 + needs:
131 + - prepare-upload
132 + steps:
133 + - run: echo 'NOT REQUIRED'
134 +
135 + artifact-verification-static: # Verify the static installer works with the consolidated artifacts.
136 + name: Test Consolidated Artifacts (Static)
137 + runs-on: ubuntu-latest
138 + needs:
139 + - prepare-upload
140 + steps:
141 + - run: echo 'NOT REQUIRED'
.github/workflows/build.yml
+25 -1
@@ -5,7 +5,31 @@ on:
5 push: # Master branch checks only validate the build and generate artifacts for testing.
6 branches:
7 - master
8 - pull_request: null # PR checks only validate the build and generate artifacts for testing.
8 + pull_request: # PR checks only validate the build and generate artifacts for testing.
9 + paths: # This MUST be kept in-sync with the paths-ignore key for the build-dummy.yml workflow.
10 + - '**.c'
11 + - '**.cc'
12 + - '**.h'
13 + - '**.hh'
14 + - '**.in'
15 + - '!netdata.spec.in'
16 + - 'configure.ac'
17 + - 'netdata-installer.sh'
18 + - '**/Makefile*'
19 + - 'Makefile*'
20 + - '.github/workflows/build.yml'
21 + - '.github/scripts/build-static.sh'
22 + - '.github/scripts/get-static-cache-key.sh'
23 + - '.github/scripts/gen-matrix-build.py'
24 + - '.github/scripts/run-updater-check.sh'
25 + - 'build/**'
26 + - 'packaging/makeself/**'
27 + - 'packaging/installer/**'
28 + - 'aclk/aclk-schemas/'
29 + - 'ml/dlib/'
30 + - 'mqtt_websockets'
31 + - 'web/server/h2o/libh2o'
32 + - '!**.md'
33 workflow_dispatch: # Dispatch runs build and validate, then push to the appropriate storage location.
34 inputs:
35 type:
.github/workflows/checks-dummy.yml new
+42
@@ -0,0 +1,42 @@
1 +---
2 +name: Checks
3 +on:
4 + pull_request:
5 + paths-ignore: # This MUST be kept in sync with the paths key for the checks.yml workflow.
6 + - '**.c'
7 + - '**.cc'
8 + - '**.h'
9 + - '**.hh'
10 + - '**.in'
11 + - '!netdata.spec.in'
12 + - 'configure.ac'
13 + - '**/Makefile*'
14 + - 'Makefile*'
15 + - '.gitignore'
16 + - '.github/workflows/checks.yml'
17 + - 'build/**'
18 + - 'aclk/aclk-schemas/'
19 + - 'ml/dlib/'
20 + - 'mqtt_websockets'
21 + - 'web/server/h2o/libh2o'
22 +env:
23 + DISABLE_TELEMETRY: 1
24 +concurrency:
25 + group: checks-${{ github.ref }}
26 + cancel-in-progress: true
27 +jobs:
28 + libressl-checks:
29 + name: LibreSSL
30 + runs-on: ubuntu-latest
31 + steps:
32 + - run: "echo 'NOT REQUIRED'"
33 + clang-checks:
34 + name: Clang
35 + runs-on: ubuntu-latest
36 + steps:
37 + - run: "echo 'NOT REQUIRED'"
38 + gitignore-check:
39 + name: .gitignore
40 + runs-on: ubuntu-latest
41 + steps:
42 + - run: "echo 'NOT REQUIRED'"
.github/workflows/checks.yml
+35 -1
@@ -2,9 +2,43 @@
2 name: Checks
3 on:
4 push:
5 + paths:
6 + - '**.c'
7 + - '**.cc'
8 + - '**.h'
9 + - '**.hh'
10 + - '**.in'
11 + - '!netdata.spec.in'
12 + - 'configure.ac'
13 + - '**/Makefile*'
14 + - 'Makefile*'
15 + - '.gitignore'
16 + - '.github/workflows/checks.yml'
17 + - 'build/**'
18 + - 'aclk/aclk-schemas/'
19 + - 'ml/dlib/'
20 + - 'mqtt_websockets'
21 + - 'web/server/h2o/libh2o'
22 branches:
23 - master
7 - pull_request: null
24 + pull_request:
25 + paths: # This MUST be kept in-sync with the paths-ignore key for the checks-dummy.yml workflow.
26 + - '**.c'
27 + - '**.cc'
28 + - '**.h'
29 + - '**.hh'
30 + - '**.in'
31 + - '!netdata.spec.in'
32 + - 'configure.ac'
33 + - '**/Makefile*'
34 + - 'Makefile*'
35 + - '.gitignore'
36 + - '.github/workflows/checks.yml'
37 + - 'build/**'
38 + - 'aclk/aclk-schemas/'
39 + - 'ml/dlib/'
40 + - 'mqtt_websockets'
41 + - 'web/server/h2o/libh2o'
42 env:
43 DISABLE_TELEMETRY: 1
44 concurrency:
.github/workflows/docker-dummy.yml new
+51
@@ -0,0 +1,51 @@
1 +---
2 +name: Docker
3 +on:
4 + pull_request:
5 + paths-ignore: # This MUST be kept in-sync with the paths key for the dummy.yml workflow.
6 + - '**.c'
7 + - '**.cc'
8 + - '**.h'
9 + - '**.hh'
10 + - '**.in'
11 + - '!netdata.spec.in'
12 + - '.dockerignore'
13 + - 'configure.ac'
14 + - 'netdata-installer.sh'
15 + - '**/Makefile*'
16 + - 'Makefile*'
17 + - '.github/workflows/docker.yml'
18 + - '.github/scripts/docker-test.sh'
19 + - 'build/**'
20 + - 'packaging/docker/**'
21 + - 'packaging/installer/**'
22 + - 'aclk/aclk-schemas/'
23 + - 'ml/dlib/'
24 + - 'mqtt_websockets'
25 + - 'web/server/h2o/libh2o'
26 + - '!**.md'
27 +env:
28 + DISABLE_TELEMETRY: 1
29 +concurrency:
30 + group: docker-${{ github.ref }}-${{ github.event_name }}
31 + cancel-in-progress: true
32 +jobs:
33 + docker-test:
34 + name: Docker Runtime Test
35 + runs-on: ubuntu-latest
36 + steps:
37 + - run: echo 'NOT REQUIRED'
38 +
39 + docker-ci:
40 + name: Docker Alt Arch Builds
41 + needs: docker-test
42 + runs-on: ubuntu-latest
43 + strategy:
44 + matrix:
45 + platforms:
46 + - linux/i386
47 + - linux/arm/v7
48 + - linux/arm64
49 + - linux/ppc64le
50 + steps:
51 + - run: echo 'NOT REQUIRED'
.github/workflows/docker.yml
+23 -1
@@ -4,7 +4,29 @@ on:
4 push:
5 branches:
6 - master
7 - pull_request: null
7 + pull_request:
8 + paths: # This MUST be kept in-sync with the paths-ignore key for the docker-dummy.yml workflow.
9 + - '**.c'
10 + - '**.cc'
11 + - '**.h'
12 + - '**.hh'
13 + - '**.in'
14 + - '!netdata.spec.in'
15 + - '.dockerignore'
16 + - 'configure.ac'
17 + - 'netdata-installer.sh'
18 + - '**/Makefile*'
19 + - 'Makefile*'
20 + - '.github/workflows/docker.yml'
21 + - '.github/scripts/docker-test.sh'
22 + - 'build/**'
23 + - 'packaging/docker/**'
24 + - 'packaging/installer/**'
25 + - 'aclk/aclk-schemas/'
26 + - 'ml/dlib/'
27 + - 'mqtt_websockets'
28 + - 'web/server/h2o/libh2o'
29 + - '!**.md'
30 workflow_dispatch:
31 inputs:
32 version:
.github/workflows/packaging-dummy.yml new
+81
@@ -0,0 +1,81 @@
1 +---
2 +# Handles building of binary packages for the agent.
3 +#
4 +# This workflow exists so that we can make these required checks but
5 +# still skip running them on PRs where they are not relevant.
6 +name: Packages
7 +on:
8 + pull_request:
9 + types:
10 + - opened
11 + - reopened
12 + - labeled
13 + - synchronize
14 + paths-ignore: # This MUST be kept in-sync with the paths key for the packaging.yml workflow.
15 + - '**.c'
16 + - '**.cc'
17 + - '**.h'
18 + - '**.hh'
19 + - '**.in'
20 + - 'netdata.spec.in'
21 + - 'configure.ac'
22 + - '**/Makefile*'
23 + - 'Makefile*'
24 + - '.github/workflows/packaging.yml'
25 + - '.github/scripts/gen-matrix-packaging.py'
26 + - '.github/scripts/pkg-test.sh'
27 + - 'build/**'
28 + - 'packaging/*.sh'
29 + - 'packaging/*.checksums'
30 + - 'packaging/*.version'
31 + - 'contrib/debian/**'
32 + - 'aclk/aclk-schemas/'
33 + - 'ml/dlib/'
34 + - 'mqtt_websockets'
35 + - 'web/server/h2o/libh2o'
36 + - '!**.md'
37 +env:
38 + DISABLE_TELEMETRY: 1
39 + REPO_PREFIX: netdata/netdata
40 +concurrency:
41 + group: packages-${{ github.ref }}-${{ github.event_name }}
42 + cancel-in-progress: true
43 +jobs:
44 + matrix:
45 + name: Prepare Build Matrix
46 + runs-on: ubuntu-latest
47 + outputs:
48 + matrix: ${{ steps.set-matrix.outputs.matrix }}
49 + steps:
50 + - name: Checkout
51 + id: checkout
52 + uses: actions/checkout@v3
53 + - name: Prepare tools
54 + id: prepare
55 + run: |
56 + sudo apt-get update && sudo apt-get install -y python3-ruamel.yaml
57 + - name: Read build matrix
58 + id: set-matrix
59 + run: |
60 + if [ "${{ github.event_name }}" = "pull_request" ] && \
61 + [ "${{ !contains(github.event.pull_request.labels.*.name, 'run-ci/packaging') }}" = "true" ]; then
62 + matrix="$(.github/scripts/gen-matrix-packaging.py 1)"
63 + else
64 + matrix="$(.github/scripts/gen-matrix-packaging.py 0)"
65 + fi
66 + echo "Generated matrix: ${matrix}"
67 + echo "matrix=${matrix}" >> "${GITHUB_OUTPUT}"
68 +
69 + build:
70 + name: Build
71 + runs-on: ubuntu-latest
72 + env:
73 + DOCKER_CLI_EXPERIMENTAL: enabled
74 + needs:
75 + - matrix
76 + strategy:
77 + matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
78 + fail-fast: false
79 + max-parallel: 8
80 + steps:
81 + - run: echo 'NOT REQUIRED'
.github/workflows/packaging.yml
+23
@@ -8,6 +8,29 @@ on:
8 - reopened
9 - labeled
10 - synchronize
11 + paths: # This MUST be kept in-sync with the paths-ignore key for the packaging-dummy.yml workflow.
12 + - '**.c'
13 + - '**.cc'
14 + - '**.h'
15 + - '**.hh'
16 + - '**.in'
17 + - 'netdata.spec.in'
18 + - 'configure.ac'
19 + - '**/Makefile*'
20 + - 'Makefile*'
21 + - '.github/workflows/packaging.yml'
22 + - '.github/scripts/gen-matrix-packaging.py'
23 + - '.github/scripts/pkg-test.sh'
24 + - 'build/**'
25 + - 'packaging/*.sh'
26 + - 'packaging/*.checksums'
27 + - 'packaging/*.version'
28 + - 'contrib/debian/**'
29 + - 'aclk/aclk-schemas/'
30 + - 'ml/dlib/'
31 + - 'mqtt_websockets'
32 + - 'web/server/h2o/libh2o'
33 + - '!**.md'
34 branches:
35 - master
36 push: