pg 1.5.3 → 1.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/Gemfile +6 -0
  4. data/History.md +60 -4
  5. data/README.ja.md +54 -30
  6. data/Rakefile +4 -1
  7. data/Rakefile.cross +13 -8
  8. data/certs/kanis@comcard.de.pem +20 -0
  9. data/certs/larskanis-2024.pem +24 -0
  10. data/ext/errorcodes.def +4 -5
  11. data/ext/errorcodes.txt +2 -5
  12. data/ext/extconf.rb +7 -0
  13. data/ext/pg.c +2 -2
  14. data/ext/pg.h +0 -1
  15. data/ext/pg_binary_decoder.c +2 -0
  16. data/ext/pg_binary_encoder.c +1 -1
  17. data/ext/pg_connection.c +60 -21
  18. data/ext/pg_copy_coder.c +17 -13
  19. data/ext/pg_record_coder.c +6 -6
  20. data/ext/pg_result.c +4 -4
  21. data/ext/pg_text_decoder.c +4 -1
  22. data/ext/pg_text_encoder.c +17 -11
  23. data/lib/pg/basic_type_map_for_queries.rb +8 -4
  24. data/lib/pg/basic_type_registry.rb +14 -2
  25. data/lib/pg/connection.rb +58 -38
  26. data/lib/pg/exceptions.rb +6 -0
  27. data/lib/pg/text_decoder/date.rb +3 -0
  28. data/lib/pg/text_decoder/json.rb +3 -0
  29. data/lib/pg/text_encoder/date.rb +1 -0
  30. data/lib/pg/text_encoder/inet.rb +3 -0
  31. data/lib/pg/text_encoder/json.rb +3 -0
  32. data/lib/pg/version.rb +1 -1
  33. data/lib/pg.rb +10 -0
  34. data/pg.gemspec +3 -1
  35. data.tar.gz.sig +0 -0
  36. metadata +17 -34
  37. metadata.gz.sig +0 -0
  38. data/.appveyor.yml +0 -42
  39. data/.gems +0 -6
  40. data/.gemtest +0 -0
  41. data/.github/workflows/binary-gems.yml +0 -117
  42. data/.github/workflows/source-gem.yml +0 -137
  43. data/.gitignore +0 -22
  44. data/.hgsigs +0 -34
  45. data/.hgtags +0 -41
  46. data/.irbrc +0 -23
  47. data/.pryrc +0 -23
  48. data/.tm_properties +0 -21
  49. data/.travis.yml +0 -49
  50. data/translation/.po4a-version +0 -7
  51. data/translation/po/all.pot +0 -910
  52. data/translation/po/ja.po +0 -1047
  53. data/translation/po4a.cfg +0 -12
data/lib/pg/connection.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'pg' unless defined?( PG )
5
- require 'io/wait' unless ::IO.public_instance_methods(false).include?(:wait_readable)
5
+ require 'io/wait' unless ::IO.public_instance_methods(false).include?(:wait_readable) # for ruby < 3.0
6
6
  require 'socket'
7
7
 
8
8
  # The PostgreSQL connection class. The interface for this class is based on
@@ -117,7 +117,7 @@ class PG::Connection
117
117
  return str
118
118
  end
119
119
 
120
- BinarySignature = "PGCOPY\n\377\r\n\0".b
120
+ BinarySignature = "PGCOPY\n\377\r\n\0"
121
121
  private_constant :BinarySignature
122
122
 
123
123
  # call-seq:
@@ -166,7 +166,10 @@ class PG::Connection
166
166
  # conn.put_copy_data ['more', 'data', 'to', 'copy']
167
167
  # end
168
168
  #
169
- # Also PG::BinaryEncoder::CopyRow can be used to send data in binary format to the server.
169
+ # All 4 CopyRow classes can take a type map to specify how the columns are mapped to and from the database format.
170
+ # For details see the particular CopyRow class description.
171
+ #
172
+ # PG::BinaryEncoder::CopyRow can be used to send data in binary format to the server.
170
173
  # In this case copy_data generates the header and trailer data automatically:
