-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(benchmarks): Allow backends to be excluded
- Loading branch information
1 parent
a8a5498
commit 4aad419
Showing
3 changed files
with
32 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
on: | ||
workflow_dispatch | ||
workflow_call: | ||
inputs: | ||
backend_exclude: | ||
type: string | ||
default: '' | ||
|
||
|
||
name: "⏱️ Benchmark" | ||
jobs: | ||
benchmark: | ||
name: "⏱️ Benchmark" | ||
runs-on: ubuntu-latest | ||
|
||
concurrency: | ||
|
@@ -31,18 +34,18 @@ jobs: | |
|
||
steps: | ||
- name: Install a SQL Server suite of tools | ||
if: ${{ !contains(inputs.backend_exclude, 'mssql') }} | ||
uses: potatoqualitee/[email protected] | ||
with: | ||
install: sqlengine, sqlpackage, sqlclient | ||
show-log: true | ||
|
||
- name: Configure SQL server | ||
if: ${{ !contains(inputs.backend_exclude, 'mssql') }} | ||
run: | | ||
set -o xtrace | ||
sqlcmd -V 10 -S localhost -U SA -P dbatools.I0 -Q "ALTER LOGIN SA WITH DEFAULT_DATABASE = master;" | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
@@ -54,8 +57,6 @@ jobs: | |
git config --local user.email "[email protected]" | ||
git switch ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} | ||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
|
@@ -64,43 +65,41 @@ jobs: | |
with: | ||
extra-packages: any::devtools | ||
|
||
|
||
- name: Delete previous benchmark files | ||
if: always() | ||
run: rm -rf inst/extdata/benchmark-*.rds | ||
|
||
|
||
|
||
- name: Get SQLite version | ||
if: ${{ !contains(inputs.backend_exclude, 'sqlite') }} | ||
run: | | ||
version=$(Rscript -e "cat(DBI::dbGetQuery(DBI::dbConnect(RSQLite::SQLite()), 'SELECT sqlite_version();')[[1]])") | ||
echo "SQLITE_VERSION=SQLite v$version" >> $GITHUB_ENV | ||
- name: Get DuckDB version | ||
if: ${{ !contains(inputs.backend_exclude, 'duckdb') }} | ||
run: | | ||
version=$(Rscript -e "conn <- DBI::dbConnect(duckdb::duckdb()); cat(DBI::dbGetQuery(conn, 'SELECT version();')[[1]]); DBI::dbDisconnect(conn, shutdown = TRUE)") | ||
echo "DUCKDB_VERSION=DuckDB $version" >> $GITHUB_ENV | ||
- name: Get PostgreSQL version | ||
if: ${{ !contains(inputs.backend_exclude, 'postgres') }} | ||
run: | | ||
version=$(psql --version | awk '{print $3}') | ||
echo "POSTGRES_VERSION=PostgreSQL v$version" >> $GITHUB_ENV | ||
- name: Get SQL Server version | ||
if: ${{ !contains(inputs.backend_exclude, 'mssql') }} | ||
run: | | ||
version=$(sqlcmd -S localhost -U SA -P dbatools.I0 -Q "SET NOCOUNT ON; SELECT SERVERPROPERTY('productversion') AS version" -h -1 -W -b) | ||
echo "SQL_SERVER_VERSION=SQL Server v$version" >> $GITHUB_ENV | ||
- name: Install libraries to benchmark | ||
if: always() | ||
run: source("./data-raw/benchmark.R", echo=TRUE) | ||
shell: Rscript {0} | ||
|
||
|
||
|
||
- name: Run benchmark (${{ env.SQLITE_VERSION }}) | ||
if: always() | ||
if: ${{ always() && !contains(inputs.backend_exclude, 'sqlite') }} | ||
env: | ||
BACKEND: ${{ env.SQLITE_VERSION }} | ||
BACKEND_DRV: RSQLite::SQLite | ||
|
@@ -109,7 +108,7 @@ jobs: | |
shell: Rscript {0} | ||
|
||
- name: Run benchmark (${{ env.DUCKDB_VERSION }}) | ||
if: always() | ||
if: ${{ always() && !contains(inputs.backend_exclude, 'duckdb') }} | ||
env: | ||
BACKEND: ${{ env.DUCKDB_VERSION }} | ||
BACKEND_DRV: duckdb::duckdb | ||
|
@@ -118,15 +117,15 @@ jobs: | |
shell: Rscript {0} | ||
|
||
- name: Run benchmark (${{ env.POSTGRES_VERSION }}) | ||
if: always() | ||
if: ${{ always() && !contains(inputs.backend_exclude, 'postgres') }} | ||
env: | ||
BACKEND: ${{ env.POSTGRES_VERSION }} | ||
BACKEND_DRV: RPostgres::Postgres | ||
run: source("./data-raw/benchmark.R", echo=TRUE) | ||
shell: Rscript {0} | ||
|
||
- name: Run benchmark (${{ env.SQL_SERVER_VERSION }}) | ||
if: always() | ||
if: ${{ always() && !contains(inputs.backend_exclude, 'mssql') }} | ||
env: | ||
BACKEND: ${{ env.SQL_SERVER_VERSION }} | ||
BACKEND_DRV: odbc::odbc | ||
|
@@ -143,8 +142,6 @@ jobs: | |
run: source("./data-raw/benchmark.R", echo=TRUE) | ||
shell: Rscript {0} | ||
|
||
|
||
|
||
- name: Display structure of benchmark files | ||
if: always() | ||
run: ls -R inst/extdata | ||
|
@@ -177,7 +174,6 @@ jobs: | |
saveRDS(benchmarks, file.path("inst", "extdata", "benchmarks.rds")) | ||
file.remove(benchmark_files) | ||
# Add note slow backends | ||
slow_backends <- benchmarks |> | ||
dplyr::distinct(.data$database, .data$n) |> | ||
|
@@ -187,7 +183,6 @@ jobs: | |
benchmarks <- benchmarks |> | ||
dplyr::mutate("database" = paste0(database, ifelse(database %in% slow_backends, "*", ""))) | ||
# Mean and standard deviation (see ggplot2::mean_se()) | ||
mean_sd <- function(x) { | ||
mu <- mean(x) | ||
|
@@ -229,6 +224,7 @@ jobs: | |
path: benchmarks.pdf | ||
|
||
- name: Commit and push changes | ||
if: always() | ||
run: | | ||
git remote set-url origin https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git | ||
git stash --include-untracked | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
on: | ||
workflow_dispatch | ||
|
||
name: Benchmark | ||
|
||
jobs: | ||
document: | ||
uses: ssi-dk/AEF-DDF/.github/workflows/benchmark.yaml@main | ||
secrets: inherit | ||
with: | ||
backend_exclude: "" |