Skip to content

Commit

Permalink
circleci: execute build jobs only for changes in specific path
Browse files Browse the repository at this point in the history
this will avoid multiple build jobs running when not needed, for example
changes to README and patches/
  • Loading branch information
Fantu committed Oct 21, 2023
1 parent 3e965d6 commit e2aa10d
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 74 deletions.
83 changes: 83 additions & 0 deletions .circleci/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1

shared: &shared
steps:
- checkout
- run:
name: Prepare environment
command: |
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
apt-get update
apt-get dist-upgrade -y
- run:
name: Install dependencies
command: |
apt-get install -y g++ cmake uuid-dev libboost-program-options-dev libboost-filesystem-dev libssl-dev debhelper
apt-get install -y dh-dkms || apt-get install -y dkms
- run:
name: Build blksnap-dkms package
working_directory: pkg/deb
command: ./build-blksnap-dkms.sh
- run:
name: Build dev, tools and tests packages
working_directory: pkg/deb
command: ./build-blksnap.sh
- run:
name: Save generate packages as artifacts
working_directory: build
command: |
mkdir /tmp/artifacts
mv *.deb /tmp/artifacts
- store_artifacts:
path: /tmp/artifacts

jobs:
debian10:
<<: *shared
docker:
- image: library/debian:buster
debian11:
<<: *shared
docker:
- image: library/debian:bullseye
debian12:
<<: *shared
docker:
- image: library/debian:bookworm
ubuntu1404:
<<: *shared
docker:
- image: library/ubuntu:trusty
ubuntu1604:
<<: *shared
docker:
- image: library/ubuntu:xenial
ubuntu1804:
<<: *shared
docker:
- image: library/ubuntu:bionic
ubuntu2004:
<<: *shared
docker:
- image: library/ubuntu:focal
ubuntu2204:
<<: *shared
docker:
- image: library/ubuntu:jammy
ubuntu2310:
<<: *shared
docker:
- image: library/ubuntu:mantic

workflows:
build-deb:
when: << pipeline.parameters.run-them-all >>
jobs:
- debian10
- debian11
- debian12
- ubuntu2004
- ubuntu2204
- ubuntu2310
87 changes: 13 additions & 74 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,81 +2,20 @@
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1

shared: &shared
steps:
- checkout
- run:
name: Prepare environment
command: |
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
apt-get update
apt-get dist-upgrade -y
- run:
name: Install dependencies
command: |
apt-get install -y g++ cmake uuid-dev libboost-program-options-dev libboost-filesystem-dev libssl-dev debhelper
apt-get install -y dh-dkms || apt-get install -y dkms
- run:
name: Build blksnap-dkms package
working_directory: pkg/deb
command: ./build-blksnap-dkms.sh
- run:
name: Build dev, tools and tests packages
working_directory: pkg/deb
command: ./build-blksnap.sh
- run:
name: Save generate packages as artifacts
working_directory: build
command: |
mkdir /tmp/artifacts
mv *.deb /tmp/artifacts
- store_artifacts:
path: /tmp/artifacts
setup: true
orbs:
path-filtering: circleci/[email protected]

jobs:
debian10:
<<: *shared
docker:
- image: library/debian:buster
debian11:
<<: *shared
docker:
- image: library/debian:bullseye
debian12:
<<: *shared
docker:
- image: library/debian:bookworm
ubuntu1404:
<<: *shared
docker:
- image: library/ubuntu:trusty
ubuntu1604:
<<: *shared
docker:
- image: library/ubuntu:xenial
ubuntu1804:
<<: *shared
docker:
- image: library/ubuntu:bionic
ubuntu2004:
<<: *shared
docker:
- image: library/ubuntu:focal
ubuntu2204:
<<: *shared
docker:
- image: library/ubuntu:jammy
ubuntu2310:
<<: *shared
docker:
- image: library/ubuntu:mantic

workflows:
build-deb:
setup-workflow:
jobs:
- debian10
- debian11
- debian12
- ubuntu2004
- ubuntu2204
- ubuntu2310
- path-filtering/filter:
base-revision: main
config-path: .circleci/build.yml
mapping: |
include/.* run-them-all true
lib/.* run-them-all true
module/.* run-them-all true
tests/.* run-them-all true
tools/.* run-them-all true

0 comments on commit e2aa10d

Please sign in to comment.