mirror of
https://github.com/rustfs/rustfs.git
synced 2026-09-04 19:25:40 +00:00
refactor(ci): improve samply profiling workflow with timeout handling
- Add 2-minute timeout to samply record command with proper error handling - Improve test volume directory creation - Add workflow_dispatch for manual triggering - Add job timeout of 10 minutes - Set environment variables to match run.sh configuration - Add run number to artifact name for better identification - Add proper error checking and output when profiling fails - Set artifact retention period to 7 days
This commit is contained in:
@@ -2,14 +2,17 @@ name: Profile with Samply
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
|
workflow_dispatch:
|
||||||
jobs:
|
jobs:
|
||||||
profile:
|
profile:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: dtolnay/rust-toolchain@nightly
|
- uses: dtolnay/rust-toolchain@nightly
|
||||||
with:
|
with:
|
||||||
components: llvm-tools-preview
|
components: llvm-tools-preview
|
||||||
|
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
@@ -17,23 +20,49 @@ jobs:
|
|||||||
~/.cargo/git
|
~/.cargo/git
|
||||||
target
|
target
|
||||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||||
- uses: taiki-e/cache-cargo-install-action@v2
|
|
||||||
|
- name: Install samply
|
||||||
|
uses: taiki-e/cache-cargo-install-action@v2
|
||||||
with:
|
with:
|
||||||
tool: samply
|
tool: samply
|
||||||
- run: echo '1' | sudo tee /proc/sys/kernel/perf_event_paranoid
|
|
||||||
|
- name: Configure kernel for profiling
|
||||||
|
run: echo '1' | sudo tee /proc/sys/kernel/perf_event_paranoid
|
||||||
|
|
||||||
- name: Create test volumes
|
- name: Create test volumes
|
||||||
run: |
|
run: |
|
||||||
for i in {0..4}; do
|
for i in {0..4}; do
|
||||||
mkdir -p ./target/volume/test$i
|
mkdir -p ./target/volume/test$i
|
||||||
done
|
done
|
||||||
- name: Set RUSTFS_VOLUMES
|
|
||||||
|
- name: Set environment variables
|
||||||
run: |
|
run: |
|
||||||
export RUSTFS_VOLUMES="./target/volume/test{0...4}"
|
echo "RUSTFS_VOLUMES=./target/volume/test{0...4}" >> $GITHUB_ENV
|
||||||
echo "RUSTFS_VOLUMES=$RUSTFS_VOLUMES" >> $GITHUB_ENV
|
echo "RUST_LOG=rustfs=info,ecstore=info,s3s=info,iam=info,rustfs-obs=info" >> $GITHUB_ENV
|
||||||
- run: echo "RUSTFS_VOLUMES is $RUSTFS_VOLUMES" # Debug output
|
|
||||||
- run: RUSTFLAGS="-C force-frame-pointers=yes" cargo +nightly build --profile profiling -p rustfs --bins
|
- name: Download static files
|
||||||
- run: samply record --output profile.json ./target/profiling/rustfs ${RUSTFS_VOLUMES}
|
run: |
|
||||||
- uses: actions/upload-artifact@v4
|
curl -L "https://dl.rustfs.com/artifacts/console/rustfs-console-latest.zip" -o tempfile.zip && unzip -o tempfile.zip -d ./rustfs/static && rm tempfile.zip
|
||||||
|
|
||||||
|
- name: Build with profiling
|
||||||
|
run: |
|
||||||
|
RUSTFLAGS="-C force-frame-pointers=yes" cargo +nightly build --profile profiling -p rustfs --bins
|
||||||
|
|
||||||
|
- name: Run samply with timeout
|
||||||
|
id: samply_record
|
||||||
|
run: |
|
||||||
|
timeout 120s samply record --output samply.json ./target/profiling/rustfs ${RUSTFS_VOLUMES}
|
||||||
|
if [ -f "samply.json" ]; then
|
||||||
|
echo "profile_generated=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "profile_generated=false" >> $GITHUB_OUTPUT
|
||||||
|
echo "::error::Failed to generate profile data"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Upload profile data
|
||||||
|
if: steps.samply_record.outputs.profile_generated == 'true'
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: samply-profile
|
name: samply-profile-${{ github.run_number }}
|
||||||
path: profile.json
|
path: samply.json
|
||||||
|
retention-days: 7
|
||||||
Reference in New Issue
Block a user