diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml new file mode 100644 index 00000000..3a913f3d --- /dev/null +++ b/.github/workflows/upstream.yml @@ -0,0 +1,23 @@ +name: upstream +concurrency: + group: "${{github.workflow}}-${{github.ref}}" + cancel-in-progress: true +on: + workflow_dispatch: + schedule: + - cron: "0 8 * * 1,3,5" # At 08:00 on Monday, Wednesday, and Friday # https://crontab.guru/#0_8_*_*_1,3,5 + +jobs: + sqlite-head: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: | + git clone --depth=1 https://github.com/sqlite/sqlite + git -C sqlite log -n1 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.1" + bundler-cache: true + - run: bundle exec rake compile -- --with-sqlite-source-dir=${GITHUB_WORKSPACE}/sqlite + - run: bundle exec rake test diff --git a/ext/sqlite3/extconf.rb b/ext/sqlite3/extconf.rb index a47849fe..c492d20d 100644 --- a/ext/sqlite3/extconf.rb +++ b/ext/sqlite3/extconf.rb @@ -126,9 +126,13 @@ def configure_extension def minimal_recipe MiniPortile.new(libname, sqlite3_config[:version]).tap do |recipe| - recipe.files = sqlite3_config[:files] - recipe.target = File.join(package_root_dir, "ports") - recipe.patch_files = Dir[File.join(package_root_dir, "patches", "*.patch")].sort + if sqlite_source_dir + recipe.source_directory = sqlite_source_dir + else + recipe.files = sqlite3_config[:files] + recipe.target = File.join(package_root_dir, "ports") + recipe.patch_files = Dir[File.join(package_root_dir, "patches", "*.patch")].sort + end end end @@ -157,6 +161,10 @@ def cross_build? enable_config("cross-build") end + def sqlite_source_dir + arg_config("--with-sqlite-source-dir") + end + def download minimal_recipe.download end @@ -178,6 +186,9 @@ def print_help Use libsqlcipher instead of libsqlite3. (Implies `--enable-system-libraries`.) + --with-sqlite-source-dir=DIRECTORY + (dev only) Build sqlite from the source code in DIRECTORY + --help Display this message.