Skip to content
Open
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
4 changes: 4 additions & 0 deletions .gersemirc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# gersemi is an opinionated formatter and does not support the same
# level of configuration as cmake-format. The previous settings from
# .cmake-format.json (dangle_align and dangle_parens) are not
# supported and have no direct equivalents.
44 changes: 35 additions & 9 deletions .github/workflows/actionlint-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,28 @@ on:
pull_request:
branches: [ main, develop ]
workflow_dispatch:
workflow_call:
inputs:
checkout-path:
description: "Path to check out code to"
required: false
type: string
skip-relevance-check:
description: "Bypass relevance check"
required: false
type: boolean
default: false
pr-base-sha:
description: "Base SHA of the PR for relevance check"
required: false
type: string
pr-head-sha:
description: "Head SHA of the PR for relevance check"
required: false
type: string

env:
local-checkout-path: ${{ (github.event_name == 'workflow_call' && inputs.checkout-path) || format('{0}-src', github.event.repository.name) }}

jobs:
pre-check:
Expand All @@ -22,7 +44,10 @@ jobs:

detect-changes:
needs: pre-check
if: github.event_name != 'workflow_dispatch' && needs.pre-check.outputs.is_act != 'true'
if: >
github.event_name != 'workflow_dispatch' &&
(github.event_name != 'workflow_call' || inputs.skip-relevance-check != 'true') &&
needs.pre-check.outputs.is_act != 'true'
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -34,15 +59,15 @@ jobs:
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0
path: phlex-src
path: ${{ env.local-checkout-path }}

- name: Detect workflow changes
id: filter
uses: Framework-R-D/phlex/.github/actions/detect-relevant-changes@main
with:
repo-path: phlex-src
base-ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
head-ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
repo-path: ${{ env.local-checkout-path }}
base-ref: ${{ (github.event_name == 'workflow_call' && inputs.pr-base-sha) || github.event.pull_request.base.sha || github.event.before }}
head-ref: ${{ (github.event_name == 'workflow_call' && inputs.pr-head-sha) || github.event.pull_request.head.sha || github.sha }}
include-globs: |
.github/workflows/**/*.yml
.github/workflows/**/*.yaml
Expand All @@ -63,6 +88,7 @@ jobs:
needs: [pre-check, detect-changes]
if: >
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'workflow_call' && inputs.skip-relevance-check == 'true') ||
needs.pre-check.outputs.is_act == 'true' ||
(needs.detect-changes.result == 'success' && needs.detect-changes.outputs.has_changes == 'true')
runs-on: ubuntu-latest
Expand All @@ -73,7 +99,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
path: phlex-src
path: ${{ env.local-checkout-path }}

- name: Announce actionlint check
run: echo "➡️ Running actionlint check..."
Expand All @@ -82,7 +108,7 @@ jobs:
id: lint
run: |
docker run --rm \
-v "${{ github.workspace }}/phlex-src:/work" \
-v "${{ github.workspace }}/${{ env.local-checkout-path }}:/work" \
-w /work \
rhysd/actionlint:latest \
-config-file .github/actionlint.yaml
Expand All @@ -102,9 +128,9 @@ jobs:
needs: [pre-check, detect-changes]
if: >
github.event_name != 'workflow_dispatch' &&
(github.event_name != 'workflow_call' || inputs.skip-relevance-check != 'true') &&
needs.pre-check.outputs.is_act != 'true' &&
needs.detect-changes.result == 'success' &&
needs.detect-changes.outputs.has_changes != 'true'
(needs.detect-changes.result == 'success' && needs.detect-changes.outputs.has_changes != 'true')
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
92 changes: 74 additions & 18 deletions .github/workflows/cmake-build.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: CMake Build and Test
run-name: "${{ github.actor }} building and testing Phlex"
run-name: "${{ github.actor }} building and testing ${{ github.repository }}"

