Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 19 additions & 20 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,22 @@ jobs:
#----- --- -- - - - -
- name: Build and test
env:
CACHE_CONAN_REMOTE: ${{ vars.CACHE_CONAN_REMOTE }}
CACHE_CONAN_LOGIN_USERNAME: ${{ vars.CACHE_CONAN_LOGIN_USERNAME }}
CACHE_CONAN_PASSWORD: ${{ secrets.CACHE_CONAN_PASSWORD }}
run: scripts/ci-build-with-docker.sh
#release:
# if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
# runs-on: self-hosted
# needs:
# - build
# - test
# steps:
# - name: make_export-pkg
# run: script/run-with-docker.sh make BUILD_TYPE=Release export-pkg
# - name: publish-release
# env:
# RELEASE_CONAN_REMOTE: ${{ vars.RELEASE_CONAN_REMOTE }}
# RELEASE_CONAN_LOGIN_USERNAME: ${{ vars.RELEASE_CONAN_LOGIN_USERNAME }}
# RELEASE_CONAN_PASSWORD: ${{ secrets.RELEASE_CONAN_PASSWORD }}
# EXPORT_PKG_ONLY: 1
# run: script/run-with-docker.sh script/publish-release.sh
CI_JOB_NAME: build_and_test
run: scripts/ci-job-with-docker.sh
#+++++++++++-+-+--+----- --- -- - - - -
release:
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: self-hosted
defaults:
run:
shell: bash
needs:
- build_and_test
steps:
- name: Release
env:
RELEASE_CONAN_REMOTE: ${{ vars.RELEASE_CONAN_REMOTE }}
RELEASE_CONAN_LOGIN_USERNAME: ${{ vars.RELEASE_CONAN_LOGIN_USERNAME }}
RELEASE_CONAN_PASSWORD: ${{ secrets.RELEASE_CONAN_PASSWORD }}
CI_JOB_NAME: release
run: scripts/ci-job-with-docker.sh
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ set -Eeuo pipefail
SCRIPT_DIR=$(realpath $(dirname "$0"))
PROJECT_DIR=$(realpath $(dirname "${SCRIPT_DIR}"))

"${SCRIPT_DIR}/ci-print-diagnostics.sh" "ci-build-with-docker.sh"
"${SCRIPT_DIR}/ci-print-diagnostics.sh" "ci-job-with-docker.sh"

# Run the ci-build.sh script using docker.
# Run the ci-job.sh script using docker.
#
ROOT_IMAGE=registry.gitlab.com/batteriesincluded/batt-docker/batteries-debian12-build-tools:0.6.0
USER_IMAGE=$(cor docker user-image ${ROOT_IMAGE} --user-commands-file="${SCRIPT_DIR}/ci-build-setup.dockerfile")
USER_IMAGE=$(cor docker user-image ${ROOT_IMAGE} --user-commands-file="${SCRIPT_DIR}/ci-job-setup.dockerfile")

VOLUMES=
if [ -f "${HOME}/conan-local-cache-server-config.sh" ]; then
Expand All @@ -34,4 +34,4 @@ docker run \
${VOLUMES} \
--workdir "${PROJECT_DIR}" \
${USER_IMAGE} \
"${BUILD_COMMAND:-${SCRIPT_DIR}/ci-build.sh}"
"${BUILD_COMMAND:-${SCRIPT_DIR}/ci-job.sh}"
34 changes: 25 additions & 9 deletions scripts/ci-build.sh → scripts/ci-job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,28 @@ fi
#
cor select --clean --profile=linux-gcc12-x86_64 --build-type=Release

# Build.
#
# cor install makes sure deps are uploaded to the cache server first;
# TODO [tastolfi 2025-09-27] - Add a `cor pre-cache <options> <package_name>/<version> ...` command
#
cor clean
cor install
cor build
cor test --only
: "${CI_JOB_NAME:?Error: CI_JOB_NAME environment variable must be set}"

case "$CI_JOB_NAME" in
build_and_test)
echo "Running build_and_test job..."
# Build.
#
# cor install makes sure deps are uploaded to the cache server first;
# TODO [tastolfi 2025-09-27] - Add a `cor pre-cache <options> <package_name>/<version> ...` command
#
cor install --clean
cor build
cor test --only
;;
release)
echo "Running release job..."
cor export --only
cor export-pkg --clean
cor upload
;;
*)
echo "Unknown job type: $CI_JOB_NAME"
exit 1
;;
esac