171
174
  # enco = PG::BinaryEncoder::CopyRow.new
172
175
  # conn.copy_data "COPY my_table FROM STDIN (FORMAT binary)", enco do
@@ -306,6 +309,11 @@ class PG::Connection
306
309
  rollback = false
307
310
  exec "BEGIN"
308
311
  yield(self)
312
+ rescue PG::RollbackTransaction
313
+ rollback = true
314
+ cancel if transaction_status == PG::PQTRANS_ACTIVE
315
+ block
316
+ exec "ROLLBACK"
309
317
  rescue Exception
310
318
  rollback = true
311
319
  cancel if transaction_status == PG::PQTRANS_ACTIVE
@@ -493,7 +501,7 @@ class PG::Connection
493
501
  # See also #copy_data.
494
502
  #
495
503
  def put_copy_data(buffer, encoder=nil)
496
- # sync_put_copy_data does a non-blocking attept to flush data.
504
+ # sync_put_copy_data does a non-blocking attempt to flush data.
497
505
  until res=sync_put_copy_data(buffer, encoder)
498
506
  # It didn't flush immediately and allocation of more buffering memory failed.
499
507
  # Wait for all data sent by doing a blocking flush.
@@ -565,7 +573,14 @@ class PG::Connection
565
573
  # Resets the backend connection. This method closes the
566
574
  # backend connection and tries to re-connect.
567
575
  def reset
568
- reset_start
576
+ # Use connection options from PG::Connection.new to reconnect with the same options but with renewed DNS resolution.
577
+ # Use conninfo_hash as a fallback when connect_start was used to create the connection object.
578
+ iopts = @iopts_for_reset || conninfo_hash.compact
579
+ if iopts[:host] && !iopts[:host].empty? && PG.library_version >= 100000
580
+ iopts = self.class.send(:resolve_hosts, iopts)
581
+ end
582
+ conninfo = self.class.parse_connect_args( iopts );
583
+ reset_start2(conninfo)
569
584
  async_connect_or_reset(:reset_poll)
570
585
  self
571
586
  end
@@ -638,8 +653,6 @@ class PG::Connection
638
653
  # Track the progress of the connection, waiting for the socket to become readable/writable before polling it
639
654
 
640
655
  if (timeo = conninfo_hash[:connect_timeout].to_i) && timeo > 0
641
- # Lowest timeout is 2 seconds - like in libpq
642
- timeo = [timeo, 2].max
643
656
  host_count = conninfo_hash[:host].to_s.count(",") + 1
644
657
  stop_time = timeo * host_count + Process.clock_gettime(Process::CLOCK_MONOTONIC)
645
658
  end
@@ -773,46 +786,51 @@ class PG::Connection
773
786
  alias setdb new
774
787
  alias setdblogin new
775
788
 
789
+ # Resolve DNS in Ruby to avoid blocking state while connecting.
790
+ # Multiple comma-separated values are generated, if the hostname resolves to both IPv4 and IPv6 addresses.
791
+ # This requires PostgreSQL-10+, so no DNS resolving is done on earlier versions.
792
+ private def resolve_hosts(iopts)
793
+ ihosts = iopts[:host].split(",", -1)
794
+ iports = iopts[:port].split(",", -1)
795
+ iports = [nil] if iports.size == 0
796
+ iports = iports * ihosts.size if iports.size == 1
797
+ raise PG::ConnectionBad, "could not match #{iports.size} port numbers to #{ihosts.size} hosts" if iports.size != ihosts.size
798
+
799
+ dests = ihosts.each_with_index.flat_map do |mhost, idx|
800
+ unless host_is_named_pipe?(mhost)
801
+ if Fiber.respond_to?(:scheduler) &&
802
+ Fiber.scheduler &&
803
+ RUBY_VERSION < '3.1.'
804
+
805
+ # Use a second thread to avoid blocking of the scheduler.
806
+ # `TCPSocket.gethostbyname` isn't fiber aware before ruby-3.1.
807
+ hostaddrs = Thread.new{ Addrinfo.getaddrinfo(mhost, nil, nil, :STREAM).map(&:ip_address) rescue [''] }.value
808
+ else
809
+ hostaddrs = Addrinfo.getaddrinfo(mhost, nil, nil, :STREAM).map(&:ip_address) rescue ['']
810
+ end
811
+ else
812
+ # No hostname to resolve (UnixSocket)
813
+ hostaddrs = [nil]
814
+ end
815
+ hostaddrs.map { |hostaddr| [hostaddr, mhost, iports[idx]] }
816
+ end
817
+ iopts.merge(
818
+ hostaddr: dests.map{|d| d[0] }.join(","),
819
+ host: dests.map{|d| d[1] }.join(","),
820
+ port: dests.map{|d| d[2] }.join(","))
821
+ end
822
+
776
823
  private def connect_to_hosts(*args)
