Skip to content

Commit

Permalink
actions: decouple regression tests from ci.yaml
Browse files Browse the repository at this point in the history
Modularize regression tests in a dedicated reusable workflow, to be
invoked after docker images have been built and are available by
using a composite action to build containers.This makes both
workflows shorter and easier to debug.
  • Loading branch information
msune committed Aug 30, 2024
1 parent 0b20c03 commit cc4a413
Show file tree
Hide file tree
Showing 3 changed files with 416 additions and 351 deletions.
51 changes: 51 additions & 0 deletions .github/actions/build_containers/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "Build containers"
description: "Reusable GitHub Action to build pmacct containers"

inputs:
commit-id:
required: true
default: "HEAD"
type: string
daemons:
required: true
type: string
ci_num_workers:
required: false
type: string
default: 4
ci_deps_dont_check_cert:
required: false
default: 1
runs:
using: "composite"
steps:
- name: Build pmacct containers
env:
COMMIT_ID: ${{ inputs.commit-id }}
DAEMONS: ${{ inputs.daemons }}
CI_NUM_WORKERS: ${{ inputs.ci_num_workers }}
CI_DEPS_DONT_CHECK_CERTIFICATE: ${{ inputs.ci_deps_dont_check_cert }}
shell: bash
run: |
cd pmacct
git config --global --add safe.directory $GITHUB_WORKSPACE
git config --global --add safe.directory $GITHUB_WORKSPACE/src/external_libs/libcdada
git rev-parse HEAD
echo "Fix mess with tags in actions/checkout..."
git fetch -f && git fetch -f --tags
echo
if [[ "$COMMIT_ID" != "" ]]
then
echo "Checking out at commit id=$COMMIT_ID"
git checkout $COMMIT_ID
fi
echo
echo "Deducing PMACCT_VERSION..."
PMACCT_VERSION=$(git describe --abbrev=0 --match="v*")
echo "PMACCT_VERSION=$PMACCT_VERSION"
echo "Building the base container..."
docker build --build-arg NUM_WORKERS=$CI_NUM_WORKERS --build-arg DEPS_DONT_CHECK_CERTIFICATE=$CI_DEPS_DONT_CHECK_CERTIFICATE -f docker/base/Dockerfile -t base:_build .
echo "Building daemon containers..."
for DAEMON in ${DAEMONS}; do
docker build -f docker/${DAEMON}/Dockerfile -t ${DAEMON}:_build .
done
Loading

0 comments on commit cc4a413

Please sign in to comment.