From f686f66339a80bbb469cceb01c6a074d67882019 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 3 Nov 2026 21:59:27 +0000 Subject: [PATCH 1/8] CI: run codegen checks and E2E on macOS and Windows with the Linux-built WASM Co-Authored-By: Doron Eli Rachman --- .gitattributes | 6 ++ .github/workflows/build.yml | 5 + .github/workflows/cross-platform.yml | 138 +++++++++++++++++++++++++++ exe/plugin.cmd | 1 + scripts/wasm/update_sha.sh | 3 +- tests/end2end_options.rb | 2 + 6 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 .gitattributes create mode 100644 .github/workflows/cross-platform.yml create mode 100644 exe/plugin.cmd diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..f9b9728 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +# Generated code, golden files and sqlc configs are compared byte for byte (sqlc diff, golden tests): +# keep LF on every OS, also on Windows checkouts with core.autocrlf. +* text=auto eol=lf +*.bin binary +*.wasm binary +*.cmd text eol=crlf diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6bfeea4..9ff8c8c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -146,3 +146,8 @@ jobs: run: >- ./scripts/tests/run_codegen.rb sqlc.ci.yaml "${{ matrix.ruby-version }}" ${{ matrix.generate-types }} ${{ matrix.generate-gemfile }} + + cross-platform: + name: Cross-platform + needs: [build-wasm] + uses: ./.github/workflows/cross-platform.yml diff --git a/.github/workflows/cross-platform.yml b/.github/workflows/cross-platform.yml new file mode 100644 index 0000000..4bae592 --- /dev/null +++ b/.github/workflows/cross-platform.yml @@ -0,0 +1,138 @@ +name: Cross-platform + +# Called by build.yml after build-wasm: macOS and Windows run the plugin.wasm built on Linux (the artifact a release +# publishes) through sqlc, and the generated code against natively installed PostgreSQL / MySQL and SQLite. +# The full Ruby / option matrix stays on Linux (tests.yml); here the oldest and newest supported Ruby. +on: + workflow_call: + +defaults: + run: + shell: bash + +permissions: + contents: read + +env: + DB_NAME: tests + DB_USER: root + DB_PASS: pass # ignored by the servers below (trust / empty-password root), required by the pg tests' env + POSTGRES_HOST: 127.0.0.1 + MYSQL_HOST: 127.0.0.1 + +jobs: + cross-platform: + name: ${{ matrix.os-name }}, Ruby ${{ matrix.ruby-version }} + runs-on: ${{ matrix.os }} + timeout-minutes: 40 + + strategy: + fail-fast: false + matrix: + os: [macos-latest, windows-latest] + ruby-version: ['3.1', '4.0'] + include: + - { os: macos-latest, os-name: macOS, postgres-version: '16' } + - { os: windows-latest, os-name: Windows, postgres-version: '17' } # the only version on windows-2025 + + env: + EXAMPLES_DIR: ${{ github.workspace }}/.examples-ruby-${{ matrix.ruby-version }} + BUNDLE_GEMFILE: ${{ github.workspace }}/Gemfile.e2e + + steps: + - uses: actions/checkout@v7 + + - name: Load tool versions + run: grep -E '^[A-Z_]+=' scripts/tool-versions.env >> "$GITHUB_ENV" + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + + - uses: sqlc-dev/setup-sqlc@bac53b7fb28c039a6c7f5736fd1e89744021bdd6 # v5.0.0 + with: + sqlc-version: '${{ env.SQLC_VERSION }}' + + - uses: ankane/setup-postgres@b1a598d92f86cb2ed364411898d150d4eac6d5ca # v1 + with: + postgres-version: ${{ matrix.postgres-version }} + database: ${{ env.DB_NAME }} + user: ${{ env.DB_USER }} + + - uses: ankane/setup-mysql@4aa1b08412d4c8bf537fea5bc412e4e831d839d7 # v1 + with: + mysql-version: '8.4' + database: ${{ env.DB_NAME }} + user: ${{ env.DB_USER }} + + - uses: actions/download-artifact@v8 + with: + name: wasm-file + path: dist + + - name: Updating plugin sha + run: ./scripts/wasm/update_sha.sh sqlc.ci.yaml + + # the process plugin on this OS's Ruby: no bundler, only the standard library + minitest + - name: Unit & golden tests + run: ruby -Ilib -Itest -e 'Dir["test/*_test.rb"].sort.each { |file| require File.expand_path(file) }' + + # the committed examples/ (LF, byte for byte) must come out of sqlc + the Linux-built WASM on this OS too + - name: Verify generated code is synced (WASM plugin) + run: sqlc -f sqlc.ci.yaml diff + + - name: Verify generated code is synced (process plugin) + run: | + if [ "${RUNNER_OS}" = Windows ]; then + # Windows cannot execute plugin.rb directly: sqlc runs the exe/plugin.cmd wrapper instead + sed 's#cmd: ./exe/plugin.rb#cmd: exe/plugin.cmd#' sqlc.local.yaml > .sqlc-windows.yaml + trap 'rm -f .sqlc-windows.yaml' EXIT + sqlc -f .sqlc-windows.yaml diff + else + sqlc -f sqlc.local.yaml diff + fi + + - name: Generate with the WASM for Ruby ${{ matrix.ruby-version }} and check the output + run: ruby scripts/tests/run_codegen.rb sqlc.ci.yaml "${{ matrix.ruby-version }}" true true + + # the E2E suites below run this WASM output, with the Gemfile it generates + - name: Generate the E2E examples with the WASM + run: ruby scripts/tests/generate_examples.rb "${{ matrix.ruby-version }}" sqlc.ci.yaml --generate-gemfile + + - name: Create the schemas (and allow LOAD DATA LOCAL INFILE for :copyfrom) + run: | + psql -v ON_ERROR_STOP=1 -h "${POSTGRES_HOST}" -U "${DB_USER}" -d "${DB_NAME}" -f examples/authors/postgresql/schema.sql + mysql -h "${MYSQL_HOST}" -u "${DB_USER}" -e 'SET GLOBAL local_infile = 1' + mysql -h "${MYSQL_HOST}" -u "${DB_USER}" --default-character-set=utf8mb4 "${DB_NAME}" < examples/authors/mysql/schema.sql + + - name: Native build settings for mysql2 + run: | + if [ "${RUNNER_OS}" = Windows ]; then + ridk.cmd exec pacman -S --noconfirm --needed mingw-w64-ucrt-x86_64-libmariadbclient + else + echo "BUNDLE_BUILD__MYSQL2=--with-opt-dir=$(brew --prefix openssl@3):$(brew --prefix zstd)" >> "$GITHUB_ENV" + fi + + - name: End-to-End tests (SQLite) + if: ${{ !cancelled() }} + env: + EXAMPLES_DRIVER: sqlite3 + run: bundle install && bundle exec rake end2end_sqlite3 + + - name: End-to-End tests (PostgreSQL ${{ matrix.postgres-version }}) + if: ${{ !cancelled() }} + env: + EXAMPLES_DRIVER: pg + run: bundle install && bundle exec rake end2end_pg + + - name: End-to-End tests (MySQL 8.4) + if: ${{ !cancelled() }} + env: + EXAMPLES_DRIVER: mysql2 + run: bundle install && bundle exec rake end2end_mysql2 + + - name: Generator options E2E + if: ${{ !cancelled() }} + env: + BUNDLE_GEMFILE: ${{ github.workspace }}/Gemfile.options.e2e + run: bundle install && bundle exec ruby tests/end2end_options.rb diff --git a/exe/plugin.cmd b/exe/plugin.cmd new file mode 100644 index 0000000..acc714f --- /dev/null +++ b/exe/plugin.cmd @@ -0,0 +1 @@ +@ruby "%~dp0plugin.rb" %* diff --git a/scripts/wasm/update_sha.sh b/scripts/wasm/update_sha.sh index 0c4d2a7..f29d0d1 100755 --- a/scripts/wasm/update_sha.sh +++ b/scripts/wasm/update_sha.sh @@ -3,6 +3,7 @@ set -euo pipefail filename=${1:?usage: update_sha.sh } -plugin_sha=$(shasum -a 256 dist/plugin.wasm | awk '{ print $1 }') +if command -v sha256sum >/dev/null 2>&1; then sha=(sha256sum); else sha=(shasum -a 256); fi # Git Bash / macOS +plugin_sha=$("${sha[@]}" dist/plugin.wasm | awk '{ print $1 }') sed -i.bak -E "s/^([[:space:]]*sha256:[[:space:]]*).*/\1${plugin_sha}/" "${filename}" && rm -f "${filename}.bak" grep -q "${plugin_sha}" "${filename}" || { echo "no sha256: line in ${filename}" >&2; exit 1; } diff --git a/tests/end2end_options.rb b/tests/end2end_options.rb index 5615c39..a5769ed 100644 --- a/tests/end2end_options.rb +++ b/tests/end2end_options.rb @@ -23,6 +23,8 @@ def test_generator_options_preserve_runtime_values_and_generate_expected_layouts begin config = YAML.safe_load_file(File.join(OPTIONS_DIR, 'sqlc.yaml')) config.fetch('options').fetch('ruby')['rubyVersion'] = RUBY_VERSION.split('.')[0, 2].join('.') + # Windows cannot execute exe/plugin.rb directly + config.fetch('plugins').first.fetch('process')['cmd'] = 'exe/plugin.cmd' if Gem.win_platform? File.write(config_path, config.to_yaml) assert system('sqlc', 'generate', '-f', config_path, chdir: ROOT) sqlite_dir = File.join(OUTPUT_DIR, 'sqlite3') From 9d7dd9f693d891d48dea673ea240fc1dedc40bda Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 3 Nov 2026 22:16:32 +0000 Subject: [PATCH 2/8] CI: 10-minute job timeouts; start Windows' preinstalled MySQL 8.4; logger in Gemfile.e2e for Ruby 4.0 Co-Authored-By: Doron Eli Rachman --- .github/workflows/build.yml | 4 ++++ .github/workflows/cross-platform.yml | 21 ++++++++++++++++++++- .github/workflows/docs.yml | 1 + .github/workflows/release.yml | 3 +++ .github/workflows/tests.yml | 6 ++++++ Gemfile.e2e | 1 + 6 files changed, 35 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9ff8c8c..d4e87cc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,6 +24,7 @@ jobs: build-wasm: name: Build (WASM) runs-on: ubuntu-latest + timeout-minutes: 10 steps: - uses: actions/checkout@v7 @@ -46,6 +47,7 @@ jobs: lint: name: Lint runs-on: ubuntu-latest + timeout-minutes: 10 steps: - uses: actions/checkout@v7 @@ -70,6 +72,7 @@ jobs: name: Codegen Tests needs: [build-wasm] runs-on: ubuntu-latest + timeout-minutes: 10 steps: - uses: actions/checkout@v7 @@ -108,6 +111,7 @@ jobs: name: Codegen Options (ruby ${{ matrix.ruby-version }}, types=${{ matrix.generate-types }}, gemfile=${{ matrix.generate-gemfile }}) needs: [build-wasm] runs-on: ubuntu-latest + timeout-minutes: 10 strategy: fail-fast: false diff --git a/.github/workflows/cross-platform.yml b/.github/workflows/cross-platform.yml index 4bae592..ec2a0e3 100644 --- a/.github/workflows/cross-platform.yml +++ b/.github/workflows/cross-platform.yml @@ -24,7 +24,7 @@ jobs: cross-platform: name: ${{ matrix.os-name }}, Ruby ${{ matrix.ruby-version }} runs-on: ${{ matrix.os }} - timeout-minutes: 40 + timeout-minutes: 10 strategy: fail-fast: false @@ -60,11 +60,26 @@ jobs: user: ${{ env.DB_USER }} - uses: ankane/setup-mysql@4aa1b08412d4c8bf537fea5bc412e4e831d839d7 # v1 + if: runner.os != 'Windows' with: mysql-version: '8.4' database: ${{ env.DB_NAME }} user: ${{ env.DB_USER }} + # windows-2025 ships MySQL 8.4 (on PATH); setup-mysql only treats 8.0 as preinstalled there and fails to + # reinstall 8.4 over it, so start the image's server the same way the action does + - name: Start the preinstalled MySQL 8.4 (Windows) + if: runner.os == 'Windows' + shell: pwsh + run: | + $ErrorActionPreference = 'Stop' + $PSNativeCommandUseErrorActionPreference = $true + $bin = 'C:\Program Files\MySQL\MySQL Server 8.4\bin' + & "$bin\mysqld" --initialize-insecure + & "$bin\mysqld" --install + net start MySQL + & "$bin\mysqladmin" -u $env:DB_USER create $env:DB_NAME + - uses: actions/download-artifact@v8 with: name: wasm-file @@ -136,3 +151,7 @@ jobs: env: BUNDLE_GEMFILE: ${{ github.workspace }}/Gemfile.options.e2e run: bundle install && bundle exec ruby tests/end2end_options.rb + + - name: Native extension build logs + if: failure() + run: find "$(ruby -e 'print Gem.dir')" -name mkmf.log -exec sh -c 'echo "== $1"; tail -n 60 "$1"' _ {} \; diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index fd8151e..ae56a93 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -22,6 +22,7 @@ on: jobs: generate-docs: runs-on: ubuntu-latest + timeout-minutes: 10 steps: - name: Checkout repository diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 360eecd..3f15b8d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,6 +39,7 @@ jobs: plan: name: Plan runs-on: ubuntu-latest + timeout-minutes: 10 if: github.ref == 'refs/heads/main' # releases are cut from main only outputs: version: ${{ steps.next.outputs.version }} @@ -74,6 +75,7 @@ jobs: name: Release ${{ needs.plan.outputs.version }} needs: [plan, build, tests] runs-on: ubuntu-latest + timeout-minutes: 10 permissions: contents: write # tag + release env: @@ -140,6 +142,7 @@ jobs: needs: [plan, release] if: ${{ !inputs.dry_run && !inputs.draft }} runs-on: ubuntu-latest + timeout-minutes: 10 env: VERSION: ${{ needs.plan.outputs.version }} SHA256: ${{ needs.release.outputs.sha256 }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 12e4ca4..2dfd095 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,6 +29,7 @@ jobs: unit-tests: name: Unit Tests runs-on: ubuntu-latest + timeout-minutes: 10 steps: - uses: actions/checkout@v7 @@ -45,6 +46,7 @@ jobs: compatibility: name: Plugin on Ruby ${{ matrix.ruby-version }} runs-on: ubuntu-latest + timeout-minutes: 10 strategy: fail-fast: false @@ -65,6 +67,7 @@ jobs: end2end-pg: name: End-to-End (PostgreSQL, Ruby ${{ matrix.ruby-version }}, ${{ matrix.variant }}) runs-on: ubuntu-latest + timeout-minutes: 10 strategy: fail-fast: false @@ -141,6 +144,7 @@ jobs: end2end-mysql: name: End-to-End (MySQL, Ruby ${{ matrix.ruby-version }}, ${{ matrix.variant }}) runs-on: ubuntu-latest + timeout-minutes: 10 strategy: fail-fast: false @@ -215,6 +219,7 @@ jobs: end2end-sqlite: name: End-to-End (SQLite, Ruby ${{ matrix.ruby-version }}, ${{ matrix.variant }}) runs-on: ubuntu-latest + timeout-minutes: 10 strategy: fail-fast: false @@ -269,6 +274,7 @@ jobs: end2end-options: name: Generator options E2E (Ruby ${{ matrix.ruby-version }}) runs-on: ubuntu-latest + timeout-minutes: 10 strategy: fail-fast: false diff --git a/Gemfile.e2e b/Gemfile.e2e index 0b924e0..e0f1510 100644 --- a/Gemfile.e2e +++ b/Gemfile.e2e @@ -6,6 +6,7 @@ examples_dir = ENV.fetch('EXAMPLES_DIR') { raise 'EXAMPLES_DIR must point at gen driver = ENV.fetch('EXAMPLES_DRIVER') { raise 'EXAMPLES_DRIVER must be set for E2E bundling' } eval_gemfile File.join(examples_dir, driver, 'Gemfile') +gem 'logger' # tests/end2end_*.rb; not a default gem since Ruby 4.0 gem 'async', RUBY_VERSION.start_with?('3.1') ? '< 2.7' : '>= 2.7' gem 'minitest' gem 'rake' From 41accfcaa85f2fc8af72c9aa852aa135ac6f1a03 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 3 Nov 2026 22:29:57 +0000 Subject: [PATCH 3/8] E2E Gemfile: bigdecimal for the tests on Ruby >= 3.4 Co-Authored-By: Doron Eli Rachman --- Gemfile.e2e | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Gemfile.e2e b/Gemfile.e2e index e0f1510..4b41ee8 100644 --- a/Gemfile.e2e +++ b/Gemfile.e2e @@ -6,7 +6,8 @@ examples_dir = ENV.fetch('EXAMPLES_DIR') { raise 'EXAMPLES_DIR must point at gen driver = ENV.fetch('EXAMPLES_DRIVER') { raise 'EXAMPLES_DRIVER must be set for E2E bundling' } eval_gemfile File.join(examples_dir, driver, 'Gemfile') -gem 'logger' # tests/end2end_*.rb; not a default gem since Ruby 4.0 +gem 'bigdecimal' # tests/; bundled (not default) gems since Ruby 3.4 / 4.0 +gem 'logger' gem 'async', RUBY_VERSION.start_with?('3.1') ? '< 2.7' : '>= 2.7' gem 'minitest' gem 'rake' From ccecd2f68602b531f1bd00488bca6ede87508249 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 3 Nov 2026 22:32:11 +0000 Subject: [PATCH 4/8] E2E: close the SQLite test database in teardown (Ruby 3.1 finalizer deadlock); Windows plugin.cmd path with backslashes Co-Authored-By: Doron Eli Rachman --- .github/workflows/cross-platform.yml | 6 +++--- tests/end2end_options.rb | 4 ++-- tests/end2end_sqlite3.rb | 6 ++++++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cross-platform.yml b/.github/workflows/cross-platform.yml index ec2a0e3..ac73517 100644 --- a/.github/workflows/cross-platform.yml +++ b/.github/workflows/cross-platform.yml @@ -99,8 +99,8 @@ jobs: - name: Verify generated code is synced (process plugin) run: | if [ "${RUNNER_OS}" = Windows ]; then - # Windows cannot execute plugin.rb directly: sqlc runs the exe/plugin.cmd wrapper instead - sed 's#cmd: ./exe/plugin.rb#cmd: exe/plugin.cmd#' sqlc.local.yaml > .sqlc-windows.yaml + # Windows cannot execute plugin.rb directly: sqlc runs the exe\plugin.cmd wrapper (through cmd.exe, so backslashes) + sed 's#cmd: ./exe/plugin.rb#cmd: exe\\plugin.cmd#' sqlc.local.yaml > .sqlc-windows.yaml trap 'rm -f .sqlc-windows.yaml' EXIT sqlc -f .sqlc-windows.yaml diff else @@ -154,4 +154,4 @@ jobs: - name: Native extension build logs if: failure() - run: find "$(ruby -e 'print Gem.dir')" -name mkmf.log -exec sh -c 'echo "== $1"; tail -n 60 "$1"' _ {} \; + run: find "$(ruby -e 'print Gem.dir')" -name mkmf.log -exec sh -c 'echo "== $1"; cat "$1"' _ {} \; diff --git a/tests/end2end_options.rb b/tests/end2end_options.rb index 4a2d04e..4b1aef1 100644 --- a/tests/end2end_options.rb +++ b/tests/end2end_options.rb @@ -23,8 +23,8 @@ def test_generator_options_preserve_runtime_values_and_generate_expected_layouts begin config = YAML.safe_load_file(File.join(OPTIONS_DIR, 'sqlc.yaml')) config.fetch('options').fetch('ruby')['rubyVersion'] = RUBY_VERSION.split('.')[0, 2].join('.') - # Windows cannot execute exe/plugin.rb directly - config.fetch('plugins').first.fetch('process')['cmd'] = 'exe/plugin.cmd' if Gem.win_platform? + # Windows cannot execute exe/plugin.rb directly; cmd.exe needs backslashes (it reads `/plugin.cmd` as a switch) + config.fetch('plugins').first.fetch('process')['cmd'] = 'exe\\plugin.cmd' if Gem.win_platform? File.write(config_path, config.to_yaml) assert system('sqlc', 'generate', '-f', config_path, chdir: ROOT) sqlite_dir = File.join(OUTPUT_DIR, 'sqlite3') diff --git a/tests/end2end_sqlite3.rb b/tests/end2end_sqlite3.rb index 108bef7..ccb4341 100644 --- a/tests/end2end_sqlite3.rb +++ b/tests/end2end_sqlite3.rb @@ -73,6 +73,12 @@ def setup @query_sql = QuerySql.new(@db) end + # Close on the test's own thread: a database left to the GC can be finalized on another thread while a timed-out + # `sleep` function still holds its SQLite mutex, which deadlocks the process (seen on Ruby 3.1 / sqlite3 2.8). + def teardown + @db.close + end + def create_author(name, bio = nil) @query_sql.create_author_return_id(name: name, bio: bio) end From 8a3a82c32d87280fdfcb93cb38e53e144a0bdee6 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 3 Nov 2026 22:37:34 +0000 Subject: [PATCH 5/8] Cross-platform: set up Ruby after the databases so the MSYS2 toolchain wins on PATH; document the new coverage Co-Authored-By: Doron Eli Rachman --- .github/workflows/cross-platform.yml | 10 ++++++---- CLAUDE.md | 4 +++- docs/Testing.md | 1 + 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cross-platform.yml b/.github/workflows/cross-platform.yml index ac73517..9b4e3bc 100644 --- a/.github/workflows/cross-platform.yml +++ b/.github/workflows/cross-platform.yml @@ -45,10 +45,6 @@ jobs: - name: Load tool versions run: grep -E '^[A-Z_]+=' scripts/tool-versions.env >> "$GITHUB_ENV" - - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby-version }} - - uses: sqlc-dev/setup-sqlc@bac53b7fb28c039a6c7f5736fd1e89744021bdd6 # v5.0.0 with: sqlc-version: '${{ env.SQLC_VERSION }}' @@ -80,6 +76,12 @@ jobs: net start MySQL & "$bin\mysqladmin" -u $env:DB_USER create $env:DB_NAME + # after the databases: their bin dirs (PostgreSQL ships its own zlib/iconv DLLs) must come after Ruby's MSYS2 + # toolchain on PATH, or gcc fails silently on Windows and no native gem builds + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + - uses: actions/download-artifact@v8 with: name: wasm-file diff --git a/CLAUDE.md b/CLAUDE.md index 28e2b33..891fa12 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -45,7 +45,9 @@ UPDATE_GOLDEN=1 bundle exec ruby -Itest test/extended_golden_test.rb # rewrite * Develop on a feature branch, small commits; PRs target `main`. Label PRs (`bug`, `enhancement`, `documentation`; `breaking` for incompatible changes, see `.github/release.yml`). * CI: `build.yml` (WASM, lint, `sqlc diff`, Steep, option matrix) and `tests.yml` (unit, compatibility Ruby 3.1/3.2/3.4/4.0, full E2E Ruby 3.1–4.0, Ruby 4.0 module-name variants and PostgreSQL without prepared statements, - plus generator-options E2E on Ruby 3.1/4.0 against PostgreSQL 16, MySQL 8.3 and SQLite). Both must be green. + plus generator-options E2E on Ruby 3.1/4.0 against PostgreSQL 16, MySQL 8.3 and SQLite). `build.yml` also runs + `cross-platform.yml`: the Linux-built WASM, the process plugin and all E2E suites on macOS and Windows (Ruby 3.1/4.0, + native databases). All must be green; every job has `timeout-minutes: 10`. * **Never create tags or releases by hand and never add release markers to commit messages.** Releases are started by a maintainer with the *Release* workflow (`docs/Releasing.md`); do not trigger it unless explicitly asked. * Tool versions (sqlc, ruby.wasm) are pinned in `scripts/tool-versions.env`; bump them there only. diff --git a/docs/Testing.md b/docs/Testing.md index 47344ce..3493e94 100644 --- a/docs/Testing.md +++ b/docs/Testing.md @@ -46,6 +46,7 @@ They `require` the generated code from `examples/` and run it against a real dat |---|---|---| | `build.yml` | push to `main`, pull requests (not for Markdown-only changes), release | build `plugin.wasm`; lint; `sqlc diff` with the WASM and the process plugin; Steep; generate with option combinations (Ruby 3.1/3.2/3.3/4.0 × types/Gemfile) and check the output with the matching Ruby | | `tests.yml` | same | unit tests; plugin compatibility on Ruby 3.1 / 3.2 / 3.4 / 4.0; full E2E matrix on Ruby 3.1 / 3.2 / 3.3 / 3.4 / 4.0; Ruby 4.0 module-name variants for MySQL and SQLite and module-name + no-prepared-statements variant for PostgreSQL; PostgreSQL 16.2, MySQL 8.3.0, and SQLite; generator-options E2E on Ruby 3.1 / 4.0 | +| `cross-platform.yml` | called by `build.yml` after `build-wasm` | macOS and Windows × Ruby 3.1 / 4.0 (oldest and newest supported): unit + golden tests; `sqlc diff` with the Linux-built `plugin.wasm` and with the process plugin (`exe\plugin.cmd` on Windows); WASM codegen check; full E2E for SQLite, PostgreSQL (16 on macOS, 17 on Windows) and MySQL 8.4, installed natively (`ankane/setup-postgres`, `ankane/setup-mysql`, the image's MySQL on Windows), using the generated Gemfiles; generator-options E2E | | `docs.yml` | `examples/` change on `main`, manual | regenerates `docs/Examples.md` and opens a PR | | `release.yml` | manual only | see [Releasing](Releasing.md) | From 844feaffa5a4bf6efa3bbb92188253be520053e3 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 3 Nov 2026 22:48:26 +0000 Subject: [PATCH 6/8] mysql2 :copyfrom: write Ctrl-Z as \Z (LOAD DATA LOCAL stops at a raw one on Windows); E2E: read .rbs files before fibers run, no fiber overlap expected from mysql2 on Windows; Windows mysql2 build points at mariadb_config Co-Authored-By: Doron Eli Rachman --- .github/workflows/cross-platform.yml | 4 ++++ README.md | 2 +- examples/mysql2/query_sql.rb | 2 +- lib/sqlc_gen_ruby/drivers/mysql2.rb | 5 +++-- test/golden/mysql2/default/query_sql.rb | 2 +- test/golden/mysql2/ruby31_gemfile/query_sql.rb | 2 +- test/golden/mysql2/ruby32_notypes/query_sql.rb | 2 +- tests/end2end_mysql2.rb | 7 +++++-- tests/rbs_types.rb | 13 ++++++++++--- 9 files changed, 27 insertions(+), 12 deletions(-) diff --git a/.github/workflows/cross-platform.yml b/.github/workflows/cross-platform.yml index 9b4e3bc..c37e121 100644 --- a/.github/workflows/cross-platform.yml +++ b/.github/workflows/cross-platform.yml @@ -126,6 +126,10 @@ jobs: run: | if [ "${RUNNER_OS}" = Windows ]; then ridk.cmd exec pacman -S --noconfirm --needed mingw-w64-ucrt-x86_64-libmariadbclient + # mysql2's extconf can't glob for mariadb_config.exe through Windows PATH entries, so point at it + mariadb_config=$(cygpath -m "${RI_DEVKIT}/ucrt64/bin/mariadb_config.exe") + test -x "${mariadb_config}" + echo "BUNDLE_BUILD__MYSQL2=--with-mysql-config=${mariadb_config}" >> "$GITHUB_ENV" else echo "BUNDLE_BUILD__MYSQL2=--with-opt-dir=$(brew --prefix openssl@3):$(brew --prefix zstd)" >> "$GITHUB_ENV" fi diff --git a/README.md b/README.md index 6e4948a..c307d81 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ per table, one module of constants per enum), `connection.rb` (shared helpers) a * **Logging:** `connect(params, logger: Rails.logger)` / `new(pool, logger:)` logs `QuerySql#get_author (0.4ms)` at debug level for each query and transaction. Parameter values are never logged. * **Async / fibers:** it is plain synchronous Ruby and works with the Fiber scheduler ([`async`](https://github.com/socketry/async)): - inside `Sync { ... }`, pooled `pg` and `mysql2` queries run concurrently. MySQL parameters are quoted client-side + inside `Sync { ... }`, pooled `pg` and `mysql2` queries run concurrently (`mysql2` blocks the thread on Windows). MySQL parameters are quoted client-side with `Mysql2::Client#escape` and sent with `Client#query`, not server-side prepared statements. SQLite queries run one at a time. * **Style:** SQL lives in frozen heredoc constants (`GET_AUTHOR_SQL`), comments above a query become its doc comment, diff --git a/examples/mysql2/query_sql.rb b/examples/mysql2/query_sql.rb index d706042..319a8be 100644 --- a/examples/mysql2/query_sql.rb +++ b/examples/mysql2/query_sql.rb @@ -1328,7 +1328,7 @@ def csv_line(values) when true then '1' when false then '0' when Time then value.strftime('%Y-%m-%d %H:%M:%S.%6N') - else %("#{value.to_s.b.gsub('\\') { '\\\\' }.gsub('"', '""')}") + else %("#{value.to_s.b.gsub('\\') { '\\\\' }.gsub('"', '""').gsub("\x1A") { '\Z' }}") end end "#{fields.join(',')}\n" diff --git a/lib/sqlc_gen_ruby/drivers/mysql2.rb b/lib/sqlc_gen_ruby/drivers/mysql2.rb index e795aaf..3d94b33 100644 --- a/lib/sqlc_gen_ruby/drivers/mysql2.rb +++ b/lib/sqlc_gen_ruby/drivers/mysql2.rb @@ -227,7 +227,8 @@ def load_data(client, sql, strict: true) RUBY # \N is LOAD DATA's NULL; every other value is enclosed in quotes (an unquoted NULL would also be read as - # NULL), backslashes are doubled because the statement uses ESCAPED BY '\'. + # NULL), backslashes are doubled because the statement uses ESCAPED BY '\'. Ctrl-Z is written as \Z: the client + # library reads the file in text mode on Windows, where a raw Ctrl-Z ends it. CSV_LINE = <<~'RUBY'.chomp # Formats one row for LOAD DATA ... FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '\\'. def csv_line(values) @@ -237,7 +238,7 @@ def csv_line(values) when true then '1' when false then '0' when Time then value.strftime('%Y-%m-%d %H:%M:%S.%6N') - else %("#{value.to_s.b.gsub('\\') { '\\\\' }.gsub('"', '""')}") + else %("#{value.to_s.b.gsub('\\') { '\\\\' }.gsub('"', '""').gsub("\x1A") { '\Z' }}") end end "#{fields.join(',')}\n" diff --git a/test/golden/mysql2/default/query_sql.rb b/test/golden/mysql2/default/query_sql.rb index a4df2c2..4617555 100644 --- a/test/golden/mysql2/default/query_sql.rb +++ b/test/golden/mysql2/default/query_sql.rb @@ -1403,7 +1403,7 @@ def csv_line(values) when true then '1' when false then '0' when Time then value.strftime('%Y-%m-%d %H:%M:%S.%6N') - else %("#{value.to_s.b.gsub('\\') { '\\\\' }.gsub('"', '""')}") + else %("#{value.to_s.b.gsub('\\') { '\\\\' }.gsub('"', '""').gsub("\x1A") { '\Z' }}") end end "#{fields.join(',')}\n" diff --git a/test/golden/mysql2/ruby31_gemfile/query_sql.rb b/test/golden/mysql2/ruby31_gemfile/query_sql.rb index 595f4fd..df19153 100644 --- a/test/golden/mysql2/ruby31_gemfile/query_sql.rb +++ b/test/golden/mysql2/ruby31_gemfile/query_sql.rb @@ -1422,7 +1422,7 @@ def csv_line(values) when true then '1' when false then '0' when Time then value.strftime('%Y-%m-%d %H:%M:%S.%6N') - else %("#{value.to_s.b.gsub('\\') { '\\\\' }.gsub('"', '""')}") + else %("#{value.to_s.b.gsub('\\') { '\\\\' }.gsub('"', '""').gsub("\x1A") { '\Z' }}") end end "#{fields.join(',')}\n" diff --git a/test/golden/mysql2/ruby32_notypes/query_sql.rb b/test/golden/mysql2/ruby32_notypes/query_sql.rb index 557e3d6..b54f829 100644 --- a/test/golden/mysql2/ruby32_notypes/query_sql.rb +++ b/test/golden/mysql2/ruby32_notypes/query_sql.rb @@ -1411,7 +1411,7 @@ def csv_line(values) when true then '1' when false then '0' when Time then value.strftime('%Y-%m-%d %H:%M:%S.%6N') - else %("#{value.to_s.b.gsub('\\') { '\\\\' }.gsub('"', '""')}") + else %("#{value.to_s.b.gsub('\\') { '\\\\' }.gsub('"', '""').gsub("\x1A") { '\Z' }}") end end "#{fields.join(',')}\n" diff --git a/tests/end2end_mysql2.rb b/tests/end2end_mysql2.rb index a149854..9af5aee 100755 --- a/tests/end2end_mysql2.rb +++ b/tests/end2end_mysql2.rb @@ -464,6 +464,8 @@ def test_generated_queries_overlap_across_threads end def test_generated_queries_overlap_under_sync_including_transactions + # mysql2 has no non-blocking query on Windows (its C extension blocks the thread there): results only, no overlap + overlap = !Gem.win_platform? queries = QuerySql.connect(mysql2_params, size: 5) count = 5 seconds = 0.3 @@ -479,7 +481,7 @@ def test_generated_queries_overlap_under_sync_including_transactions end concurrent = Process.clock_gettime(Process::CLOCK_MONOTONIC) - started assert_operator concurrent, :<, serial * 0.6, - "#{count} generated queries took #{concurrent}s vs #{serial}s serially" + "#{count} generated queries took #{concurrent}s vs #{serial}s serially" if overlap started = Process.clock_gettime(Process::CLOCK_MONOTONIC) count.times { queries.transaction { |tx| tx.pause_query(seconds: seconds) } } @@ -495,7 +497,7 @@ def test_generated_queries_overlap_under_sync_including_transactions end concurrent = Process.clock_gettime(Process::CLOCK_MONOTONIC) - started assert_operator concurrent, :<, serial * 0.6, - "#{count} generated transactions took #{concurrent}s vs #{serial}s serially" + "#{count} generated transactions took #{concurrent}s vs #{serial}s serially" if overlap end def test_sql_placeholders_inside_literals_identifiers_and_comments_are_ignored @@ -827,6 +829,7 @@ def test_seeded_random_copyfrom_round_trip_and_duplicate_is_atomic note: random.rand(3).zero? ? nil : random_text(random), payload: random.bytes(random.rand(0..16)).b) end + rows << CopyRegressionRowsArgs.new(id: 5_000_001_000, order: "ctrl-z \x1A text", note: "\x1A", payload: "\x1A\x1A".b) @query_sql.copy_regression_rows(rows) expected = rows.map { |r| [r.id, r.order, r.note, r.payload] }.sort_by(&:first) actual = @query_sql.list_regression_rows.map { |r| [r.id, r.order, r.note, r.payload] } diff --git a/tests/rbs_types.rb b/tests/rbs_types.rb index 2afc583..880f055 100644 --- a/tests/rbs_types.rb +++ b/tests/rbs_types.rb @@ -8,9 +8,14 @@ module RbsTypes module_function + SOURCES = {} # rubocop:disable Style/MutableConstant + + # Read once, before any query runs: File.read inside a fiber scheduler raises EBADF on Windows (Ruby 3.1 + async) + def source(path) = SOURCES[path] ||= File.read(path) + # { 'c_date' => 'Date?', ... } for `class ` in an .rbs file def attributes(rbs_path, class_name) - body = File.read(rbs_path)[/^( *)class #{Regexp.escape(class_name)}(?: < [^\n]+)?\n(.*?)^\1end$/m, 2] or + body = source(rbs_path)[/^( *)class #{Regexp.escape(class_name)}(?: < [^\n]+)?\n(.*?)^\1end$/m, 2] or raise "#{class_name} not in #{rbs_path}" body.scan(/attr_(?:reader|accessor) (\w+): (.+)$/).to_h end @@ -29,7 +34,9 @@ def install(query_class, rbs_path) return unless File.file?(rbs_path) module_name = query_class.name.sub(/::QuerySql\z/, '') - signatures = File.read(rbs_path).scan(/^\s+def ([\w!?]+):.*?-> (.+)$/).to_h + models_path = File.join(File.dirname(rbs_path), 'models.rbs') + source(models_path) if File.file?(models_path) + signatures = source(rbs_path).scan(/^\s+def ([\w!?]+):.*?-> (.+)$/).to_h methods = query_class.public_instance_methods(false).filter_map do |name| type = signatures[name.to_s] [name, type] if type && type != 'T' && name != :transaction @@ -99,7 +106,7 @@ def resolve_type(type, module_name) end def rbs_has_class?(rbs_path, class_name) - File.read(rbs_path).match?(/^\s*class #{Regexp.escape(class_name)}(?: < [^\n]+)?$/) + source(rbs_path).match?(/^\s*class #{Regexp.escape(class_name)}(?: < [^\n]+)?$/) end def matches?(value, type) From cca2003debbcfd58273428a21ccdc07bdf43d044 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 3 Nov 2026 23:04:27 +0000 Subject: [PATCH 7/8] Cross-platform CI: split codegen and E2E into parallel jobs, cache the E2E gems per runner image Co-Authored-By: Doron Eli Rachman --- .github/workflows/cross-platform.yml | 96 +++++++++++++++++++++------- .gitignore | 1 + docs/Testing.md | 2 +- 3 files changed, 74 insertions(+), 25 deletions(-) diff --git a/.github/workflows/cross-platform.yml b/.github/workflows/cross-platform.yml index c37e121..c5110f0 100644 --- a/.github/workflows/cross-platform.yml +++ b/.github/workflows/cross-platform.yml @@ -21,8 +21,66 @@ env: MYSQL_HOST: 127.0.0.1 jobs: - cross-platform: - name: ${{ matrix.os-name }}, Ruby ${{ matrix.ruby-version }} + codegen: + name: Codegen (${{ matrix.os-name }}, Ruby ${{ matrix.ruby-version }}) + runs-on: ${{ matrix.os }} + timeout-minutes: 10 + + strategy: + fail-fast: false + matrix: + os: [macos-latest, windows-latest] + ruby-version: ['3.1', '4.0'] + include: + - { os: macos-latest, os-name: macOS } + - { os: windows-latest, os-name: Windows } + + steps: + - uses: actions/checkout@v7 + + - name: Load tool versions + run: grep -E '^[A-Z_]+=' scripts/tool-versions.env >> "$GITHUB_ENV" + + - uses: sqlc-dev/setup-sqlc@bac53b7fb28c039a6c7f5736fd1e89744021bdd6 # v5.0.0 + with: + sqlc-version: '${{ env.SQLC_VERSION }}' + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + + - uses: actions/download-artifact@v8 + with: + name: wasm-file + path: dist + + - name: Updating plugin sha + run: ./scripts/wasm/update_sha.sh sqlc.ci.yaml + + # the process plugin on this OS's Ruby: no bundler, only the standard library + minitest + - name: Unit & golden tests + run: ruby -Ilib -Itest -e 'Dir["test/*_test.rb"].sort.each { |file| require File.expand_path(file) }' + + # the committed examples/ (LF, byte for byte) must come out of sqlc + the Linux-built WASM on this OS too + - name: Verify generated code is synced (WASM plugin) + run: sqlc -f sqlc.ci.yaml diff + + - name: Verify generated code is synced (process plugin) + run: | + if [ "${RUNNER_OS}" = Windows ]; then + # Windows cannot execute plugin.rb directly: sqlc runs the exe\plugin.cmd wrapper (through cmd.exe, so backslashes) + sed 's#cmd: ./exe/plugin.rb#cmd: exe\\plugin.cmd#' sqlc.local.yaml > .sqlc-windows.yaml + trap 'rm -f .sqlc-windows.yaml' EXIT + sqlc -f .sqlc-windows.yaml diff + else + sqlc -f sqlc.local.yaml diff + fi + + - name: Generate with the WASM for Ruby ${{ matrix.ruby-version }} and check the output + run: ruby scripts/tests/run_codegen.rb sqlc.ci.yaml "${{ matrix.ruby-version }}" true true + + end2end: + name: End-to-End (${{ matrix.os-name }}, Ruby ${{ matrix.ruby-version }}) runs-on: ${{ matrix.os }} timeout-minutes: 10 @@ -38,6 +96,7 @@ jobs: env: EXAMPLES_DIR: ${{ github.workspace }}/.examples-ruby-${{ matrix.ruby-version }} BUNDLE_GEMFILE: ${{ github.workspace }}/Gemfile.e2e + BUNDLE_PATH: ${{ github.workspace }}/.e2e-gems steps: - uses: actions/checkout@v7 @@ -90,28 +149,6 @@ jobs: - name: Updating plugin sha run: ./scripts/wasm/update_sha.sh sqlc.ci.yaml - # the process plugin on this OS's Ruby: no bundler, only the standard library + minitest - - name: Unit & golden tests - run: ruby -Ilib -Itest -e 'Dir["test/*_test.rb"].sort.each { |file| require File.expand_path(file) }' - - # the committed examples/ (LF, byte for byte) must come out of sqlc + the Linux-built WASM on this OS too - - name: Verify generated code is synced (WASM plugin) - run: sqlc -f sqlc.ci.yaml diff - - - name: Verify generated code is synced (process plugin) - run: | - if [ "${RUNNER_OS}" = Windows ]; then - # Windows cannot execute plugin.rb directly: sqlc runs the exe\plugin.cmd wrapper (through cmd.exe, so backslashes) - sed 's#cmd: ./exe/plugin.rb#cmd: exe\\plugin.cmd#' sqlc.local.yaml > .sqlc-windows.yaml - trap 'rm -f .sqlc-windows.yaml' EXIT - sqlc -f .sqlc-windows.yaml diff - else - sqlc -f sqlc.local.yaml diff - fi - - - name: Generate with the WASM for Ruby ${{ matrix.ruby-version }} and check the output - run: ruby scripts/tests/run_codegen.rb sqlc.ci.yaml "${{ matrix.ruby-version }}" true true - # the E2E suites below run this WASM output, with the Gemfile it generates - name: Generate the E2E examples with the WASM run: ruby scripts/tests/generate_examples.rb "${{ matrix.ruby-version }}" sqlc.ci.yaml --generate-gemfile @@ -134,6 +171,17 @@ jobs: echo "BUNDLE_BUILD__MYSQL2=--with-opt-dir=$(brew --prefix openssl@3):$(brew --prefix zstd)" >> "$GITHUB_ENV" fi + # prism (minitest 6), mysql2 and date compile from source on Windows (~2 min): keep the installed gems, per runner + # image (the native extensions link against its libraries) + - name: Runner image + id: image + run: echo "version=${ImageOS}-${ImageVersion}" >> "$GITHUB_OUTPUT" + + - uses: actions/cache@v6 + with: + path: ${{ env.BUNDLE_PATH }} + key: e2e-gems-${{ steps.image.outputs.version }}-ruby${{ matrix.ruby-version }}-${{ hashFiles('Gemfile.e2e', 'Gemfile.options.e2e') }} + - name: End-to-End tests (SQLite) if: ${{ !cancelled() }} env: diff --git a/.gitignore b/.gitignore index 7f693b4..c1cfd25 100644 --- a/.gitignore +++ b/.gitignore @@ -145,3 +145,4 @@ plugins # scratch output of scripts/tests/run_codegen.rb .codegen-test* .examples-ruby-* +.e2e-gems diff --git a/docs/Testing.md b/docs/Testing.md index 3493e94..a6b0f7a 100644 --- a/docs/Testing.md +++ b/docs/Testing.md @@ -46,7 +46,7 @@ They `require` the generated code from `examples/` and run it against a real dat |---|---|---| | `build.yml` | push to `main`, pull requests (not for Markdown-only changes), release | build `plugin.wasm`; lint; `sqlc diff` with the WASM and the process plugin; Steep; generate with option combinations (Ruby 3.1/3.2/3.3/4.0 × types/Gemfile) and check the output with the matching Ruby | | `tests.yml` | same | unit tests; plugin compatibility on Ruby 3.1 / 3.2 / 3.4 / 4.0; full E2E matrix on Ruby 3.1 / 3.2 / 3.3 / 3.4 / 4.0; Ruby 4.0 module-name variants for MySQL and SQLite and module-name + no-prepared-statements variant for PostgreSQL; PostgreSQL 16.2, MySQL 8.3.0, and SQLite; generator-options E2E on Ruby 3.1 / 4.0 | -| `cross-platform.yml` | called by `build.yml` after `build-wasm` | macOS and Windows × Ruby 3.1 / 4.0 (oldest and newest supported): unit + golden tests; `sqlc diff` with the Linux-built `plugin.wasm` and with the process plugin (`exe\plugin.cmd` on Windows); WASM codegen check; full E2E for SQLite, PostgreSQL (16 on macOS, 17 on Windows) and MySQL 8.4, installed natively (`ankane/setup-postgres`, `ankane/setup-mysql`, the image's MySQL on Windows), using the generated Gemfiles; generator-options E2E | +| `cross-platform.yml` | called by `build.yml` after `build-wasm` | macOS and Windows × Ruby 3.1 / 4.0 (oldest and newest supported), as two parallel jobs each. *Codegen*: unit + golden tests; `sqlc diff` with the Linux-built `plugin.wasm` and with the process plugin (`exe\plugin.cmd` on Windows); WASM codegen check. *End-to-End*: full E2E for SQLite, PostgreSQL (16 on macOS, 17 on Windows) and MySQL 8.4, installed natively (`ankane/setup-postgres`, `ankane/setup-mysql`, the image's MySQL on Windows), using the generated Gemfiles (installed gems cached per runner image); generator-options E2E | | `docs.yml` | `examples/` change on `main`, manual | regenerates `docs/Examples.md` and opens a PR | | `release.yml` | manual only | see [Releasing](Releasing.md) | From 0fe2254755e1a3cd09b605516eb47235505d1234 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 3 Nov 2026 23:10:41 +0000 Subject: [PATCH 8/8] Cross-platform CI: generator-options E2E keeps the default gem path (nested bundle install on Windows Ruby 3.1) Co-Authored-By: Doron Eli Rachman --- .github/workflows/cross-platform.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cross-platform.yml b/.github/workflows/cross-platform.yml index c5110f0..96d63d1 100644 --- a/.github/workflows/cross-platform.yml +++ b/.github/workflows/cross-platform.yml @@ -171,7 +171,7 @@ jobs: echo "BUNDLE_BUILD__MYSQL2=--with-opt-dir=$(brew --prefix openssl@3):$(brew --prefix zstd)" >> "$GITHUB_ENV" fi - # prism (minitest 6), mysql2 and date compile from source on Windows (~2 min): keep the installed gems, per runner + # prism (minitest 6), mysql2 and date compile from source on Windows (~2 min): keep the installed E2E gems, per runner # image (the native extensions link against its libraries) - name: Runner image id: image @@ -180,7 +180,7 @@ jobs: - uses: actions/cache@v6 with: path: ${{ env.BUNDLE_PATH }} - key: e2e-gems-${{ steps.image.outputs.version }}-ruby${{ matrix.ruby-version }}-${{ hashFiles('Gemfile.e2e', 'Gemfile.options.e2e') }} + key: e2e-gems-${{ steps.image.outputs.version }}-ruby${{ matrix.ruby-version }}-${{ hashFiles('Gemfile.e2e') }} - name: End-to-End tests (SQLite) if: ${{ !cancelled() }} @@ -204,7 +204,11 @@ jobs: if: ${{ !cancelled() }} env: BUNDLE_GEMFILE: ${{ github.workspace }}/Gemfile.options.e2e - run: bundle install && bundle exec ruby tests/end2end_options.rb + # default gem path (only prebuilt gems): with BUNDLE_PATH, the test's nested `bundle install` on Windows Ruby + # 3.1 trips over setup-ruby's newer Bundler next to the default 2.3 one + run: | + unset BUNDLE_PATH + bundle install && bundle exec ruby tests/end2end_options.rb - name: Native extension build logs if: failure()