on:
pull_request:
Expand All @@ -21,6 +21,41 @@ on:
Default (if empty): Run all except clang/none and clang/valgrind.
required: false
default: ''
workflow_call:
inputs:
checkout-path:
description: "Path to check out code to"
required: false
type: string
build-path:
description: "Path for build artifacts"
required: false
type: string
skip-relevance-check:
description: "Bypass relevance check"
required: false
type: boolean
default: false
build-combinations:
description: "A space- or comma-separated list of build combinations to run"
required: false
type: string
ref:
description: "The branch or ref to checkout"
required: false
type: string
repo:
description: "The repository to checkout from"
required: false
type: string
pr-base-sha:
description: "Base SHA of the PR for relevance check"
required: false
type: string
pr-head-sha:
description: "Head SHA of the PR for relevance check"
required: false
type: string

permissions:
contents: read
Expand All @@ -29,17 +64,23 @@ permissions:
env:
BUILD_TYPE: Release
CICOLOR_FORCE: 1
local-checkout-path: ${{ (github.event_name == 'workflow_call' && inputs.checkout-path) || format('{0}-src', github.event.repository.name) }}
local-build-path: ${{ (github.event_name == 'workflow_call' && inputs.build-path) || format('{0}-build', github.event.repository.name) }}

jobs:
pre-check:
if: >
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request' ||
github.event_name == 'workflow_call' ||
(
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
(github.event.comment.author_association == 'COLLABORATOR' || github.event.comment.author_association == 'OWNER') &&
startsWith(github.event.comment.body, '@phlexbot build')
(
startsWith(github.event.comment.body, '@phlexbot build') ||
startsWith(github.event.comment.body, format('@{0}bot build', github.event.repository.name))
)
)
runs-on: ubuntu-latest
permissions:
Expand All @@ -48,9 +89,8 @@ jobs:

outputs:
is_act: ${{ steps.detect_act.outputs.is_act }}
pr_details: ${{ steps.pr.outputs.result }}
sha: ${{ steps.pr.outputs.sha || github.sha }}
repo: ${{ steps.pr.outputs.repo || github.repository }}
sha: ${{ (github.event_name == 'workflow_call' && inputs.ref) || steps.pr.outputs.sha || github.sha }}
repo: ${{ (github.event_name == 'workflow_call' && inputs.repo) || steps.pr.outputs.repo || github.repository }}

steps:
- name: Get PR details for comment trigger
Expand All @@ -67,6 +107,7 @@ jobs:
return {
ref: pr.data.head.ref,
sha: pr.data.head.sha,
repo: pr.data.head.repo.full_name,
base_sha: pr.data.base.sha
};

Expand All @@ -78,7 +119,11 @@ jobs:
needs: pre-check
if: >
needs.pre-check.result == 'success' &&
(github.event_name == 'pull_request' || github.event_name == 'push') &&
(
github.event_name == 'pull_request' ||
github.event_name == 'push' ||
(github.event_name == 'workflow_call' && inputs.skip-relevance-check != 'true')
) &&
needs.pre-check.outputs.is_act != 'true'
runs-on: ubuntu-latest
permissions:
Expand All @@ -91,15 +136,15 @@ jobs:
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0
path: phlex-src
path: ${{ env.local-checkout-path }}

- name: Detect C++ and CMake changes
id: filter
uses: Framework-R-D/phlex/.github/actions/detect-relevant-changes@main
with:
repo-path: phlex-src
base-ref: ${{ github.event.pull_request.base.sha || github.event.before }}
head-ref: ${{ github.event.pull_request.head.sha || github.sha }}
repo-path: ${{ env.local-checkout-path }}
base-ref: ${{ (github.event_name == 'workflow_call' && inputs.pr-base-sha) || github.event.pull_request.base.sha || github.event.before }}
head-ref: ${{ (github.event_name == 'workflow_call' && inputs.pr-head-sha) || github.event.pull_request.head.sha || github.sha }}
file-type: |
cpp
cmake
Expand All @@ -124,7 +169,7 @@ jobs:
- id: generate
uses: Framework-R-D/phlex/.github/actions/generate-build-matrix@main
with:
user-input: ${{ github.event.inputs.build-combinations }}
user-input: ${{ (github.event_name == 'workflow_call' && inputs.build-combinations) || github.event.inputs.build-combinations }}
comment-body: ${{ github.event.comment.body }}

