fix: benchmark workflow #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Performance Benchmarks | |
| defaults: | |
| run: | |
| shell: bash | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| env: | |
| DOTNET_VERSION: '8.0.x' | |
| on: | |
| push: | |
| branches: [ "add-performance-benchmark-with-efcore" ] | |
| release: | |
| types: [ published ] | |
| workflow_dispatch: | |
| jobs: | |
| benchmark-mysql: | |
| name: MySQL Benchmark | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Load .env file | |
| uses: xom9ikk/[email protected] | |
| with: | |
| load-mode: strict | |
| - name: Docker compose | |
| uses: hoverkraft-tech/[email protected] | |
| with: | |
| services: mysqldb | |
| - name: Run Benchmark | |
| run: ./benchmark/scripts/run_benchmark_for_db.sh mysql | |
| - name: Upload Results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mysql-results | |
| path: benchmark/BenchmarkDotNet.Artifacts/results/*.{md,html,csv} | |
| benchmark-postgresql: | |
| name: PostgreSQL Benchmark | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Load .env file | |
| uses: xom9ikk/[email protected] | |
| with: | |
| load-mode: strict | |
| - name: Docker compose | |
| uses: hoverkraft-tech/[email protected] | |
| with: | |
| services: postgresdb | |
| - name: Run Benchmark | |
| run: ./benchmark/scripts/run_benchmark_for_db.sh postgresql | |
| - name: Upload Results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: postgresql-results | |
| path: benchmark/BenchmarkDotNet.Artifacts/results/*.{md,html,csv} | |
| benchmark-sqlite: | |
| name: SQLite Benchmark | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Load .env file | |
| uses: xom9ikk/[email protected] | |
| with: | |
| load-mode: strict | |
| - name: Run Benchmark | |
| run: ./benchmark/scripts/run_benchmark_for_db.sh sqlite | |
| - name: Upload Results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sqlite-results | |
| path: benchmark/BenchmarkDotNet.Artifacts/results/*.{md,html,csv} | |
| push-results: | |
| name: Push Results | |
| runs-on: ubuntu-latest | |
| if: always() | |
| needs: [benchmark-mysql, benchmark-postgresql, benchmark-sqlite] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download MySQL Results | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: mysql-results | |
| path: benchmark/BenchmarkDotNet.Artifacts/results/mysql | |
| - name: Download PostgreSQL Results | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: postgresql-results | |
| path: benchmark/BenchmarkDotNet.Artifacts/results/postgresql | |
| - name: Download SQLite Results | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: sqlite-results | |
| path: benchmark/BenchmarkDotNet.Artifacts/results/sqlite | |
| - name: Create Pull Request | |
| uses: peter-evans/create-pull-request@v6 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| base: main | |
| title: update benchmark results | |
| commit-message: update benchmark results | |
| branch: update-benchmark-results | |
| branch-suffix: timestamp | |
| delete-branch: true |