pgtk 0.18.1 → 0.19.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 82c748e501e64031a5809d1bf9de16e1a84c34355e900d7402d6f1e0041f958a
4
- data.tar.gz: 493f523e2c414d38448b8d64d1a3b32a22c1fb8aed1f502955759907747b1091
3
+ metadata.gz: 1cab54d9805f427ff6187a6cdec4fa2cd5424a0c4959191169e674eb2400a09a
4
+ data.tar.gz: 2d584fffabf7b943fc087d9bad1edb68296826b5b987e34725d5a252503f9f46
5
5
  SHA512:
6
- metadata.gz: 41553fc9dc6f702ff4c04ce2165077dd172afc76d585b72957321daa7a9608082705d86e48393d469f58c87d92a92dbd36e915d088e73ea68d7530c9090c5053
7
- data.tar.gz: 7d064ca8fa4c3ab44d7b536a5eb63284badc44b7643da8451be5839e0fa5fe791254b0a9f119a69e3456cf7038d14b732870725eed658cb64c061b3ff9a3990c
6
+ metadata.gz: 6f3b1bd6f15acd85f50194b1aa9653f1b892b0dea6501dcacaa1c2cc38ccd3f609331fa3cccc7a3c79f86285861b28e77e87d6c84d4f7f9b81f272e938fed216
7
+ data.tar.gz: d583bfab4f9647f08235891899ab938dd4d778d49115c6a4bee4a72298810364fd419cdb271e145610001e8742f432ade4a6ed212b7bc74c62ce89caf0cc8f27
data/Gemfile CHANGED
@@ -15,7 +15,7 @@ gem 'rubocop-minitest', '~>0.38', require: false
15
15
  gem 'rubocop-performance', '~>1.25', require: false
16
16
  gem 'rubocop-rake', '~>0.7', require: false
17
17
  gem 'simplecov', '~>0.22', require: false
18
- gem 'simplecov-cobertura', '~>2.1'
18
+ gem 'simplecov-cobertura', '~>3.0'
19
19
  gem 'timeout', '~>0.4'
20
20
  gem 'xcop', '~>0.8', require: false
21
21
  gem 'yard', '~>0.9', require: false
data/Gemfile.lock CHANGED
@@ -22,49 +22,50 @@ GEM
22
22
  concurrent-ruby (1.3.5)
23
23
  differ (0.1.2)
24
24
  docile (1.4.1)
25
- elapsed (0.1.0)
26
- loog (> 0)
27
- tago (> 0)
28
- joined (0.3.0)
29
- json (2.12.2)
25
+ elapsed (0.2.0)
26
+ loog (~> 0.6)
27
+ tago (~> 0.1)
28
+ joined (0.4.0)
29
+ json (2.15.2)
30
30
  language_server-protocol (3.17.0.5)
31
31
  lint_roller (1.1.0)
32
32
  logger (1.7.0)
33
33
  loog (0.6.1)
34
34
  logger (~> 1.0)
35
- minitest (5.25.5)
35
+ minitest (5.26.0)
36
36
  minitest-reporters (1.7.1)
37
37
  ansi
38
38
  builder
39
39
  minitest (>= 5.0)
40
40
  ruby-progressbar
41
- nokogiri (1.18.8-arm64-darwin)
41
+ nokogiri (1.18.10-arm64-darwin)
42
42
  racc (~> 1.4)
43
- nokogiri (1.18.8-x64-mingw-ucrt)
43
+ nokogiri (1.18.10-x64-mingw-ucrt)
44
44
  racc (~> 1.4)
45
- nokogiri (1.18.8-x86_64-linux-gnu)
45
+ nokogiri (1.18.10-x86_64-linux-gnu)
46
46
  racc (~> 1.4)
47
47
  parallel (1.27.0)
48
- parser (3.3.8.0)
48
+ parser (3.3.10.0)
49
49
  ast (~> 2.4.1)
50
50
  racc