build:
Expand All @@ -134,6 +179,7 @@ jobs:
(
github.event_name == 'workflow_dispatch' ||
github.event_name == 'issue_comment' ||
(github.event_name == 'workflow_call' && inputs.skip-relevance-check == 'true') ||
needs.pre-check.outputs.is_act == 'true' ||
(needs.detect-changes.result == 'success' && needs.detect-changes.outputs.has_changes == 'true')
)
Expand All @@ -149,35 +195,45 @@ jobs:
- name: Check out code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
path: phlex-src
path: ${{ env.local-checkout-path }}
ref: ${{ needs.pre-check.outputs.sha }}
repository: ${{ needs.pre-check.outputs.repo }}

- name: Setup build environment
uses: Framework-R-D/phlex/.github/actions/setup-build-env@main
with:
build-path: ${{ env.local-build-path }}

- name: Announce CMake configuration
run: echo "➡️ Configuring CMake..."

- name: Extract repository name
id: repo_name
run: echo "name=$(echo '${{ needs.pre-check.outputs.repo }}' | sed 's:.*/::')" >> $GITHUB_OUTPUT

- name: Configure CMake
id: configure
uses: Framework-R-D/phlex/.github/actions/configure-cmake@main
with:
source-path: ${{ env.local-checkout-path }}
build-path: ${{ env.local-build-path }}
build-type: ${{ env.BUILD_TYPE }}
cpp-compiler: ${{ matrix.compiler == 'gcc' && 'g++' || 'clang++' }}
extra-options: |
${{ matrix.sanitizer == 'asan' && '-DPHLEX_ENABLE_ASAN=ON' || '' }}
${{ matrix.sanitizer == 'tsan' && '-DPHLEX_ENABLE_TSAN=ON' || '' }}
${{ matrix.sanitizer == 'asan' && format('-D{0}_ENABLE_ASAN=ON', steps.repo_name.outputs.name) || '' }}
${{ matrix.sanitizer == 'tsan' && format('-D{0}_ENABLE_TSAN=ON', steps.repo_name.outputs.name) || '' }}

- name: Build
id: build
uses: Framework-R-D/phlex/.github/actions/build-cmake@main
with:
build-path: ${{ env.local-build-path }}

- name: Run tests
if: matrix.sanitizer != 'valgrind'
run: |
. /entrypoint.sh
cd "$GITHUB_WORKSPACE/phlex-build"
cd "$GITHUB_WORKSPACE/${{ env.local-build-path }}"

echo "➡️ Running tests..."
echo "::group::Running ctest"
Expand All @@ -194,7 +250,7 @@ jobs:
if: matrix.sanitizer == 'valgrind'
run: |
. /entrypoint.sh
cd "$GITHUB_WORKSPACE/phlex-build"
cd "$GITHUB_WORKSPACE/${{ env.local-build-path }}"

echo "➡️ Running Valgrind tests..."
echo "::group::Running ctest -T memcheck"
Expand All @@ -211,9 +267,9 @@ jobs:
if: >
needs.pre-check.result == 'success' &&
github.event_name != 'workflow_dispatch' &&
(github.event_name != 'workflow_call' || inputs.skip-relevance-check != 'true') &&
needs.pre-check.outputs.is_act != 'true' &&
needs.detect-changes.result == 'success' &&
needs.detect-changes.outputs.has_changes != 'true'
(needs.detect-changes.result == 'success' && needs.detect-changes.outputs.has_changes != 'true')
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
Loading
Loading