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
18 changes: 7 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ jobs:
- name: Prepare
run: bash scripts/install_dependency.sh
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
run: ninja -C ${{github.workspace}}/build
- name: Test
working-directory: ${{github.workspace}}/build
run: |
ctest -C ${{env.BUILD_TYPE}} --output-on-failure --parallel
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure --parallel

ubuntu:
runs-on: ubuntu-latest
Expand All @@ -34,12 +33,12 @@ jobs:
run: bash scripts/install_dependency.sh
- name: Configure CMake with LSan
run: |
cmake -B ${{github.workspace}}/build \
cmake -G Ninja -B ${{github.workspace}}/build \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DCMAKE_C_FLAGS="-fsanitize=leak" \
-DCMAKE_CXX_FLAGS="-fsanitize=leak"
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
run: ninja -C ${{github.workspace}}/build
- name: Test with LSan
working-directory: ${{github.workspace}}/build
run: |
Expand All @@ -51,12 +50,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_GLCACHE=on -DENABLE_LRB=on
run: cmake -G Ninja -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_GLCACHE=on -DENABLE_LRB=on
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
run: ninja -C ${{github.workspace}}/build
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure --parallel



18 changes: 9 additions & 9 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang-format clang-tidy cmake g++ make
sudo apt-get install -y clang-format clang-tidy cmake g++ ninja-build
bash scripts/install_dependency.sh

- name: Get changed C/C++ files
Expand All @@ -36,15 +36,15 @@ jobs:
run: |
echo "Running clang-format checks..."
FORMAT_ERRORS=0

for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "Checking formatting for $file"
if ! clang-format --dry-run --Werror "$file" >> logs/format.log 2>&1; then
echo "::error file=$file::Formatting issues in $file"
FORMAT_ERRORS=$((FORMAT_ERRORS + 1))
fi
done

if [ $FORMAT_ERRORS -gt 0 ]; then
echo "Found formatting issues in $FORMAT_ERRORS files."
echo "You can fix these issues with: clang-format -i <file>"
Expand All @@ -57,7 +57,7 @@ jobs:
- name: Configure CMake
if: steps.changed-files.outputs.any_changed == 'true'
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Debug \
cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_FLAGS="-Wall -Wextra -Werror -Wno-unused-variable -Wno-unused-function -Wno-unused-parameter -Wno-unused-but-set-variable -Wpedantic -Wformat=2 -Wformat-security -Wshadow -Wwrite-strings -Wstrict-prototypes -Wold-style-definition -Wredundant-decls -Wnested-externs -Wmissing-include-dirs" \
-DCMAKE_CXX_FLAGS="-Wall -Wextra -Werror -Wno-unused-variable -Wno-unused-function -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-pedantic -Wformat=2 -Wformat-security -Wshadow -Wwrite-strings -Wmissing-include-dirs" \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
Expand All @@ -68,11 +68,11 @@ jobs:
# run: |
# echo "Running clang-tidy checks..."
# FILES_WITH_ISSUES=0

# for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
# echo "Checking $file with clang-tidy"
# LOG_FILE="logs/tidy_$(basename "$file").log"

# # Run clang-tidy with selected checks (same as pre-commit hook)
# if ! clang-tidy -p=build \
# -checks='-*,bugprone-*,cert-*,clang-analyzer-*,cppcoreguidelines-*,performance-*,portability-*,readability-*,-readability-magic-numbers,-readability-braces-around-statements,-cppcoreguidelines-avoid-magic-numbers,-readability-identifier-length,-clang-diagnostic-unused-command-line-argument' \
Expand All @@ -82,7 +82,7 @@ jobs:
# FILES_WITH_ISSUES=$((FILES_WITH_ISSUES + 1))
# fi
# done

# if [ $FILES_WITH_ISSUES -gt 0 ]; then
# echo "clang-tidy found issues in $FILES_WITH_ISSUES files."
# exit 1
Expand All @@ -94,10 +94,10 @@ jobs:
if: steps.changed-files.outputs.any_changed == 'true'
run: |
echo "Checking for compilation warnings..."
if cmake --build build -j$(nproc) > logs/compile.log 2>&1; then
if ninja -C build > logs/compile.log 2>&1; then
echo "Compilation successful!"
else
echo "Compilation failed. Please fix the warnings."
cat logs/compile.log
exit 1
fi
fi
56 changes: 28 additions & 28 deletions .github/workflows/npm-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,24 @@ jobs:
outputs:
release_created: ${{ steps.release.outputs.release_created }}
version: ${{ steps.package.outputs.version }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Synchronize Node.js binding version
run: |
echo "Synchronizing Node.js binding version with main project..."
python3 scripts/sync_node_version.py

- name: Get package version
id: package
working-directory: libCacheSim-node
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"

- name: Check if release exists
id: check_release
run: |
Expand All @@ -50,7 +50,7 @@ jobs:
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create GitHub Release
id: release
if: steps.check_release.outputs.exists == 'false'
Expand All @@ -62,15 +62,15 @@ jobs:
release_name: Release v${{ steps.package.outputs.version }}
body: |
Release v${{ steps.package.outputs.version }}

## Installation
```bash
npm install libcachesim-node
```

## Supported Platforms
- Linux x64

Pre-compiled binaries are automatically downloaded during installation.
draft: false
prerelease: false
Expand All @@ -79,48 +79,48 @@ jobs:
if: github.event_name == 'release'
needs: create-release
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Synchronize Node.js binding version
run: |
echo "Synchronizing Node.js binding version with main project..."
python3 scripts/sync_node_version.py

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake libglib2.0-dev libzstd-dev
sudo apt-get install -y build-essential cmake ninja-build libglib2.0-dev libzstd-dev

- name: Build libCacheSim
run: |
echo "Building libCacheSim for Linux x64..."
mkdir -p _build
cd _build
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} .. -DCMAKE_VERBOSE_MAKEFILE=ON
cmake -G Ninja -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} .. -DCMAKE_VERBOSE_MAKEFILE=ON
echo "Starting build..."
make -j$(nproc) VERBOSE=1
ninja -v

- name: Prepare vendored library
run: |
mkdir -p libCacheSim-node/vendor/include
cp _build/liblibCacheSim.a libCacheSim-node/vendor/
cp -r libCacheSim/include/* libCacheSim-node/vendor/include/

- name: Install Node.js dependencies
working-directory: libCacheSim-node
run: npm install

- name: Build and upload prebuilt binary
working-directory: libCacheSim-node
run: |
Expand All @@ -132,7 +132,7 @@ jobs:
CFLAGS=-fPIC CXXFLAGS=-fPIC npx prebuild --upload-all --verbose
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Test binary
working-directory: libCacheSim-node
run: |
Expand All @@ -145,33 +145,33 @@ jobs:
if: github.event_name == 'release'
needs: build-and-publish
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Synchronize Node.js binding version
run: |
echo "Synchronizing Node.js binding version with main project..."
python3 scripts/sync_node_version.py

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake libglib2.0-dev libzstd-dev
sudo apt-get install -y build-essential cmake ninja-build libglib2.0-dev libzstd-dev

- name: Build libCacheSim
run: |
mkdir -p _build
cd _build
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} ..
make -j$(nproc)
cmake -G Ninja -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} ..
ninja

- name: Prepare vendored library
run: |
Expand All @@ -184,4 +184,4 @@ jobs:
working-directory: libCacheSim-node
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Loading
Loading