51
- pg (1.5.9)
52
- pg (1.5.9-x64-mingw-ucrt)
53
- prism (1.4.0)
51
+ pg (1.6.2-arm64-darwin)
52
+ pg (1.6.2-x64-mingw-ucrt)
53
+ pg (1.6.2-x86_64-linux)
54
+ prism (1.6.0)
54
55
  qbash (0.4.5)
55
56
  backtrace (> 0)
56
57
  elapsed (> 0)
57
58
  loog (> 0)
58
59
  tago (> 0)
59
60
  racc (1.8.1)
60
- rack (3.1.16)
61
+ rack (3.2.3)
61
62
  rainbow (3.1.1)
62
- rake (13.3.0)
63
- random-port (0.7.5)
64
- tago (> 0)
65
- regexp_parser (2.10.0)
66
- rexml (3.4.1)
67
- rubocop (1.77.0)
63
+ rake (13.3.1)
64
+ random-port (0.7.6)
65
+ tago (~> 0.0)
66
+ regexp_parser (2.11.3)
67
+ rexml (3.4.4)
68
+ rubocop (1.81.7)
68
69
  json (~> 2.3)
69
70
  language_server-protocol (~> 3.17.0.2)
70
71
  lint_roller (~> 1.1.0)
@@ -72,20 +73,20 @@ GEM
72
73
  parser (>= 3.3.0.2)
73
74
  rainbow (>= 2.2.2, < 4.0)
74
75
  regexp_parser (>= 2.9.3, < 3.0)
75
- rubocop-ast (>= 1.45.1, < 2.0)
76
+ rubocop-ast (>= 1.47.1, < 2.0)
76
77
  ruby-progressbar (~> 1.7)
77
78
  unicode-display_width (>= 2.4.0, < 4.0)
78
- rubocop-ast (1.45.1)
79
+ rubocop-ast (1.47.1)
79
80
  parser (>= 3.3.7.2)
80
81
  prism (~> 1.4)
81
- rubocop-minitest (0.38.1)
82
+ rubocop-minitest (0.38.2)
82
83
  lint_roller (~> 1.1)
83
84
  rubocop (>= 1.75.0, < 2.0)
84
85
  rubocop-ast (>= 1.38.0, < 2.0)
85
- rubocop-performance (1.25.0)
86
+ rubocop-performance (1.26.1)
86
87
  lint_roller (~> 1.1)
87
88
  rubocop (>= 1.75.0, < 2.0)
88
- rubocop-ast (>= 1.38.0, < 2.0)
89
+ rubocop-ast (>= 1.47.1, < 2.0)
89
90
  rubocop-rake (0.7.1)
90
91
  lint_roller (~> 1.1)
91
92
  rubocop (>= 1.72.1)
@@ -94,17 +95,17 @@ GEM
94
95
  docile (~> 1.1)
95
96
  simplecov-html (~> 0.11)
96
97
  simplecov_json_formatter (~> 0.1)
97
- simplecov-cobertura (2.1.0)
98
+ simplecov-cobertura (3.1.0)
98
99
  rexml
99
100
  simplecov (~> 0.19)
100
- simplecov-html (0.13.1)
101
+ simplecov-html (0.13.2)
101
102
  simplecov_json_formatter (0.1.4)
102
103
  slop (4.10.1)
103
- tago (0.1.0)
104
- timeout (0.4.3)
105
- unicode-display_width (3.1.4)
106
- unicode-emoji (~> 4.0, >= 4.0.4)
107
- unicode-emoji (4.0.4)
104
+ tago (0.3.0)
105
+ timeout (0.4.4)
106
+ unicode-display_width (3.2.0)
107
+ unicode-emoji (~> 4.1)
108
+ unicode-emoji (4.1.0)
108
109
  xcop (0.8.0)
109
110
  differ (~> 0.1.2)
110
111
  nokogiri (~> 1.10)