777
824
  option_string = parse_connect_args(*args)
778
825
  iopts = PG::Connection.conninfo_parse(option_string).each_with_object({}){|h, o| o[h[:keyword].to_sym] = h[:val] if h[:val] }
779
826
  iopts = PG::Connection.conndefaults.each_with_object({}){|h, o| o[h[:keyword].to_sym] = h[:val] if h[:val] }.merge(iopts)
780
827
 
828
+ iopts_for_reset = iopts
781
829
  if iopts[:hostaddr]
782
830
  # hostaddr is provided -> no need to resolve hostnames
783
831
 
784
832
  elsif iopts[:host] && !iopts[:host].empty? && PG.library_version >= 100000
785
- # Resolve DNS in Ruby to avoid blocking state while connecting.
786
- # Multiple comma-separated values are generated, if the hostname resolves to both IPv4 and IPv6 addresses.
787
- # This requires PostgreSQL-10+, so no DNS resolving is done on earlier versions.
788
- ihosts = iopts[:host].split(",", -1)
789
- iports = iopts[:port].split(",", -1)
790
- iports = [nil] if iports.size == 0
791
- iports = iports * ihosts.size if iports.size == 1
792
- raise PG::ConnectionBad, "could not match #{iports.size} port numbers to #{ihosts.size} hosts" if iports.size != ihosts.size
793
-
794
- dests = ihosts.each_with_index.flat_map do |mhost, idx|
795
- unless host_is_named_pipe?(mhost)
796
- if Fiber.respond_to?(:scheduler) &&
797
- Fiber.scheduler &&
798
- RUBY_VERSION < '3.1.'
799
-
800
- # Use a second thread to avoid blocking of the scheduler.
801
- # `TCPSocket.gethostbyname` isn't fiber aware before ruby-3.1.
802
- hostaddrs = Thread.new{ Addrinfo.getaddrinfo(mhost, nil, nil, :STREAM).map(&:ip_address) rescue [''] }.value
803
- else
804
- hostaddrs = Addrinfo.getaddrinfo(mhost, nil, nil, :STREAM).map(&:ip_address) rescue ['']
805
- end
806
- else
807
- # No hostname to resolve (UnixSocket)
808
- hostaddrs = [nil]
809
- end
810
- hostaddrs.map { |hostaddr| [hostaddr, mhost, iports[idx]] }
811
- end
812
- iopts.merge!(
813
- hostaddr: dests.map{|d| d[0] }.join(","),
814
- host: dests.map{|d| d[1] }.join(","),
815
- port: dests.map{|d| d[2] }.join(","))
833
+ iopts = resolve_hosts(iopts)
816
834
  else
817
835
  # No host given
818
836
  end
@@ -821,6 +839,8 @@ class PG::Connection
821
839
 
822
840
  raise PG::ConnectionBad, conn.error_message if conn.status == PG::CONNECTION_BAD
823
841
 
842
+ # save the connection options for conn.reset
843
+ conn.instance_variable_set(:@iopts_for_reset, iopts_for_reset)
824
844
  conn.send(:async_connect_or_reset, :connect_poll)
825
845
  conn
826
846
  end
