summaryrefslogtreecommitdiffstats
path: root/.github/workflows/packaging.yml
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/packaging.yml')
-rw-r--r--.github/workflows/packaging.yml108
1 files changed, 73 insertions, 35 deletions
diff --git a/.github/workflows/packaging.yml b/.github/workflows/packaging.yml
index 7e8c7e527..9b15cf94b 100644
--- a/.github/workflows/packaging.yml
+++ b/.github/workflows/packaging.yml
@@ -8,31 +8,6 @@ on:
- reopened
- labeled
- synchronize
- paths: # This MUST be kept in-sync with the paths-ignore key for the packaging-dummy.yml workflow.
- - '**.c'
- - '**.cc'
- - '**.h'
- - '**.hh'
- - '**.in'
- - 'netdata.spec.in'
- - 'configure.ac'
- - '**/Makefile*'
- - 'Makefile*'
- - '.github/workflows/packaging.yml'
- - '.github/scripts/gen-matrix-packaging.py'
- - '.github/scripts/pkg-test.sh'
- - 'build/**'
- - 'packaging/*.sh'
- - 'packaging/*.checksums'
- - 'packaging/*.version'
- - 'contrib/debian/**'
- - 'aclk/aclk-schemas/'
- - 'ml/dlib/'
- - 'mqtt_websockets'
- - 'web/server/h2o/libh2o'
- - '!**.md'
- branches:
- - master
push:
branches:
- master
@@ -52,6 +27,57 @@ concurrency:
group: packages-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
+ file-check: # Check what files changed if we’re being run in a PR or on a push.
+ name: Check Modified Files
+ runs-on: ubuntu-latest
+ outputs:
+ run: ${{ steps.check-run.outputs.run }}
+ steps:
+ - name: Checkout
+ id: checkout
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ submodules: recursive
+ - name: Check files
+ id: file-check
+ uses: tj-actions/changed-files@v39
+ with:
+ since_last_remote_commit: ${{ github.event_name != 'pull_request' }}
+ files: |
+ **.c
+ **.cc
+ **.h
+ **.hh
+ **.in
+ netdata.spec.in
+ configure.ac
+ **/Makefile*
+ Makefile*
+ .github/data/distros.yml
+ .github/workflows/packaging.yml
+ .github/scripts/gen-matrix-packaging.py
+ .github/scripts/pkg-test.sh
+ build/**
+ packaging/*.sh
+ packaging/*.checksums
+ packaging/*.version
+ contrib/debian/**
+ aclk/aclk-schemas/
+ ml/dlib/
+ mqtt_websockets
+ web/server/h2o/libh2o
+ files_ignore: |
+ **.md
+ - name: Check Run
+ id: check-run
+ run: |
+ if [ "${{ steps.file-check.outputs.any_modified }}" == "true" ] || [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
+ echo 'run=true' >> "${GITHUB_OUTPUT}"
+ else
+ echo 'run=false' >> "${GITHUB_OUTPUT}"
+ fi
+
matrix:
name: Prepare Build Matrix
runs-on: ubuntu-latest
@@ -60,7 +86,7 @@ jobs:
steps:
- name: Checkout
id: checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Prepare tools
id: prepare
run: |
@@ -107,7 +133,7 @@ jobs:
steps:
- name: Checkout
id: checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Check Version
id: check-version
run: |
@@ -161,6 +187,7 @@ jobs:
needs:
- matrix
- version-check
+ - file-check
strategy:
matrix: ${{ fromJson(needs.matrix.outputs.matrix) }}
# We intentiaonally disable the fail-fast behavior so that a
@@ -169,24 +196,31 @@ jobs:
fail-fast: false
max-parallel: 8
steps:
+ - name: Skip Check
+ id: skip
+ if: needs.file-check.outputs.run != 'true'
+ run: echo "SKIPPED"
- name: Checkout
id: checkout
- uses: actions/checkout@v3
+ if: needs.file-check.outputs.run == 'true'
+ uses: actions/checkout@v4
with:
fetch-depth: 0 # We need full history for versioning
submodules: recursive
- name: Setup QEMU
id: qemu
- if: matrix.platform != 'linux/amd64' && matrix.platform != 'linux/i386'
- uses: docker/setup-qemu-action@v2
+ if: matrix.platform != 'linux/amd64' && matrix.platform != 'linux/i386' && needs.file-check.outputs.run == 'true'
+ uses: docker/setup-qemu-action@v3
- name: Prepare Docker Environment
id: docker-config
+ if: needs.file-check.outputs.run == 'true'
shell: bash
run: |
echo '{"cgroup-parent": "actions-job.slice", "experimental": true}' | sudo tee /etc/docker/daemon.json 2>/dev/null
sudo service docker restart
- name: Fetch images
id: fetch-images
+ if: needs.file-check.outputs.run == 'true'
uses: nick-invision/retry@v2
with:
max_attempts: 3
@@ -194,15 +228,17 @@ jobs:
timeout_seconds: 900
command: |
docker pull --platform ${{ matrix.platform }} ${{ matrix.base_image }}
- docker pull --platform ${{ matrix.platform }} netdata/package-builders:${{ matrix.distro }}${{ matrix.version }}
+ docker pull --platform ${{ matrix.platform }} netdata/package-builders:${{ matrix.distro }}${{ matrix.version }}-v1
- name: Build Packages
id: build
+ if: needs.file-check.outputs.run == 'true'
shell: bash
run: |
docker run --security-opt seccomp=unconfined -e DISABLE_TELEMETRY=1 -e VERSION=${{ needs.version-check.outputs.version }} \
- --platform=${{ matrix.platform }} -v "$PWD":/netdata netdata/package-builders:${{ matrix.distro }}${{ matrix.version }}
+ --platform=${{ matrix.platform }} -v "$PWD":/netdata netdata/package-builders:${{ matrix.distro }}${{ matrix.version }}-v1
- name: Save Packages
id: artifacts
+ if: needs.file-check.outputs.run == 'true'
continue-on-error: true
uses: actions/upload-artifact@v3
with:
@@ -210,6 +246,7 @@ jobs:
path: ${{ github.workspace }}/artifacts/*
- name: Test Packages
id: test
+ if: needs.file-check.outputs.run == 'true'
shell: bash
run: |
docker run --security-opt seccomp=unconfined -e DISABLE_TELEMETRY=1 -e DISTRO=${{ matrix.distro }} \
@@ -218,7 +255,7 @@ jobs:
/netdata/.github/scripts/pkg-test.sh
- name: Upload to PackageCloud
id: upload
- if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata'
+ if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata' && needs.file-check.outputs.run == 'true'
continue-on-error: true
shell: bash
env:
@@ -232,7 +269,7 @@ jobs:
done
- name: SSH setup
id: ssh-setup
- if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata'
+ if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata' && needs.file-check.outputs.run == 'true'
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.NETDATABOT_PACKAGES_SSH_KEY }}
@@ -240,7 +277,7 @@ jobs:
known_hosts: ${{ secrets.PACKAGES_KNOWN_HOSTS }}
- name: Upload to packages.netdata.cloud
id: package-upload
- if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata'
+ if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata' && needs.file-check.outputs.run == 'true'
run: |
.github/scripts/package-upload.sh \
${{ matrix.repo_distro }} \
@@ -272,4 +309,5 @@ jobs:
&& github.event_name != 'pull_request'
&& startsWith(github.ref, 'refs/heads/master')
&& github.repository == 'netdata/netdata'
+ && needs.file-check.outputs.run == 'true'
}}