@@ -130,7 +131,7 @@ DEPENDENCIES
130
131
  rubocop-performance (~> 1.25)
131
132
  rubocop-rake (~> 0.7)
132
133
  simplecov (~> 0.22)
133
- simplecov-cobertura (~> 2.1)
134
+ simplecov-cobertura (~> 3.0)
134
135
  timeout (~> 0.4)
135
136
  xcop (~> 0.8)
136
137
  yard (~> 0.9)
data/lib/pgtk/stash.rb CHANGED
@@ -22,17 +22,46 @@ require_relative '../pgtk'
22
22
  # Copyright:: Copyright (c) 2019-2025 Yegor Bugayenko
23
23
  # License:: MIT
24
24
  class Pgtk::Stash
25
+ MODS = %w[INSERT DELETE UPDATE LOCK VACUUM TRANSACTION COMMIT ROLLBACK REINDEX TRUNCATE CREATE ALTER DROP SET].freeze
26
+ MODS_RE = Regexp.new("(^|\\s)(#{MODS.join('|')})(\\s|$)")
27
+
28
+ ALTS = ['UPDATE', 'INSERT INTO', 'DELETE FROM', 'TRUNCATE', 'ALTER TABLE', 'DROP TABLE'].freeze
29
+ ALTS_RE = Regexp.new("(?<=^|\\s)(?:#{ALTS.join('|')})\\s([a-z]+)(?=[^a-z]|$)")
30
+
31
+ private_constant :MODS, :ALTS, :MODS_RE, :ALTS_RE
32
+
25
33
  # Initialize a new Stash with query caching.
26
34
  #
27
35
  # @param [Object] pgsql PostgreSQL connection object
28
36
  # @param [Hash] stash Optional existing stash to use (default: new empty stash)
37
+ # @option [Hash] queries Internal cache data (default: {})
38
+ # @option [Hash] tables Internal cache data (default: {})
39
+ # @option [Concurrent::ReentrantReadWriteLock] entrance Lock for write internal state
40
+ # @option [Concurrent::AtomicBoolean] start_refresher Latch for start timers once
41
+ # @param [Integer] refresh Interval in seconds for recalculate stale queries
42
+ # @param [Integer] top Number of queries to recalculate
43
+ # @param [Integer] threads Number of threads in threadpool
29
44
  # @param [Loog] loog Logger for debugging (default: null logger)
30
- def initialize(pgsql, stash = {})
45
+ def initialize(
46
+ pgsql,
47
+ stash = {
48
+ queries: {},
49
+ tables: {},
50
+ entrance: Concurrent::ReentrantReadWriteLock.new,
51
+ start_refresher: Concurrent::AtomicBoolean.new(false)
52
+ },
53
+ refresh: 5,
54
+ top: 100,
55
+ threads: 5,
56
+ loog: Loog::NULL
57
+ )
31
58
  @pgsql = pgsql
32
59
  @stash = stash
33
- @stash[:queries] ||= {}
34
- @stash[:tables] ||= {}
35
- @entrance = Concurrent::ReentrantReadWriteLock.new
60
+ @entrance = stash[:entrance]
61
+ @refresh = refresh
62
+ @top = top
63
+ @threads = threads
64
+ @loog = loog
36
65
  end
37
66
 
38
67
  # Execute a SQL query with optional caching.
@@ -45,27 +74,28 @@ class Pgtk::Stash
45
74
  # @return [PG::Result] Query result
46
75
  def exec(query, params = [], result = 0)
47
76
  pure = (query.is_a?(Array) ? query.join(' ') : query).gsub(/\s+/, ' ').strip