data/lib/pg/exceptions.rb CHANGED
@@ -21,5 +21,11 @@ module PG
21
21
  class NotInBlockingMode < PG::Error
22
22
  end
23
23
 
24
+ # PG::Connection#transaction uses this exception to distinguish a deliberate rollback from other exceptional situations.
25
+ # Normally, raising an exception will cause the .transaction method to rollback the database transaction and pass on the exception.
26
+ # But if you raise an PG::RollbackTransaction exception, then the database transaction will be rolled back, without passing on the exception.
27
+ class RollbackTransaction < StandardError
28
+ end
29
+
24
30
  end # module PG
25
31
 
@@ -5,6 +5,9 @@ require 'date'
5
5
 
6
6
  module PG
7
7
  module TextDecoder
8
+ # This is a decoder class for conversion of PostgreSQL date type to Ruby Date values.
9
+ #
10
+ # As soon as this class is used, it requires the ruby standard library 'date'.
8
11
  class Date < SimpleDecoder
9
12
  def decode(string, tuple=nil, field=nil)
10
13
  if string =~ /\A(\d{4})-(\d\d)-(\d\d)\z/
@@ -5,6 +5,9 @@ require 'json'
5
5
 
6
6
  module PG
7
7
  module TextDecoder
8
+ # This is a decoder class for conversion of PostgreSQL JSON/JSONB type to Ruby Hash, Array, String, Numeric, nil values.
9
+ #
10
+ # As soon as this class is used, it requires the ruby standard library 'json'.
8
11
  class JSON < SimpleDecoder
9
12
  def decode(string, tuple=nil, field=nil)
10
13
  ::JSON.parse(string, quirks_mode: true)
@@ -3,6 +3,7 @@
3
3
 
4
4
  module PG
5
5
  module TextEncoder
6
+ # This is a encoder class for conversion of Ruby Date values to PostgreSQL date type.
6
7
  class Date < SimpleEncoder
7
8
  def encode(value)
8
9
  value.respond_to?(:strftime) ? value.strftime("%Y-%m-%d") : value
@@ -5,6 +5,9 @@ require 'ipaddr'
5
5
 
6
6
  module PG
7
7
  module TextEncoder
8
+ # This is a encoder class for conversion of Ruby IPAddr values to PostgreSQL inet type.
9
+ #
10
+ # As soon as this class is used, it requires the ruby standard library 'ipaddr'.
8
11
  class Inet < SimpleEncoder
9
12
  def encode(value)
10
13
  case value
@@ -5,6 +5,9 @@ require 'json'
5
5
 
6
6
  module PG
7
7
  module TextEncoder
8
+ # This is a encoder class for conversion of Ruby Hash, Array, String, Numeric, nil values to PostgreSQL JSON/JSONB type.
9
+ #
10
+ # As soon as this class is used, it requires the ruby standard library 'json'.
8
11
  class JSON < SimpleEncoder
9
12
  def encode(value)
10
13
  ::JSON.generate(value, quirks_mode: true)
data/lib/pg/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module PG
2
2
  # Library version
3
- VERSION = '1.5.3'
3
+ VERSION = '1.5.9'
4
4
  end
data/lib/pg.rb CHANGED
@@ -126,4 +126,14 @@ module PG
126
126
  Warning.extend(TruffleFixWarn)
127
127
  end
128
128
 
129
+ # Ruby-3.4+ prints a warning, if bigdecimal is required but not in the Gemfile.
130
+ # But it's a false positive, since we enable bigdecimal depending features only if it's available.
131
+ # And most people don't need these features.
132
+ def self.require_bigdecimal_without_warning
133
+ oldverb, $VERBOSE = $VERBOSE, nil
134
+ require "bigdecimal"
135
+ ensure
136
+ $VERBOSE = oldverb
137
+ end
138
+
129
139
  end # module PG
data/pg.gemspec CHANGED
@@ -23,7 +23,9 @@ Gem::Specification.new do |spec|
23
23
  # Specify which files should be added to the gem when it is released.
