Skip to content

add github actions

add github actions #1

# .github/workflows/codeql-analysis.yml
name: "CodeQL"
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
schedule:
- cron: '30 1 * * 0'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'csharp' ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Build
run: dotnet build --configuration Release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
---
# .github/workflows/benchmark.yml
name: Benchmark
on:
pull_request:
branches: [ main, master ]
workflow_dispatch:
jobs:
benchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Run simulation benchmark
run: |
cd ReaderWriter.ConsoleApp
dotnet run -c Release -- --readers 50 --writers 10 --duration 30
- name: Parse and comment results
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
script: |
// This is a placeholder - you'd parse actual results
const comment = `## 📊 Benchmark Results
**Configuration**: 50 readers, 10 writers, 30 seconds
| Metric | Value |
|--------|-------|
| Total Reads | X |
| Total Writes | Y |
| Read Timeouts | 0 |
| Write Timeouts | 0 |`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});