48
- if /(^|\s)(INSERT|DELETE|UPDATE|LOCK)\s/.match?(pure) || /(^|\s)pg_[a-z_]+\(/.match?(pure)
49
- tables = pure.scan(/(?<=^|\s)(?:UPDATE|INSERT INTO|DELETE FROM|TRUNCATE)\s([a-z]+)(?=[^a-z]|$)/).map(&:first).uniq
77
+ if MODS_RE.match?(pure) || /(^|\s)pg_[a-z_]+\(/.match?(pure)
78
+ tables = pure.scan(ALTS_RE).map(&:first).uniq
50
79
  ret = @pgsql.exec(pure, params, result)
51
80
  @entrance.with_write_lock do
52
81
  tables.each do |t|
53
82
  @stash[:tables][t]&.each do |q|
54
- @stash[:queries].delete(q)
83
+ @stash[:queries][q].each_key do |key|
84
+ @stash[:queries][q][key]['stale'] = true
85
+ end
55
86
  end
56
- @stash[:tables].delete(t)
57
87
  end
58
88
  end
59
89
  else
60
90
  key = params.map(&:to_s).join(' -*&%^- ')
61
91
  @entrance.with_write_lock { @stash[:queries][pure] ||= {} }
62
- ret = @stash[:queries][pure][key]
63
- if ret.nil?
92
+ ret = @stash.dig(:queries, pure, key, 'ret')
93
+ if ret.nil? || @stash.dig(:queries, pure, key, 'stale')
64
94
  ret = @pgsql.exec(pure, params, result)
65
- if pure.start_with?('SELECT ') && !pure.include?(' NOW() ')
95
+ unless pure.include?(' NOW() ')
66
96
  @entrance.with_write_lock do
67
97
  @stash[:queries][pure] ||= {}
68
- @stash[:queries][pure][key] = ret
98
+ @stash[:queries][pure][key] = { 'ret' => ret, 'params' => params, 'result' => result }
69
99
  tables = pure.scan(/(?<=^|\s)(?:FROM|JOIN) ([a-z_]+)(?=\s|$)/).map(&:first).uniq
70
100
  tables.each do |t|
71
101
  @stash[:tables][t] = [] if @stash[:tables][t].nil?
@@ -75,6 +105,7 @@ class Pgtk::Stash
75
105
  end
76
106
  end
77
107
  end
108
+ count(pure, key)
78
109
  end
79
110
  ret
80
111
  end
@@ -87,7 +118,13 @@ class Pgtk::Stash
87
118
  # @return [Object] The result of the block
88
119
  def transaction
89
120
  @pgsql.transaction do |t|
90
- yield Pgtk::Stash.new(t, @stash)
121
+ yield Pgtk::Stash.new(
122
+ t, @stash,
123
+ refresh: @refresh,
124
+ top: @top,
125
+ threads: @threads,
126
+ loog: @loog
127
+ )
91
128
  end
92
129
  end
93
130
 
@@ -96,7 +133,14 @@ class Pgtk::Stash
96
133
  # @param args Arguments to pass to the underlying pool's start method
97
134
  # @return [Pgtk::Stash] A new stash that shares the same cache
98
135
  def start(*args)
99
- Pgtk::Stash.new(@pgsql.start(*args), @stash)
136
+ start_refresher
137
+ Pgtk::Stash.new(
138
+ @pgsql.start(*args), @stash,
139
+ refresh: @refresh,
140
+ top: @top,
141
+ threads: @threads,
142
+ loog: @loog
143
+ )
100
144
  end
101
145
 
102
146
  # Get the PostgreSQL server version.
@@ -105,4 +149,58 @@ class Pgtk::Stash
105
149
  def version
106
150
  @pgsql.version
107
151
  end
152
+
153
+ # Get statistics on the most used queries
154
+ #
155
+ # @return [Array<Array<String, Integer>>] Array of query and hits in desc hits order
156
+ def stats
157
+ @stash[:queries].map { |k, v| [k.dup, v.values.sum { |vv| vv['count'] }] }.sort_by { -_1[1] }
158
+ end
159
+
160
+ private
161
+
162
+ def count(query, key)
163
+ @entrance.with_write_lock do
164
+ @stash[:queries][query][key]['count'] ||= 0
165
+ @stash[:queries][query][key]['count'] += 1
166
+ end
167
+ end
168
+
169
+ def start_refresher
170
+ raise 'Cannot start cache refresh multiple times on same cache data' unless @stash[:start_refresher].make_true
171
+ Concurrent::FixedThreadPool.new(@threads).then do |threadpool|
172
+ Concurrent::TimerTask.execute(execution_interval: 24 * 60 * 60, executor: threadpool) do
173
+ @entrance.with_write_lock do
174
+ @stash[:queries].each_key do |q|
175
+ @stash[:queries][q].each_key do |k|
176
+ @stash[:queries][q][k]['count'] = 0
177
+ end
178
+ end
179
+ end
180
+ end
181
+ Concurrent::TimerTask.execute(execution_interval: @refresh, executor: threadpool) do
182
+ @stash[:queries]
183
+ .map { |k, v| [k, v.values.sum { |vv| vv['count'] }, v.values.any? { |vv| vv['stale'] }] }
184
+ .select { _1[2] }
185
+ .sort_by { -_1[1] }
186
+ .first(@top)
187
+ .each do |a|
188
+ q = a[0]
189
+ @stash[:queries][q].each_key do |k|
190
+ next unless @stash[:queries][q][k]['stale']
191
+ threadpool.post do
192
+ params = @stash[:queries][q][k]['params']
193
+ result = @stash[:queries][q][k]['result']
194
+ ret = @pgsql.exec(q, params, result)
195
+ @entrance.with_write_lock do
196
+ @stash[:queries][q] ||= {}
197
+ @stash[:queries][q][k] = { 'ret' => ret, 'params' => params, 'result' => result, 'count' => 1 }
198
+ end
199
+ end
200
+ end
201
+ end
202
+ end
203
+ end
204
+ nil
205
+ end
108
206
  end
data/lib/pgtk/version.rb CHANGED
@@ -11,5 +11,5 @@ require_relative '../pgtk'
11
11
  # License:: MIT
12
12
  module Pgtk
13
13
  # Current version of the library.
14
- VERSION = '0.18.1'
14
+ VERSION = '0.19.0'
15
15
  end
data/pgtk.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.authors = ['Yegor Bugayenko']
23
23
  s.email = 'yegor256@gmail.com'
24
24
  s.homepage = 'https://github.com/yegor256/pgtk'
25
- s.files = `git ls-files`.split($RS)
25
+ s.files = `git ls-files | grep -v -E '^(test/|\\.|renovate)'`.split($RS)
26
26
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
27
27
  s.rdoc_options = ['--charset=UTF-8']
28
28
  s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
data/resources/pom.xml CHANGED
@@ -10,8 +10,8 @@
10
10
  <version>0.0.0</version>
11
11
  <packaging>pom</packaging>
12
12
  <properties>
13
- <postgresql.version>42.7.7</postgresql.version>
14
- <liquibase.version>4.32.0</liquibase.version>
13
+ <postgresql.version>42.7.8</postgresql.version>
14
+ <liquibase.version>5.0.1</liquibase.version>
15
15
  </properties>
16
16
  <dependencies>
17
17
  <dependency>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgtk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.1
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
@@ -145,24 +145,6 @@ extra_rdoc_files:
145
145
  - LICENSE.txt
146
146
  - README.md
147
147
  files:
148
- - ".0pdd.yml"
149
- - ".gitattributes"
150
- - ".github/workflows/actionlint.yml"
151
- - ".github/workflows/codecov.yml"
152
- - ".github/workflows/copyrights.yml"
153
- - ".github/workflows/license.yml"
154
- - ".github/workflows/markdown-lint.yml"
155
- - ".github/workflows/pdd.yml"
156
- - ".github/workflows/rake.yml"
157
- - ".github/workflows/reuse.yml"
158
- - ".github/workflows/typos.yml"
159
- - ".github/workflows/xcop.yml"
160
- - ".github/workflows/yamllint.yml"
161
- - ".gitignore"
162
- - ".pdd"
163
- - ".rubocop.yml"
164
- - ".rultor.yml"
165
- - ".yamllint.yml"
166
148
  - Gemfile
167
149
  - Gemfile.lock
168
150
  - LICENSE.txt
@@ -182,18 +164,9 @@ files:
182
164
  - lib/pgtk/version.rb
183
165
  - lib/pgtk/wire.rb
184
166
  - pgtk.gemspec
185
- - renovate.json
186
167
  - resources/pom.xml
187
168
  - test-resources/2019/01-test.xml
188
169
  - test-resources/master.xml
189
- - test/test__helper.rb
190
- - test/test_impatient.rb
191
- - test/test_liquibase_task.rb
192
- - test/test_pgsql_task.rb
193
- - test/test_pool.rb
194
- - test/test_retry.rb
195
- - test/test_stash.rb
196
- - test/test_wire.rb
197
170
  homepage: https://github.com/yegor256/pgtk
198
171
  licenses:
199
172
  - MIT
@@ -214,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
187
  - !ruby/object:Gem::Version
215
188
  version: '0'
216
189
  requirements: []
217
- rubygems_version: 3.6.7
190
+ rubygems_version: 3.6.9
218
191
  specification_version: 4
219
192
  summary: PostgreSQL ToolKit for Ruby apps
220
193
  test_files: []
data/.0pdd.yml DELETED
@@ -1,12 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- errors:
5
- - yegor256@gmail.com
6
- # alerts:
7
- # github:
8
- # - yegor256
9
-
10
- tags:
11
- - pdd
12
- - bug
data/.gitattributes DELETED
@@ -1,7 +0,0 @@
1
- # Check out all text files in UNIX format, with LF as end of line
2
- # Don't change this file. If you have any ideas about it, please
3
- # submit a separate issue about it and we'll discuss.
4
-
5
- * text=auto eol=lf
6
- *.rb ident
7
- *.xml ident
@@ -1,25 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: actionlint
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- pull_request:
11
- branches:
12
- - master
13
- jobs:
14
- actionlint:
15
- timeout-minutes: 15
16
- runs-on: ubuntu-24.04
17
- steps:
18
- - uses: actions/checkout@v4
19
- - name: Download actionlint
20
- id: get_actionlint
21
- run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
22
- shell: bash
23
- - name: Check workflow files
24
- run: ${{ steps.get_actionlint.outputs.executable }} -color
25
- shell: bash
@@ -1,31 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: codecov
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- jobs:
11
- codecov:
12
- timeout-minutes: 15
13
- runs-on: ubuntu-24.04
14
- steps:
15
- - uses: actions/checkout@v4
16
- - uses: ruby/setup-ruby@v1
17
- with:
18
- ruby-version: 3.3
19
- bundler-cache: true
20
- - run: |
21
- sudo apt-get update --yes --fix-missing
22
- sudo apt-get install --yes libpq-dev postgresql-client postgresql
23
- sudo ln -s "$(realpath /usr/lib/postgresql/*/bin/initdb)" /bin/initdb
24
- sudo ln -s "$(realpath /usr/lib/postgresql/*/bin/postgres)" /bin/postgres
25
- sudo ln -s "$(realpath /usr/lib/postgresql/*/bin/pg_ctl)" /bin/pg_ctl
26
- - run: bundle config set --global path "$(pwd)/vendor/bundle"
27
- - run: bundle install --no-color
28
- - run: bundle exec rake
29
- - uses: codecov/codecov-action@v5
30
- with:
31
- token: ${{ secrets.CODECOV_TOKEN }}
@@ -1,15 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: copyrights
6
- 'on':
7
- push:
8
- pull_request:
9
- jobs:
10
- copyrights:
11
- timeout-minutes: 15
12
- runs-on: ubuntu-24.04
13
- steps:
14
- - uses: actions/checkout@v4
15
- - uses: yegor256/copyrights-action@0.0.12
@@ -1,42 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: license
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- pull_request:
11
- branches:
12
- - master
13
- jobs:
14
- license:
15
- timeout-minutes: 15
16
- runs-on: ubuntu-24.04
17
- steps:
18
- - uses: actions/checkout@v4
19
- - shell: bash
20
- run: |
21
- header="Copyright (c) 2019-$(date +%Y) Yegor Bugayenko"
22
- failed="false"
23
- while IFS= read -r file; do
24
- if ! grep -q "${header}" "${file}"; then
25
- failed="true"
26
- echo "⚠️ Copyright header is not found in: ${file}"
27
- else
28
- echo "File looks good: ${file}"
29
- fi
30
- done < <(find . -type f \( \
31
- -name "Dockerfile" -o \
32
- -name "LICENSE.txt" -o \
33
- -name "Makefile" -o \
34
- -name "Rakefile" -o \
35
- -name "*.sh" -o \
36
- -name "*.rb" -o \
37
- -name "*.fe" -o \
38
- -name "*.yml" \
39
- \) -print)
40
- if [ "${failed}" = "true" ]; then
41
- exit 1
42
- fi
@@ -1,23 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: markdown-lint
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- pull_request:
11
- branches:
12
- - master
13
- paths-ignore: ['paper/**', 'sandbox/**']
14
- concurrency:
15
- group: markdown-lint-${{ github.ref }}
16
- cancel-in-progress: true
17
- jobs:
18
- markdown-lint:
19
- timeout-minutes: 15
20
- runs-on: ubuntu-24.04
21
- steps:
22
- - uses: actions/checkout@v4
23
- - uses: DavidAnson/markdownlint-cli2-action@v20.0.0
@@ -1,19 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: pdd
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- pull_request:
11
- branches:
12
- - master
13
- jobs:
14
- pdd:
15
- timeout-minutes: 15
16
- runs-on: ubuntu-24.04
17
- steps:
18
- - uses: actions/checkout@v4
19
- - uses: volodya-lombrozo/pdd-action@master
@@ -1,34 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: rake
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- pull_request:
11
- branches:
12
- - master
13
- jobs:
14
- rake:
15
- strategy:
16
- matrix:
17
- os: [ubuntu-24.04]
18
- ruby: [3.3]
19
- runs-on: ${{ matrix.os }}
20
- steps:
21
- - uses: actions/checkout@v4
22
- - run: |
23
- sudo apt-get update --yes --fix-missing
24
- sudo apt-get install --yes libpq-dev postgresql-client postgresql
25
- sudo ln -s "$(realpath /usr/lib/postgresql/*/bin/initdb)" /bin/initdb
26
- sudo ln -s "$(realpath /usr/lib/postgresql/*/bin/postgres)" /bin/postgres
27
- sudo ln -s "$(realpath /usr/lib/postgresql/*/bin/pg_ctl)" /bin/pg_ctl
28
- - uses: ruby/setup-ruby@v1
29
- with:
30
- ruby-version: ${{ matrix.ruby }}
31
- bundler-cache: true
32
- - run: bundle config set --global path "$(pwd)/vendor/bundle"
33
- - run: bundle install --no-color
34
- - run: bundle exec rake
@@ -1,19 +0,0 @@
1
- # SPDX-FileCopyrightText: Copyright (c) 2019-2025 Yegor Bugayenko
2
- # SPDX-License-Identifier: MIT
3
- ---
4
- # yamllint disable rule:line-length
5
- name: reuse
6
- 'on':
7
- push:
8
- branches:
9
- - master
10
- pull_request:
11
- branches:
12
- - master
13
- jobs:
14
- reuse:
15
- timeout-minutes: 15
16
- runs-on: ubuntu-24.04
17
- steps:
18
- - uses: actions/checkout@v4
19
- - uses: fsfe/reuse-action@v5