Skip to content
Draft
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
59 changes: 38 additions & 21 deletions .github/workflows/build_commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,75 +12,92 @@ on:
malloc-impl:
required: true
type: string
compiler:
required: false
type: string
default: 'gcc'
conan-channel:
required: false
type: string
default: 'dev'
tooling:
required: true
type: string

jobs:
SislDeps:
uses: ebay/sisl/.github/workflows/build_dependencies.yml@stable/v13.x
uses: ebay/sisl/.github/workflows/build_dependencies.yml@dev/v14.x
with:
branch: stable/v13.x
branch: dev/v14.x
platform: ${{ inputs.platform }}
build-type: ${{ inputs.build-type }}
malloc-impl: ${{ inputs.malloc-impl }}
compiler: ${{ inputs.compiler }}
conan-channel: ${{ inputs.conan-channel }}
tooling: None
if: ${{ github.event_name != 'pull_request' }}

NuraftMesgDeps:
needs: SislDeps
uses: eBay/nuraft_mesg/.github/workflows/build_dependencies.yml@stable/v4.x
uses: eBay/nuraft_mesg/.github/workflows/build_dependencies.yml@dev/v5.x
with:
branch: stable/v4.x
branch: dev/v5.x
platform: ${{ inputs.platform }}
build-type: ${{ inputs.build-type }}
malloc-impl: ${{ inputs.malloc-impl }}
compiler: ${{ inputs.compiler }}
conan-channel: ${{ inputs.conan-channel }}
tooling: None
if: ${{ github.event_name != 'pull_request' }}

IOMgrDeps:
needs: [SislDeps]
uses: eBay/iomanager/.github/workflows/build_dependencies.yml@stable/v12.x
needs: SislDeps
uses: eBay/iomanager/.github/workflows/build_dependencies.yml@dev/v13.x
with:
branch: stable/v12.x
branch: dev/v13.x
platform: ${{ inputs.platform }}
build-type: ${{ inputs.build-type }}
malloc-impl: ${{ inputs.malloc-impl }}
prerelease: "False"
compiler: ${{ inputs.compiler }}
conan-channel: ${{ inputs.conan-channel }}
tooling: None
if: ${{ github.event_name != 'pull_request' }}

HomeStoreDeps:
needs: [IOMgrDeps, NuraftMesgDeps]
uses: eBay/homestore/.github/workflows/build_dependencies.yml@stable/v7.x
UblkppDeps:
needs: SislDeps
uses: szmyd/ublkpp/.github/workflows/build_dependencies.yml@main
with:
branch: stable/v7.x
branch: main
platform: ${{ inputs.platform }}
build-type: ${{ inputs.build-type }}
malloc-impl: ${{ inputs.malloc-impl }}
prerelease: "False"
compiler: ${{ inputs.compiler }}
conan-channel: ${{ inputs.conan-channel }}
tooling: None
if: ${{ github.event_name != 'pull_request' }}

HomeBlocksDeps:
needs: [HomeStoreDeps]
uses: ./.github/workflows/build_dependencies.yml
HomeStoreDeps:
needs: [IOMgrDeps, NuraftMesgDeps]
uses: eBay/homestore/.github/workflows/build_dependencies.yml@dev/v8.x
with:
branch: ${{ github.ref }}
branch: dev/v8.x
platform: ${{ inputs.platform }}
build-type: ${{ inputs.build-type }}
malloc-impl: ${{ inputs.malloc-impl }}
tooling: ${{ inputs.tooling }}
testing: 'True'
compiler: ${{ inputs.compiler }}
conan-channel: ${{ inputs.conan-channel }}
tooling: None
if: ${{ github.event_name != 'pull_request' }}

