95 lines
2.9 KiB
YAML
95 lines
2.9 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main]
|
|
paths:
|
|
- "recipes/**"
|
|
- ".github/workflows/ci.yml"
|
|
- ".github/workflows/cd.yml"
|
|
- ".github/scripts/**"
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
detect-targets:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
matrix: ${{ steps.detect.outputs.matrix }}
|
|
has_targets: ${{ steps.detect.outputs.has_targets }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Detect changed recipe targets
|
|
id: detect
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
if [[ -n "${ACT_CHANGED_FILES:-}" ]]; then
|
|
base="act-base"
|
|
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
|
base="${{ github.event.pull_request.base.sha }}"
|
|
else
|
|
if git rev-parse HEAD^ >/dev/null 2>&1; then
|
|
base="$(git rev-parse HEAD^)"
|
|
else
|
|
base="$(git rev-list --max-parents=0 HEAD)"
|
|
fi
|
|
fi
|
|
head="${ACT_HEAD_SHA:-${{ github.sha }}}"
|
|
matrix="$(python3 .github/scripts/detect_recipe_matrix.py --base "$base" --head "$head" --conandata-mode changed)"
|
|
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
|
|
if [[ "$matrix" == '{"include": []}' ]]; then
|
|
echo "has_targets=false" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "has_targets=true" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
conan-create:
|
|
needs: detect-targets
|
|
if: needs.detect-targets.outputs.has_targets == 'true'
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix: ${{ fromJson(needs.detect-targets.outputs.matrix) }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install host build tools
|
|
uses: awalsh128/cache-apt-pkgs-action@latest
|
|
with:
|
|
packages: build-essential gcc-14 g++-14 cmake ninja-build graphviz crudini
|
|
version: 1.0
|
|
execute_install_scripts: true
|
|
|
|
- name: Set gcc-14 as default
|
|
run: |
|
|
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 10
|
|
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 10
|
|
|
|
- name: Setup Conan client
|
|
uses: conan-io/setup-conan@v1
|
|
with:
|
|
version: "2.*"
|
|
use_venv: true
|
|
|
|
- name: Detect Conan profile
|
|
run: |
|
|
conan profile detect --force
|
|
crudini --set ~/.conan2/profiles/default settings compiler.cppstd 23
|
|
|
|
- name: Build and test package
|
|
run: |
|
|
conan create "${{ matrix.path }}" --version="${{ matrix.version }}" --build=missing
|
|
|
|
no-targets:
|
|
needs: detect-targets
|
|
if: needs.detect-targets.outputs.has_targets != 'true'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: No changed recipes
|
|
run: echo "No recipe targets detected for validation."
|