hercules/.github/workflows/tools.yml
Ibrahim Zidan 3d3a63914c
Implemented a github action step that pre-compiles all conan
dependencies and caches them for use in later builds, improving build
speed.

Signed-off-by: Ibrahim Zidan <brahem@aotsw.com>
2026-07-21 02:03:50 +03:00

78 lines
2.4 KiB
YAML

name: tools
on: workflow_call
env:
MYSQL_DATABASE: 'ragnarok'
MYSQL_USER: 'ragnarok'
MYSQL_PASSWORD: 'ragnarok'
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
DEBIAN_COMMON_PACKAGES: python3 python3-pip python3-venv cmake make git gcc g++
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
matrix:
CC: ["clang-21", "gcc-15"]
include:
- CXX: 'g++-15'
CC: 'gcc-15'
- CXX: 'clang++-21'
CC: 'clang-21'
# github.head_ref will stop previous runs in the same PR (if in a PR)
# github.run_id is a fallback when outside a PR (e.g. every merge in master will run, and previous won't stop)
concurrency:
group: tools-linux-${{ github.head_ref || github.run_id }}_${{ matrix.CC }}
cancel-in-progress: true
container:
image: ubuntu:26.04
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 1
- name: info
run: |
uname -a
- name: install packages
run: |
./tools/ci/retry.sh apt-get update
./tools/ci/retry.sh apt-get install -y -qq $INSTALL_PACKAGES $DEBIAN_COMMON_PACKAGES ${{ matrix.CC }} ${{ matrix.CXX }}
pip3 install sqlfluff --break-system-packages
- uses: actions/cache/restore@v6 # We're restoring first so if a cache already exists from previous CI run, it's used and step finishes quicker.
name: restore conan cache
id: cache-restore
with:
path: ~/.conan2
key: ${{ runner.os }}-${{ matrix.CC }}-${{ hashFiles('conanfile.py') }}
- name: run cmake first run
if: steps.cache-restore.outputs.cache-hit != 'true'
run: |
./tools/ci/travis.sh prepareenv
source .venv/bin/activate
cmake -S . -B build -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=cmake_modules/conan_provider.cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=${{ matrix.CC }} -DCMAKE_CXX_COMPILER=${{ matrix.CXX }}
- uses: actions/cache/save@v6
if: steps.cache-restore.outputs.cache-hit != 'true'
name: save conan cache
id: cache_save
with:
path: ~/.conan2
key: ${{ runner.os }}-${{ matrix.CC }}-${{ hashFiles('conanfile.py') }}
- name: check sql syntax
run: |
./tools/ci/retry.sh python3 tools/validate_sql-files.py
- name: check sql updates
run: |
python3 ./tools/checksql.py