HomeBlocksBuild:
HomeBlocksDeps:
needs: [HomeStoreDeps, UblkppDeps]
uses: ./.github/workflows/build_dependencies.yml
with:
branch: ${{ github.ref }}
platform: ${{ inputs.platform }}
build-type: ${{ inputs.build-type }}
malloc-impl: ${{ inputs.malloc-impl }}
compiler: ${{ inputs.compiler }}
conan-channel: ${{ inputs.conan-channel }}
tooling: ${{ inputs.tooling }}
testing: 'True'
if: ${{ github.event_name == 'pull_request' }}
181 changes: 132 additions & 49 deletions .github/workflows/build_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ on:
malloc-impl:
required: true
type: string
compiler:
required: false
type: string
default: 'gcc'
conan-channel:
required: false
type: string
default: 'dev'
tooling:
required: false
type: string
Expand Down Expand Up @@ -50,10 +58,23 @@ on:
- libc
- tcmalloc
- jemalloc
compiler:
required: false
type: choice
options:
- gcc
- clang
default: 'gcc'
conan-channel:
required: false
type: string
default: 'dev'
tooling:
required: false
type: choice
- 'Sanitize'
options:
- 'AddressSanitize'
- 'ThreadSanitize'
- 'Coverage'
- 'None'
default: 'None'
Expand All @@ -71,119 +92,181 @@ jobs:
runs-on: ${{ inputs.platform }}
steps:
- name: Retrieve Code
uses: actions/checkout@main
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
if: ${{ inputs.testing == 'True' }}

- name: Check Code Formatting
run: |
# GitHub PR merge commit has shallow history, so fetch the base branch
git fetch --depth=50 origin ${{ github.base_ref }}

echo "Comparing HEAD against origin/${{ github.base_ref }}"

# Get C/C++ files changed in this PR
CHANGED_FILES=$(git diff --name-only --diff-filter=d origin/${{ github.base_ref }} | grep -E '\.(c|cpp|cc|cxx|h|hpp|hxx|ipp)$' || true)

if [[ -z "$CHANGED_FILES" ]]; then
echo "No C/C++ files modified in this PR"
exit 0
fi

echo "Checking formatting for PR-modified C/C++ files:"
echo "$CHANGED_FILES"

# Format only the changed files
echo "$CHANGED_FILES" | xargs clang-format -style=file -i -fallback-style=none

# Check if formatting changed anything
if ! git diff --exit-code -- $CHANGED_FILES; then
echo "::error::Code formatting check failed. PR-modified files have formatting issues."
echo "::error::Run './apply-clang-format.sh' locally and commit the changes."
exit 1
fi

echo "✓ All PR-modified files are properly formatted"
if: ${{ github.event_name == 'pull_request' && inputs.testing == 'True' }}

- name: Retrieve Recipe
uses: actions/checkout@main
uses: actions/checkout@v4
with:
repository: eBay/HomeBlocks
ref: ${{ inputs.branch }}
if: ${{ inputs.testing == 'False' }}

- name: Setup Conan
uses: ebay/sisl/.github/actions/setup_conan2@stable/v13.x
uses: ebay/sisl/.github/actions/setup_conan2@dev/v14.x
with:
platform: ${{ inputs.platform }}
compiler: ${{ inputs.compiler }}
if: ${{ inputs.testing == 'True' || steps.restore-cache.outputs.cache-hit != 'true' }}

- name: Load HomeBlocks Cache
id: restore-cache
uses: eBay/sisl/.github/actions/load_conan2@stable/v13.x
uses: ebay/sisl/.github/actions/load_conan2@dev/v14.x
with:
testing: ${{ inputs.testing }}
key_prefix: HomeBlocksDeps-${{ inputs.platform }}-${{ inputs.build-type }}-${{ inputs.malloc-impl }}

- name: Load Sisl Cache
uses: eBay/sisl/.github/actions/load_conan2@stable/v13.x
uses: eBay/sisl/.github/actions/load_conan2@dev/v14.x
with:
load_any: 'True'
key_prefix: SislDeps13-${{ inputs.platform }}-${{ inputs.build-type }}-${{ inputs.malloc-impl }}
testing: 'False'
path: import/sisl
key_prefix: SislDeps14-${{ inputs.platform }}-${{ inputs.build-type }}-${{ inputs.malloc-impl }}-${{ inputs.compiler }}
fail_on_cache_miss: true
if: ${{ inputs.testing == 'True' || steps.restore-cache.outputs.cache-hit != 'true' }}