24
24
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
25
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
26
+ `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{\A(?:test|spec|features|translation|\.)})
28
+ end
27
29
  end
28
30
  spec.extensions = ["ext/extconf.rb"]
29
31
  spec.require_paths = ["lib"]
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,19 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.3
4
+ version: 1.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Granger
8
8
  - Lars Kanis
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain:
12
11
  - |
13
12
  -----BEGIN CERTIFICATE-----
14
- MIIEBDCCAmygAwIBAgIBAjANBgkqhkiG9w0BAQsFADAoMSYwJAYDVQQDDB1sYXJz
15
- L0RDPWdyZWl6LXJlaW5zZG9yZi9EQz1kZTAeFw0yMzAyMTUxNzQxMTVaFw0yNDAy
16
- MTUxNzQxMTVaMCgxJjAkBgNVBAMMHWxhcnMvREM9Z3JlaXotcmVpbnNkb3JmL0RD
13
+ MIIEBDCCAmygAwIBAgIBAzANBgkqhkiG9w0BAQsFADAoMSYwJAYDVQQDDB1sYXJz
14
+ L0RDPWdyZWl6LXJlaW5zZG9yZi9EQz1kZTAeFw0yNDAyMjgxOTMxNDdaFw0yNTAy
15
+ MjcxOTMxNDdaMCgxJjAkBgNVBAMMHWxhcnMvREM9Z3JlaXotcmVpbnNkb3JmL0RD
17
16
  PWRlMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAwum6Y1KznfpzXOT/
18
17
  mZgJTBbxZuuZF49Fq3K0WA67YBzNlDv95qzSp7V/7Ek3NCcnT7G+2kSuhNo1FhdN
19
18
  eSDO/moYebZNAcu3iqLsuzuULXPLuoU0GsMnVMqV9DZPh7cQHE5EBZ7hlzDBK7k/
@@ -24,17 +23,17 @@ cert_chain:
24
23
  chQPnWX+N3Gj+jjYxqTFdwT7Mj3pv1VHa+aNUbqSPpvJeDyxRIuo9hvzDaBHb/Cg
25
24
  9qRVcm8a96n4t7y2lrX1oookY6bkBaxWOMtWlqIprq8JZXM9AgMBAAGjOTA3MAkG
26
25
  A1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBQ4h1tIyvdUWtMI739xMzTR
27
- 7EfMFzANBgkqhkiG9w0BAQsFAAOCAYEAQAcuTARfiiVUVx5KURICfdTM2Kd7LhOn
28
- qt3Vs4ANGvT226LEp3RnQ+kWGQYMRb3cw3LY2TNQRPlnZxE994mgjBscN4fbjXqO
29
- T0JbVpeszRZa5k1goggbnWT7CO7yU7WcHh13DaSubY7HUpAJn2xz9w2stxQfN/EE
30
- VMlnDJ1P7mUHAvpK8X9j9h7Xlc1niViT18MYwux8mboVTryrLr+clATUkkM3yBF0
31
- RV+c34ReW5eXO9Tr6aKTxh/pFC9ggDT6jOxuJgSvG8HWJzVf4NDvMavIas4KYjiI
32
- BU6CpWaG5NxicqL3BERi52U43HV08br+LNVpb7Rekgve/PJuSFnAR015bhSRXe5U
33
- vBioD1qW2ZW9tXg8Ww2IfDaO5a1So5Xby51rhNlyo6ATj2NkuLWZUKPKHhAz0TKm
34
- Dzx/gFSOrRoCt2mXNgrmcAfr386AfaMvCh7cXqdxZwmVo7ILZCYXck0pajvubsDd
35
- NUIIFkVXvd1odFyK9LF1RFAtxn/iAmpx
26
+ 7EfMFzANBgkqhkiG9w0BAQsFAAOCAYEArBmHSfnUyNWf3R1Fx0mMHloWGdcKn2D2
27
+ BsqTApXU2nADiyppIqRq4b9e7hw342uzadSLkoQcEFOxThLRhAcijoWfQVBcsbV/
28
+ ZsCY1qlUTIJuSWxaSyS4efUX+N4eMNyPM9oW/sphlWFo0DgI34Y9WB6HDzH+O71y
29
+ R7PARke3f4kYnRJf5yRQLPDrH9UYt9KlBQm6l7XMtr5EMnQt0EfcmZEi9H4t/vS2
30
+ haxvpFMdAKo4H46GBYNO96r6b74t++vgQSBTg/AFVwvRZwNSrPPcBfb4xxeEAhRR
31
+ x+LU7feIH7lZ//3buiyD03gLAEtHXai0Y+/VfuWIpwYJAl2BO/tU7FS/dtbJq9oc
32
+ dI36Yyzy+BrCM0WT4oCsagePNb97FaNhl4F6sM5JEPT0ZPxRx0i3G4TNNIYziVos
33
+ 5wFER6XhvvLDFAMh/jMg+s7Wd5SbSHgHNSUaUGVtdWkVPOer6oF0aLdZUR3CETkn
34
+ 5nWXZma/BUd3YgYA/Xumc6QQqIS4p7mr
36
35
  -----END CERTIFICATE-----
37
- date: 2023-04-28 00:00:00.000000000 Z
36
+ date: 2024-10-24 00:00:00.000000000 Z
38
37
  dependencies: []
39
38
  description: Pg is the Ruby interface to the PostgreSQL RDBMS. It works with PostgreSQL
40
39
  9.3 and later.
@@ -101,18 +100,6 @@ extra_rdoc_files:
101
100
  - lib/pg/type_map_by_column.rb
102
101
  - lib/pg/version.rb
103
102
  files:
104
- - ".appveyor.yml"
105
- - ".gems"
106
- - ".gemtest"
107
- - ".github/workflows/binary-gems.yml"
108
- - ".github/workflows/source-gem.yml"
109
- - ".gitignore"
110
- - ".hgsigs"
111
- - ".hgtags"
112
- - ".irbrc"
113
- - ".pryrc"
114
- - ".tm_properties"
115
- - ".travis.yml"
116
103
  - BSDL
117
104
  - Contributors.rdoc
118
105
  - Gemfile
@@ -127,8 +114,10 @@ files:
127
114
  - Rakefile
128
115
  - Rakefile.cross
129
116
  - certs/ged.pem
117
+ - certs/kanis@comcard.de.pem
130
118
  - certs/larskanis-2022.pem
131
119
  - certs/larskanis-2023.pem
120
+ - certs/larskanis-2024.pem
132
121
  - ext/errorcodes.def
133
122
  - ext/errorcodes.rb
134
123
  - ext/errorcodes.txt
@@ -217,10 +206,6 @@ files:
217
206
  - sample/test_binary_values.rb
218
207
  - sample/wal_shipper.rb
219
208
  - sample/warehouse_partitions.rb
220
- - translation/.po4a-version
221
- - translation/po/all.pot
222
- - translation/po/ja.po
223
- - translation/po4a.cfg
224
209
  homepage: https://github.com/ged/ruby-pg
225
210
  licenses:
226
211
  - BSD-2-Clause
@@ -229,7 +214,6 @@ metadata:
229
214
  source_code_uri: https://github.com/ged/ruby-pg
230
215
  changelog_uri: https://github.com/ged/ruby-pg/blob/master/History.md
231
216
  documentation_uri: http://deveiate.org/code/pg
232
- post_install_message:
233
217
  rdoc_options:
234
218
  - "--main"
235
219
  - README.md
@@ -248,8 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
232
  - !ruby/object:Gem::Version
249
233
  version: '0'
250
234
  requirements: []
251
- rubygems_version: 3.4.6
252
- signing_key:
235
+ rubygems_version: 3.6.0.dev
253
236
  specification_version: 4
254
237
  summary: Pg is the Ruby interface to the PostgreSQL RDBMS
255
238
  test_files: []
metadata.gz.sig CHANGED
Binary file
data/.appveyor.yml DELETED
@@ -1,42 +0,0 @@
1
- image: Visual Studio 2022
2
-
3
- init:
4
- - set PATH=C:/Ruby%ruby_version%/bin;c:/Program Files/Git/cmd;c:/Windows/system32;C:/Windows/System32/WindowsPowerShell/v1.0;C:/Program Files/Mercurial
5
- - set RUBYOPT=--verbose
6
- install:
7
- - ps: |
8
- if ($env:RUBYDOWNLOAD -ne $null) {
9
- $(new-object net.webclient).DownloadFile("https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-$env:RUBYDOWNLOAD.exe", "$pwd/ruby-setup.exe")
10
- cmd /c ruby-setup.exe /currentuser /verysilent /dir=C:/Ruby$env:ruby_version
11
- }
12
- - cmd: |
13
- ridk enable
14
- c:/msys64/usr/bin/bash -lc "pacman -S --noconfirm --needed ${MINGW_PACKAGE_PREFIX}-pkgconf ${MINGW_PACKAGE_PREFIX}-libyaml ${MINGW_PACKAGE_PREFIX}-gcc"
15
- - ruby --version
16
- - gem --version
17
- - gem install bundler --conservative
18
- - bundle install
19
- - ps: |
20
- if ($env:PGVERSION -ne $null)
21
- {
22
- $(new-object net.webclient).DownloadFile('http://get.enterprisedb.com/postgresql/postgresql-' + $env:PGVERSION + '.exe', 'C:/postgresql-setup.exe')
23
- cmd /c "C:/postgresql-setup.exe" --mode unattended --extract-only 1
24
-
25
- $env:PATH = 'C:/Program Files/PostgreSQL/' + $env:PGVER + '/bin;' + $env:PATH
26
- $env:PATH = 'C:/Program Files (x86)/PostgreSQL/' + $env:PGVER + '/bin;' + $env:PATH
27
- } else {
28
- c:/msys64/usr/bin/bash -lc "pacman -S --noconfirm --needed `${MINGW_PACKAGE_PREFIX}-postgresql"
29
- }
30
- - echo %PATH%
31
- - pg_config
32
- build_script:
33
- - bundle exec rake -rdevkit compile --trace
34
- test_script:
35
- - bundle exec rake test PG_DEBUG=0
36
- on_failure:
37
- - find -name mkmf.log | xargs cat
38
- environment:
39
- matrix:
40
- - ruby_version: "head"
41
- RUBYDOWNLOAD: x86
42
- - ruby_version: "30-x64"
data/.gems DELETED
@@ -1,6 +0,0 @@
1
- # .gems generated gem export file. Note that any env variable settings will be missing. Append these after using a ';' field separator
2
- rake-compiler -v1.1.0
3
- rake-compiler-dock -v1.0.0
4
- hoe-deveiate -v0.10.0
5
- hoe-bundler -v1.3.0
6
-
data/.gemtest DELETED
File without changes
@@ -1,117 +0,0 @@
1
- name: Binary gems
2
-
3
- on:
4
- push:
5
- pull_request:
6
- workflow_dispatch:
7
- schedule:
8
- - cron: "0 5 * * 3" # At 05:00 on Wednesday # https://crontab.guru/#0_5_*_*_3
9
-
10
- jobs:
11
- job_build_x64:
12
- name: build
13
- runs-on: ubuntu-latest
14
- strategy:
15
- fail-fast: false
16
- matrix:
17
- include:
18
- - platform: "x64-mingw-ucrt"
19
- - platform: "x64-mingw32"
20
- - platform: "x86-mingw32"
21
- steps:
22
- - uses: actions/checkout@v3
23
- - name: Set up Ruby
24
- uses: ruby/setup-ruby@v1
25
- with:
26
- ruby-version: "3.2"
27
- - run: bundle install
28
-
29
- - name: Create a dummy cert to satisfy the build
30
- run: |
31
- mkdir -p ~/.gem/
32
- ruby -ropenssl -e "puts OpenSSL::PKey::RSA.new(2048).to_pem" > ~/.gem/gem-private_key.pem
33
- gem cert --build travis-ci@dummy.org --private-key ~/.gem/gem-private_key.pem
34
- cp gem-public_cert.pem ~/.gem/gem-public_cert.pem
35
-
36
- - name: Build binary gem
37
- run: bundle exec rake gem:windows:${{ matrix.platform }}
38
-
39
- - name: Upload binary gem
40
- uses: actions/upload-artifact@v3
41
- with:
42
- name: binary-gem
43
- path: pkg/*.gem
44
-
45
- job_test_binary:
46
- name: Test on Windows
47
- needs: job_build_x64
48
- strategy:
49
- fail-fast: false
50
- matrix:
51
- include:
52
- - os: windows-latest
53
- ruby: "3.2"
54
- platform: "x64-mingw-ucrt"
55
- PGVERSION: 15.1-1-windows-x64
56
- - os: windows-latest
57
- ruby: "3.1.3-1"
58
- platform: "x86-mingw32"
59
- PGVERSION: 10.20-1-windows
60
- - os: windows-latest
61
- ruby: "2.5"
62
- platform: "x64-mingw32"
63
- PGVERSION: 10.20-1-windows
64
-
65
- runs-on: ${{ matrix.os }}
66
- env:
67
- PGVERSION: ${{ matrix.PGVERSION }}
68
- steps:
69
- - uses: actions/checkout@v3
70
- - name: Set up Ruby
71
- if: matrix.platform != 'x86-mingw32'
72
- uses: ruby/setup-ruby@v1
73
- with:
74
- ruby-version: ${{ matrix.ruby }}
75
-
76
- - name: Set up 32 bit x86 Ruby
77
- if: matrix.platform == 'x86-mingw32'
78
- run: |
79
- $(new-object net.webclient).DownloadFile("https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-${{ matrix.ruby }}/rubyinstaller-${{ matrix.ruby }}-x86.exe", "$pwd/ruby-setup.exe")
80
- cmd /c ruby-setup.exe /currentuser /verysilent /dir=C:/Ruby-${{ matrix.ruby }}
81
- echo "c:/ruby-${{ matrix.ruby }}/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
82
-
83
- c:/ruby-${{ matrix.ruby }}/bin/ridk enable
84
- c:/msys64/usr/bin/bash -lc "pacman -S --noconfirm --needed make `${MINGW_PACKAGE_PREFIX}-pkgconf `${MINGW_PACKAGE_PREFIX}-libyaml `${MINGW_PACKAGE_PREFIX}-gcc `${MINGW_PACKAGE_PREFIX}-make"
85
- echo "C:/msys64/$env:MSYSTEM_PREFIX/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
86
-
87
- - name: Download gem from build job
88
- uses: actions/download-artifact@v3
89
- with:
90
- name: binary-gem
91
-
92
- - name: Download PostgreSQL
93
- run: |
94
- Add-Type -AssemblyName System.IO.Compression.FileSystem
95
- function Unzip {
96
- param([string]$zipfile, [string]$outpath)
97
- [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
98
- }
99
-
100
- $(new-object net.webclient).DownloadFile("http://get.enterprisedb.com/postgresql/postgresql-$env:PGVERSION-binaries.zip", "postgresql-binaries.zip")
101
- Unzip "postgresql-binaries.zip" "."
102
- echo "$pwd/pgsql/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
103
- echo "PGUSER=$env:USERNAME" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
104
- echo "PGPASSWORD=" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
105
-
106
- - run: echo $env:PATH
107
- - run: gem update --system 3.3.26
108
- - run: bundle install
109
- - run: gem install --local pg-*${{ matrix.platform }}.gem --verbose
110
- - name: Run specs
111
- run: ruby -rpg -S rspec -fd spec/**/*_spec.rb
112
-
113
- - name: Print logs if job failed
114
- if: ${{ failure() && matrix.os == 'windows-latest' }}
115
- run: |
116
- ridk enable
117
- find "$(ruby -e"puts RbConfig::CONFIG[%q[libdir]]")" -name mkmf.log -print0 | xargs -0 cat