Skip to content

Commit

Permalink
refactor: extract mini_portile recipe config to dependencies.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
flavorjones committed Sep 30, 2022
1 parent 8ab3ecc commit df549ed
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/gem-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/cache@v3
with:
path: ports/archives
key: ports-archives-tarball-${{hashFiles('ext/sqlite3/extconf.rb')}}
key: ports-archives-tarball-${{hashFiles('ext/sqlite3/extconf.rb','dependencies.yml')}}
- uses: ruby/setup-ruby-pkgs@v1
with:
ruby-version: "3.1"
Expand All @@ -38,7 +38,7 @@ jobs:
- uses: actions/cache@v3
with:
path: ports/archives
key: ports-archives-tarball-${{hashFiles('ext/sqlite3/extconf.rb')}}
key: ports-archives-tarball-${{hashFiles('ext/sqlite3/extconf.rb','dependencies.yml')}}
- uses: ruby/setup-ruby-pkgs@v1
with:
ruby-version: "3.1"
Expand Down Expand Up @@ -158,7 +158,7 @@ jobs:
- uses: actions/cache@v3
with:
path: ports/archives
key: ports-archives-tarball-${{hashFiles('ext/sqlite3/extconf.rb')}}
key: ports-archives-tarball-${{hashFiles('ext/sqlite3/extconf.rb','dependencies.yml')}}
- run: |
docker run --rm -v "$(pwd):/sqlite3" -w /sqlite3 \
larskanis/rake-compiler-dock-mri-${{matrix.plat}}:1.2.1 \
Expand Down
14 changes: 14 additions & 0 deletions dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# TODO: stop using symbols here once we no longer support Ruby 2.7 and can rely on symbolize_names
:sqlite3:
# checksum verified by first checking the published sha3(256) checksum against https://sqlite.org/download.html:
#
# $ sha3sum -a 256 ports/archives/sqlite-autoconf-3390400.tar.gz
# 431328e30d12c551da9ba7ef2122b269076058512014afa799caaf62ca567090 ports/archives/sqlite-autoconf-3390400.tar.gz
#
# $ sha256sum ports/archives/sqlite-autoconf-3390400.tar.gz
# f31d445b48e67e284cf206717cc170ab63cbe4fd7f79a82793b772285e78fdbb ports/archives/sqlite-autoconf-3390400.tar.gz
#
:version: "3.39.4"
:files:
- :url: "https://sqlite.org/2022/sqlite-autoconf-3390400.tar.gz"
:sha256: "f31d445b48e67e284cf206717cc170ab63cbe4fd7f79a82793b772285e78fdbb"
20 changes: 3 additions & 17 deletions ext/sqlite3/extconf.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require "mkmf"
require "mini_portile2"
require "yaml"

module Sqlite3
module ExtConf
Expand Down Expand Up @@ -131,23 +132,8 @@ def sqlite3_config
end

def mini_portile_config
{
sqlite3: {
# checksum verified by first checking the published sha3(256) checksum against https://sqlite.org/download.html:
#
# $ sha3sum -a 256 ports/archives/sqlite-autoconf-3390400.tar.gz
# 431328e30d12c551da9ba7ef2122b269076058512014afa799caaf62ca567090 ports/archives/sqlite-autoconf-3390400.tar.gz
#
# $ sha256sum ports/archives/sqlite-autoconf-3390400.tar.gz
# f31d445b48e67e284cf206717cc170ab63cbe4fd7f79a82793b772285e78fdbb ports/archives/sqlite-autoconf-3390400.tar.gz
#
version: "3.39.4",
files: [{
url: "https://sqlite.org/2022/sqlite-autoconf-3390400.tar.gz",
sha256: "f31d445b48e67e284cf206717cc170ab63cbe4fd7f79a82793b772285e78fdbb",
}],
}
}
# TODO: once Ruby 2.7 is no longer supported, use symbolize_names: true
YAML.load_file(File.join(package_root_dir, "dependencies.yml"))
end

def abort_could_not_find(missing)
Expand Down
1 change: 1 addition & 0 deletions sqlite3.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Gem::Specification.new do |s|
"LICENSE",
"LICENSE-DEPENDENCIES",
"README.md",
"dependencies.yml",
"ext/sqlite3/aggregator.c",
"ext/sqlite3/aggregator.h",
"ext/sqlite3/backup.c",
Expand Down

0 comments on commit df549ed

Please sign in to comment.