- name: Load IOMgr Cache
uses: eBay/sisl/.github/actions/load_conan2@stable/v13.x
with:
load_any: 'True'
key_prefix: IOMgrDeps-${{ inputs.platform }}-${{ inputs.build-type }}-${{ inputs.malloc-impl }}-False
if: ${{ inputs.testing == 'True' || steps.restore-cache.outputs.cache-hit != 'true' }}

- name: Retrieve Dependencies NuRaftMesg
uses: actions/checkout@main
uses: eBay/sisl/.github/actions/load_conan2@dev/v14.x
with:
repository: eBay/nuraft_mesg
path: import/nuraft_mesg
ref: stable/v4.x
testing: 'False'
path: import/iomgr
key_prefix: IOMgrDeps-${{ inputs.platform }}-${{ inputs.build-type }}-${{ inputs.malloc-impl }}
fail_on_cache_miss: true
if: ${{ inputs.testing == 'True' || steps.restore-cache.outputs.cache-hit != 'true' }}

- name: Load NuRaftMesg Cache
uses: eBay/sisl/.github/actions/load_conan2@stable/v13.x
- name: Load NuraftMesg Cache
uses: eBay/sisl/.github/actions/load_conan2@dev/v14.x
with:
testing: 'False'
path: import/nuraft_mesg
key_prefix: NuMesgDeps-${{ inputs.platform }}-${{ inputs.build-type }}-${{ inputs.malloc-impl }}
fail_on_cache_miss: true
if: ${{ inputs.testing == 'True' || steps.restore-cache.outputs.cache-hit != 'true' }}

- name: Retrieve Dependencies HomeStore
uses: actions/checkout@main
- name: Load Ublkpp Cache
uses: eBay/sisl/.github/actions/load_conan2@dev/v14.x
with:
repository: eBay/HomeStore
path: import/homestore
ref: stable/v7.x
testing: 'False'
path: import/ublkpp
key_prefix: UblkPPDeps-${{ inputs.platform }}-${{ inputs.build-type }}-${{ inputs.malloc-impl }}
fail_on_cache_miss: true
if: ${{ inputs.testing == 'True' || steps.restore-cache.outputs.cache-hit != 'true' }}

- name: Load HomeStore Cache
uses: eBay/sisl/.github/actions/load_conan2@stable/v13.x
uses: eBay/sisl/.github/actions/load_conan2@dev/v14.x
with:
testing: 'False'
path: import/homestore
key_prefix: HomestoreDeps-${{ inputs.platform }}-${{ inputs.build-type }}-${{ inputs.malloc-impl }}-False
key_prefix: HomestoreDeps-${{ inputs.platform }}-${{ inputs.build-type }}-${{ inputs.malloc-impl }}
fail_on_cache_miss: true
if: ${{ inputs.testing == 'True' || steps.restore-cache.outputs.cache-hit != 'true' }}

- name: Retrieve Dependencies
uses: actions/checkout@v4
with:
repository: szmyd/ublkpp
path: import/ublkpp
ref: main
if: ${{ inputs.testing == 'True' || steps.restore-cache.outputs.cache-hit != 'true' }}

- name: Export Recipes
- name: Retrieve Dependencies
uses: actions/checkout@v4
with:
repository: eBay/HomeStore
path: import/homestore
ref: dev/v8.x
if: ${{ inputs.testing == 'True' || steps.restore-cache.outputs.cache-hit != 'true' }}

- name: Prepare Recipes
run: |
sudo apt-get install -y python3-pyelftools libaio-dev
python -m pip install pyelftools
conan export import/homestore
conan export import/nuraft_mesg
# make the following removed directory configurable, for example, using an environment variable.
sudo rm -rf $ANDROID_HOME
sudo rm -rf /usr/lib/llvm*
sudo rm -rf /usr/lib/jvm
sudo rm -rf /usr/lib/google-cloud-sdk
pushd import/ublkpp
./prepare_v2.sh
conan export --user oss --channel ${{ inputs.conan-channel }}
popd
pushd import/homestore
conan export --user oss --channel ${{ inputs.conan-channel }}
popd
if: ${{ inputs.testing == 'True' || steps.restore-cache.outputs.cache-hit != 'true' }}

- name: Create and Test Package
- name: Build Cache
run: |
sanitize=$([[ "${{ inputs.tooling }}" == "Sanitize" ]] && echo "True" || echo "False")
conan build \
conan install \
-o sisl/*:malloc_impl=${{ inputs.malloc-impl }} \
-o iomgr/*:testing=off \
-o homestore/*:testing=off \
-o homeblocks/*:sanitize=${sanitize} \
-s:h build_type=${{ inputs.build-type }} \
-s:h compiler.cppstd=23 \
-c tools.build:skip_test=True \
--format=json \
--build missing \
. > ~/build.json
conan list --graph ~/build.json --graph-binaries=build --format=json > ~/pkglist.json
if: ${{ inputs.testing == 'True' && inputs.tooling != 'Coverage' }}
conan list --graph ~/build.json --graph-binaries=build,cache --format=json > ~/pkglist.json
if: ${{ steps.restore-cache.outputs.cache-hit != 'true' }}

- name: Save Conan Cache
uses: eBay/sisl/.github/actions/store_conan2@stable/v13.x
uses: eBay/sisl/.github/actions/store_conan2@dev/v14.x
with:
key_prefix: HomeBlocksDeps-${{ inputs.platform }}-${{ inputs.build-type }}-${{ inputs.malloc-impl }}
key_prefix: HomeblocksDeps-${{ inputs.platform }}-${{ inputs.build-type }}-${{ inputs.malloc-impl }}
if: ${{ github.event_name != 'pull_request' && steps.restore-cache.outputs.cache-hit != 'true' && inputs.tooling != 'Coverage'}}

- name: Create and Test Package
run: |
conan cache clean -s -b
if [[ "${{ inputs.tooling }}" == "AddressSanitize" ]]; then sanitize="address"
elif [[ "${{ inputs.tooling }}" == "ThreadSanitize" ]]; then sanitize="thread"
else sanitize="False"; fi
conan create \
-o sisl/*:malloc_impl=${{ inputs.malloc-impl }} \
-o homeblocks/*:sanitize=${sanitize} \
-s:h build_type=${{ inputs.build-type }} \
${{ inputs.conan-channel != '' && format('--user oss --channel {0}', inputs.conan-channel) || '' }} \
.
if: ${{ inputs.testing == 'True' && inputs.tooling != 'Coverage' }}

- name: Code Coverage Run
run: |
conan cache clean -s -b
python -m pip install gcovr
conan build \
-o sisl/*:malloc_impl=${{ inputs.malloc-impl }} \
-o iomgr/*:testing=off \
-o homestore/*:testing=off \
-o homeblocks/*:coverage=True \
-s:h build_type=${{ inputs.build-type }} \
-s:h compiler.cppstd=23 \
--build missing \
${{ inputs.conan-channel != '' && format('--user oss --channel {0}', inputs.conan-channel) || '' }} \
.
gcovr --cobertura ./coverage.xml
if: ${{ inputs.testing == 'True' && inputs.tooling == 'Coverage' }}
Expand All @@ -193,4 +276,4 @@ jobs:
with:
files: ./coverage.xml
disable_search: true
if: ${{ inputs.testing == 'True' && inputs.tooling == 'Coverage' }}
if: ${{ inputs.tooling == 'Coverage' }}
Loading
Loading