donce 0.2.4 → 0.3.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 +4 -4
- data/Gemfile +6 -5
- data/Gemfile.lock +49 -34
- data/README.md +5 -2
- data/REUSE.toml +8 -7
- data/Rakefile +1 -0
- data/donce.gemspec +3 -3
- data/lib/donce.rb +10 -5
- metadata +5 -24
- data/.0pdd.yml +0 -5
- data/.gitattributes +0 -7
- data/.github/workflows/actionlint.yml +0 -25
- data/.github/workflows/codecov.yml +0 -27
- data/.github/workflows/copyrights.yml +0 -19
- data/.github/workflows/markdown-lint.yml +0 -23
- data/.github/workflows/pdd.yml +0 -19
- data/.github/workflows/rake.yml +0 -29
- data/.github/workflows/reuse.yml +0 -19
- data/.github/workflows/xcop.yml +0 -19
- data/.github/workflows/yamllint.yml +0 -21
- data/.gitignore +0 -10
- data/.pdd +0 -7
- data/.rubocop.yml +0 -34
- data/.rultor.yml +0 -26
- data/.yamllint.yml +0 -12
- data/renovate.json +0 -6
- data/test/test__helper.rb +0 -35
- data/test/test_donce.rb +0 -80
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 441d95b36d07ea59d9d3bb2adac79fda0391c241ecb7d6c100aea5f62552dcba
|
|
4
|
+
data.tar.gz: 7cc6a4122c5eebe172e65b8d71cd262f11ac2325786567a87ee5cbf50e9a38c5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 80e61fec77d8d68d588bd5600150648eb77a5e35513137badcd0dcb6b45c0f2f7968ddc13b345407ebe6c32d9bc557769ac5dce61ea165661a24bd366d9c44d9
|
|
7
|
+
data.tar.gz: 4dd1618e4247936efc4dc6d15ae3397c655aedafa74555a7353df6a241a2ae0fc4292e676dc7889161c7ee6a4fc07cfc33921f1905ea3e3cd6b740f17b2df3a8
|
data/Gemfile
CHANGED
|
@@ -7,14 +7,15 @@ source 'https://rubygems.org'
|
|
|
7
7
|
gemspec
|
|
8
8
|
|
|
9
9
|
gem 'loog', '>0', require: false
|
|
10
|
-
gem 'minitest', '~>
|
|
10
|
+
gem 'minitest', '~>6.0', require: false
|
|
11
11
|
gem 'minitest-reporters', '~>1.7', require: false
|
|
12
12
|
gem 'minitest-retry', '~>0.2', require: false
|
|
13
13
|
gem 'rake', '~>13.2', require: false
|
|
14
|
+
gem 'rdoc', '~>7.0', require: false
|
|
14
15
|
gem 'rubocop', '~>1.75', require: false
|
|
15
|
-
gem 'rubocop-minitest', '
|
|
16
|
-
gem 'rubocop-performance', '
|
|
17
|
-
gem 'rubocop-rake', '
|
|
16
|
+
gem 'rubocop-minitest', '~>0.38', require: false
|
|
17
|
+
gem 'rubocop-performance', '~>1.25', require: false
|
|
18
|
+
gem 'rubocop-rake', '~>0.7', require: false
|
|
18
19
|
gem 'simplecov', '~>0.22', require: false
|
|
19
|
-
gem 'simplecov-cobertura', '~>
|
|
20
|
+
gem 'simplecov-cobertura', '~>3.1', require: false
|
|
20
21
|
gem 'yard', '~>0.9', require: false
|
data/Gemfile.lock
CHANGED
|
@@ -11,41 +11,53 @@ GEM
|
|
|
11
11
|
specs:
|
|
12
12
|
ansi (1.5.0)
|
|
13
13
|
ast (2.4.3)
|
|
14
|
-
backtrace (0.4.
|
|
14
|
+
backtrace (0.4.1)
|
|
15
15
|
builder (3.3.0)
|
|
16
|
+
date (3.5.1)
|
|
16
17
|
docile (1.4.1)
|
|
17
|
-
elapsed (0.
|
|
18
|
-
loog (
|
|
19
|
-
tago (
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
elapsed (0.2.1)
|
|
19
|
+
loog (~> 0.6)
|
|
20
|
+
tago (~> 0.1)
|
|
21
|
+
erb (6.0.1)
|
|
22
|
+
json (2.18.0)
|
|
23
|
+
language_server-protocol (3.17.0.5)
|
|
22
24
|
lint_roller (1.1.0)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
logger (1.7.0)
|
|
26
|
+
loog (0.6.1)
|
|
27
|
+
logger (~> 1.0)
|
|
28
|
+
minitest (6.0.1)
|
|
29
|
+
prism (~> 1.5)
|
|
25
30
|
minitest-reporters (1.7.1)
|
|
26
31
|
ansi
|
|
27
32
|
builder
|
|
28
33
|
minitest (>= 5.0)
|
|
29
34
|
ruby-progressbar
|
|
30
|
-
minitest-retry (0.
|
|
35
|
+
minitest-retry (0.3.0)
|
|
31
36
|
minitest (>= 5.0)
|
|
32
37
|
os (1.1.4)
|
|
33
38
|
parallel (1.27.0)
|
|
34
|
-
parser (3.3.
|
|
39
|
+
parser (3.3.10.0)
|
|
35
40
|
ast (~> 2.4.1)
|
|
36
41
|
racc
|
|
37
|
-
prism (1.
|
|
38
|
-
|
|
42
|
+
prism (1.7.0)
|
|
43
|
+
psych (5.3.1)
|
|
44
|
+
date
|
|
45
|
+
stringio
|
|
46
|
+
qbash (0.4.8)
|
|
39
47
|
backtrace (> 0)
|
|
40
48
|
elapsed (> 0)
|
|
41
49
|
loog (> 0)
|
|
42
50
|
tago (> 0)
|
|
43
51
|
racc (1.8.1)
|
|
44
52
|
rainbow (3.1.1)
|
|
45
|
-
rake (13.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
53
|
+
rake (13.3.1)
|
|
54
|
+
rdoc (7.0.3)
|
|
55
|
+
erb
|
|
56
|
+
psych (>= 4.0.0)
|
|
57
|
+
tsort
|
|
58
|
+
regexp_parser (2.11.3)
|
|
59
|
+
rexml (3.4.4)
|
|
60
|
+
rubocop (1.82.1)
|
|
49
61
|
json (~> 2.3)
|
|
50
62
|
language_server-protocol (~> 3.17.0.2)
|
|
51
63
|
lint_roller (~> 1.1.0)
|
|
@@ -53,20 +65,20 @@ GEM
|
|
|
53
65
|
parser (>= 3.3.0.2)
|
|
54
66
|
rainbow (>= 2.2.2, < 4.0)
|
|
55
67
|
regexp_parser (>= 2.9.3, < 3.0)
|
|
56
|
-
rubocop-ast (>= 1.
|
|
68
|
+
rubocop-ast (>= 1.48.0, < 2.0)
|
|
57
69
|
ruby-progressbar (~> 1.7)
|
|
58
70
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
59
|
-
rubocop-ast (1.
|
|
71
|
+
rubocop-ast (1.49.0)
|
|
60
72
|
parser (>= 3.3.7.2)
|
|
61
|
-
prism (~> 1.
|
|
62
|
-
rubocop-minitest (0.38.
|
|
73
|
+
prism (~> 1.7)
|
|
74
|
+
rubocop-minitest (0.38.2)
|
|
63
75
|
lint_roller (~> 1.1)
|
|
64
76
|
rubocop (>= 1.75.0, < 2.0)
|
|
65
77
|
rubocop-ast (>= 1.38.0, < 2.0)
|
|
66
|
-
rubocop-performance (1.
|
|
78
|
+
rubocop-performance (1.26.1)
|
|
67
79
|
lint_roller (~> 1.1)
|
|
68
80
|
rubocop (>= 1.75.0, < 2.0)
|
|
69
|
-
rubocop-ast (>= 1.
|
|
81
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
70
82
|
rubocop-rake (0.7.1)
|
|
71
83
|
lint_roller (~> 1.1)
|
|
72
84
|
rubocop (>= 1.72.1)
|
|
@@ -75,16 +87,18 @@ GEM
|
|
|
75
87
|
docile (~> 1.1)
|
|
76
88
|
simplecov-html (~> 0.11)
|
|
77
89
|
simplecov_json_formatter (~> 0.1)
|
|
78
|
-
simplecov-cobertura (
|
|
90
|
+
simplecov-cobertura (3.1.0)
|
|
79
91
|
rexml
|
|
80
92
|
simplecov (~> 0.19)
|
|
81
|
-
simplecov-html (0.13.
|
|
93
|
+
simplecov-html (0.13.2)
|
|
82
94
|
simplecov_json_formatter (0.1.4)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
unicode-
|
|
87
|
-
|
|
95
|
+
stringio (3.2.0)
|
|
96
|
+
tago (0.6.0)
|
|
97
|
+
tsort (0.2.0)
|
|
98
|
+
unicode-display_width (3.2.0)
|
|
99
|
+
unicode-emoji (~> 4.1)
|
|
100
|
+
unicode-emoji (4.2.0)
|
|
101
|
+
yard (0.9.38)
|
|
88
102
|
|
|
89
103
|
PLATFORMS
|
|
90
104
|
arm64-darwin-23
|
|
@@ -95,16 +109,17 @@ PLATFORMS
|
|
|
95
109
|
DEPENDENCIES
|
|
96
110
|
donce!
|
|
97
111
|
loog (> 0)
|
|
98
|
-
minitest (~>
|
|
112
|
+
minitest (~> 6.0)
|
|
99
113
|
minitest-reporters (~> 1.7)
|
|
100
114
|
minitest-retry (~> 0.2)
|
|
101
115
|
rake (~> 13.2)
|
|
116
|
+
rdoc (~> 7.0)
|
|
102
117
|
rubocop (~> 1.75)
|
|
103
|
-
rubocop-minitest (
|
|
104
|
-
rubocop-performance (
|
|
105
|
-
rubocop-rake (
|
|
118
|
+
rubocop-minitest (~> 0.38)
|
|
119
|
+
rubocop-performance (~> 1.25)
|
|
120
|
+
rubocop-rake (~> 0.7)
|
|
106
121
|
simplecov (~> 0.22)
|
|
107
|
-
simplecov-cobertura (~>
|
|
122
|
+
simplecov-cobertura (~> 3.1)
|
|
108
123
|
yard (~> 0.9)
|
|
109
124
|
|
|
110
125
|
BUNDLED WITH
|
data/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
[](https://github.com/yegor256/donce/blob/master/LICENSE.txt)
|
|
13
13
|
|
|
14
14
|
This small Ruby library helps to build temporary [Docker]
|
|
15
|
-
images,
|
|
15
|
+
images, run Docker containers, and clean up afterwards — it may be
|
|
16
16
|
convenient for automated tests (for example, with [Minitest]):
|
|
17
17
|
|
|
18
18
|
```ruby
|
|
@@ -29,7 +29,7 @@ class MyTest < Minitest::Test
|
|
|
29
29
|
end
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
It's possible to run Docker image in
|
|
32
|
+
It's possible to run a Docker image in background mode too:
|
|
33
33
|
|
|
34
34
|
```ruby
|
|
35
35
|
stdout = donce(image: 'ubuntu', command: 'sleep 9999') do |id|
|
|
@@ -38,6 +38,9 @@ stdout = donce(image: 'ubuntu', command: 'sleep 9999') do |id|
|
|
|
38
38
|
end
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
+
If you set `DONCE_SUDO` environment variable to `true`, `docker` will
|
|
42
|
+
be executed via `sudo`.
|
|
43
|
+
|
|
41
44
|
## Parameters
|
|
42
45
|
|
|
43
46
|
Here's a list of the available parameters for `donce`:
|
data/REUSE.toml
CHANGED
|
@@ -4,9 +4,17 @@
|
|
|
4
4
|
version = 1
|
|
5
5
|
[[annotations]]
|
|
6
6
|
path = [
|
|
7
|
+
".DS_Store",
|
|
8
|
+
".gitattributes",
|
|
9
|
+
".gitignore",
|
|
10
|
+
".pdd",
|
|
7
11
|
"**.json",
|
|
8
12
|
"**.md",
|
|
13
|
+
"**.png",
|
|
9
14
|
"**.txt",
|
|
15
|
+
"**/.DS_Store",
|
|
16
|
+
"**/.gitignore",
|
|
17
|
+
"**/.pdd",
|
|
10
18
|
"**/*.csv",
|
|
11
19
|
"**/*.jpg",
|
|
12
20
|
"**/*.json",
|
|
@@ -16,15 +24,8 @@ path = [
|
|
|
16
24
|
"**/*.svg",
|
|
17
25
|
"**/*.txt",
|
|
18
26
|
"**/*.vm",
|
|
19
|
-
"**/.DS_Store",
|
|
20
|
-
"**/.gitignore",
|
|
21
|
-
"**/.pdd",
|
|
22
27
|
"**/CNAME",
|
|
23
28
|
"**/Gemfile.lock",
|
|
24
|
-
".DS_Store",
|
|
25
|
-
".gitattributes",
|
|
26
|
-
".gitignore",
|
|
27
|
-
".pdd",
|
|
28
29
|
"Gemfile.lock",
|
|
29
30
|
"README.md",
|
|
30
31
|
"renovate.json",
|
data/Rakefile
CHANGED
data/donce.gemspec
CHANGED
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
|
9
9
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
|
10
10
|
s.required_ruby_version = '>=3.0'
|
|
11
11
|
s.name = 'donce'
|
|
12
|
-
s.version = '0.
|
|
12
|
+
s.version = '0.3.0'
|
|
13
13
|
s.license = 'MIT'
|
|
14
14
|
s.summary = 'Builds and starts temporary Docker containers'
|
|
15
15
|
s.description =
|
|
@@ -21,8 +21,8 @@ Gem::Specification.new do |s|
|
|
|
21
21
|
'tool inside, but Testcontainers don\'t have such an image.'
|
|
22
22
|
s.authors = ['Yegor Bugayenko']
|
|
23
23
|
s.email = 'yegor256@gmail.com'
|
|
24
|
-
s.homepage = '
|
|
25
|
-
s.files = `git ls-files`.split($RS)
|
|
24
|
+
s.homepage = 'https://github.com/yegor256/donce'
|
|
25
|
+
s.files = `git ls-files | grep -v -E '^(test/|\\.|renovate)'`.split($RS)
|
|
26
26
|
s.rdoc_options = ['--charset=UTF-8']
|
|
27
27
|
s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
|
|
28
28
|
s.add_dependency 'backtrace', '~> 0.3'
|
data/lib/donce.rb
CHANGED
|
@@ -13,8 +13,8 @@ require 'tmpdir'
|
|
|
13
13
|
|
|
14
14
|
# Execute Docker container and clean up afterwards.
|
|
15
15
|
#
|
|
16
|
-
# This function helps
|
|
17
|
-
# images,
|
|
16
|
+
# This function helps build temporary Docker
|
|
17
|
+
# images, runs Docker containers, and cleans up afterwards — may be
|
|
18
18
|
# convenient for automated tests (for example, with Minitest):
|
|
19
19
|
#
|
|
20
20
|
# class MyTest < Minitest::Test
|
|
@@ -30,7 +30,7 @@ require 'tmpdir'
|
|
|
30
30
|
# end
|
|
31
31
|
#
|
|
32
32
|
# It's possible to pass a block to it too, which will lead to
|
|
33
|
-
# background execution of the container
|
|
33
|
+
# background execution of the container:
|
|
34
34
|
#
|
|
35
35
|
# def test_runs_daemon
|
|
36
36
|
# donce(dockerfile: "FROM ubuntu\nCMD sleep 9999") do |id|
|
|
@@ -53,19 +53,23 @@ module Kernel
|
|
|
53
53
|
|
|
54
54
|
# Build Docker image (or use existing one), run Docker container, and then clean up.
|
|
55
55
|
#
|
|
56
|
-
# @param [String] dockerfile The content of the +Dockerfile+
|
|
56
|
+
# @param [String|Array<String>] dockerfile The content of the +Dockerfile+
|
|
57
|
+
# (if array is provided, it will be concatenated)
|
|
57
58
|
# @param [String] home The directory with Dockerfile and all other necessary files
|
|
58
59
|
# @param [String] image The name of Docker image, e.g. "ubuntu:22.04"
|
|
59
60
|
# @param [Logger] log The logging destination, can be +$stdout+
|
|
60
61
|
# @param [String|Array<String>] args List of extra arguments for the +docker+ command
|
|
61
62
|
# @param [Hash<String,String>] env Environment variables going into the container
|
|
62
63
|
# @param [Hash<String,String>] volumes Local to container volumes mapping
|
|
63
|
-
# @param [Hash<String,String>] ports Local to container port mapping
|
|
64
|
+
# @param [Hash<String,String>|Array<Integer>] ports Local to container port mapping
|
|
64
65
|
# @param [Hash<String,String>] build_args Arguments for +docker build+ as +--build-arg+ may need
|
|
65
66
|
# @param [Boolean] root Let user inside the container be "root"?
|
|
66
67
|
# @param [String|Array<String>] command The command for the script inside the container
|
|
67
68
|
# @param [Integer] timeout Maximum seconds to spend on each +docker+ call
|
|
68
69
|
# @return [String] The stdout of the container
|
|
70
|
+
# @yield [String] Container ID if block is given (runs container in daemon mode)
|
|
71
|
+
# @yieldparam [String] id The ID of the running container
|
|
72
|
+
# @yieldreturn [void] The container will be stopped after the block execution
|
|
69
73
|
def donce(dockerfile: nil, image: nil, home: nil, log: $stdout, args: '', env: {}, root: false, command: '',
|
|
70
74
|
timeout: 60, volumes: {}, ports: {}, build_args: {})
|
|
71
75
|
raise 'Either use "dockerfile" or "home"' if dockerfile && home
|
|
@@ -85,6 +89,7 @@ module Kernel
|
|
|
85
89
|
raise 'The "timeout" is nil' if timeout.nil?
|
|
86
90
|
raise 'The "timeout" must be a number' unless timeout.is_a?(Integer) || timeout.is_a?(Float)
|
|
87
91
|
raise 'The "ports" is nil' if ports.nil?
|
|
92
|
+
ports = ports.to_h { |x| [x, x] } if ports.is_a?(Array)
|
|
88
93
|
raise 'The "ports" must be a Hash' unless ports.is_a?(Hash)
|
|
89
94
|
raise 'The "build_args" is nil' if build_args.nil?
|
|
90
95
|
raise 'The "build_args" must be a Hash' unless build_args.is_a?(Hash)
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: donce
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yegor Bugayenko
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: backtrace
|
|
@@ -60,25 +60,9 @@ email: yegor256@gmail.com
|
|
|
60
60
|
executables: []
|
|
61
61
|
extensions: []
|
|
62
62
|
extra_rdoc_files:
|
|
63
|
-
- README.md
|
|
64
63
|
- LICENSE.txt
|
|
64
|
+
- README.md
|
|
65
65
|
files:
|
|
66
|
-
- ".0pdd.yml"
|
|
67
|
-
- ".gitattributes"
|
|
68
|
-
- ".github/workflows/actionlint.yml"
|
|
69
|
-
- ".github/workflows/codecov.yml"
|
|
70
|
-
- ".github/workflows/copyrights.yml"
|
|
71
|
-
- ".github/workflows/markdown-lint.yml"
|
|
72
|
-
- ".github/workflows/pdd.yml"
|
|
73
|
-
- ".github/workflows/rake.yml"
|
|
74
|
-
- ".github/workflows/reuse.yml"
|
|
75
|
-
- ".github/workflows/xcop.yml"
|
|
76
|
-
- ".github/workflows/yamllint.yml"
|
|
77
|
-
- ".gitignore"
|
|
78
|
-
- ".pdd"
|
|
79
|
-
- ".rubocop.yml"
|
|
80
|
-
- ".rultor.yml"
|
|
81
|
-
- ".yamllint.yml"
|
|
82
66
|
- Gemfile
|
|
83
67
|
- Gemfile.lock
|
|
84
68
|
- LICENSE.txt
|
|
@@ -88,10 +72,7 @@ files:
|
|
|
88
72
|
- Rakefile
|
|
89
73
|
- donce.gemspec
|
|
90
74
|
- lib/donce.rb
|
|
91
|
-
|
|
92
|
-
- test/test__helper.rb
|
|
93
|
-
- test/test_donce.rb
|
|
94
|
-
homepage: http://github.com/yegor256/donce.rb
|
|
75
|
+
homepage: https://github.com/yegor256/donce
|
|
95
76
|
licenses:
|
|
96
77
|
- MIT
|
|
97
78
|
metadata:
|
|
@@ -111,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
111
92
|
- !ruby/object:Gem::Version
|
|
112
93
|
version: '0'
|
|
113
94
|
requirements: []
|
|
114
|
-
rubygems_version: 3.6.
|
|
95
|
+
rubygems_version: 3.6.9
|
|
115
96
|
specification_version: 4
|
|
116
97
|
summary: Builds and starts temporary Docker containers
|
|
117
98
|
test_files: []
|
data/.0pdd.yml
DELETED
data/.gitattributes
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-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,27 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-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: bundle config set --global path "$(pwd)/vendor/bundle"
|
|
21
|
-
- run: bundle install --no-color
|
|
22
|
-
- run: bundle exec rake
|
|
23
|
-
- uses: codecov/codecov-action@v5
|
|
24
|
-
with:
|
|
25
|
-
token: ${{ secrets.CODECOV_TOKEN }}
|
|
26
|
-
files: coverage/.resultset.json
|
|
27
|
-
fail_ci_if_error: true
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
name: copyrights
|
|
6
|
-
'on':
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- master
|
|
10
|
-
pull_request:
|
|
11
|
-
branches:
|
|
12
|
-
- master
|
|
13
|
-
jobs:
|
|
14
|
-
copyrights:
|
|
15
|
-
timeout-minutes: 15
|
|
16
|
-
runs-on: ubuntu-24.04
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v4
|
|
19
|
-
- uses: yegor256/copyrights-action@0.0.8
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-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: articulate/actions-markdownlint@v1
|
data/.github/workflows/pdd.yml
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-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
|
data/.github/workflows/rake.yml
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-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
|
-
timeout-minutes: 5
|
|
20
|
-
runs-on: ${{ matrix.os }}
|
|
21
|
-
steps:
|
|
22
|
-
- uses: actions/checkout@v4
|
|
23
|
-
- uses: ruby/setup-ruby@v1
|
|
24
|
-
with:
|
|
25
|
-
ruby-version: ${{ matrix.ruby }}
|
|
26
|
-
bundler-cache: true
|
|
27
|
-
- run: bundle config set --global path "$(pwd)/vendor/bundle"
|
|
28
|
-
- run: bundle install --no-color
|
|
29
|
-
- run: bundle exec rake
|
data/.github/workflows/reuse.yml
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-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
|
data/.github/workflows/xcop.yml
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
name: xcop
|
|
6
|
-
'on':
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- master
|
|
10
|
-
pull_request:
|
|
11
|
-
branches:
|
|
12
|
-
- master
|
|
13
|
-
jobs:
|
|
14
|
-
xcop:
|
|
15
|
-
timeout-minutes: 15
|
|
16
|
-
runs-on: ubuntu-24.04
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v4
|
|
19
|
-
- uses: g4s8/xcop-action@master
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
name: yamllint
|
|
6
|
-
'on':
|
|
7
|
-
push:
|
|
8
|
-
branches:
|
|
9
|
-
- master
|
|
10
|
-
pull_request:
|
|
11
|
-
branches:
|
|
12
|
-
- master
|
|
13
|
-
jobs:
|
|
14
|
-
yamllint:
|
|
15
|
-
timeout-minutes: 15
|
|
16
|
-
runs-on: ubuntu-24.04
|
|
17
|
-
steps:
|
|
18
|
-
- uses: actions/checkout@v4
|
|
19
|
-
- uses: ibiqlik/action-yamllint@v3
|
|
20
|
-
with:
|
|
21
|
-
config_file: .yamllint.yml
|
data/.gitignore
DELETED
data/.pdd
DELETED
data/.rubocop.yml
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
AllCops:
|
|
5
|
-
Exclude:
|
|
6
|
-
- 'bin/**/*'
|
|
7
|
-
- 'assets/**/*'
|
|
8
|
-
- 'vendor/**/**'
|
|
9
|
-
DisplayCopNames: true
|
|
10
|
-
TargetRubyVersion: 3.2
|
|
11
|
-
SuggestExtensions: false
|
|
12
|
-
NewCops: enable
|
|
13
|
-
plugins:
|
|
14
|
-
- rubocop-minitest
|
|
15
|
-
- rubocop-performance
|
|
16
|
-
- rubocop-rake
|
|
17
|
-
Metrics/ModuleLength:
|
|
18
|
-
Max: 200
|
|
19
|
-
Minitest/EmptyLineBeforeAssertionMethods:
|
|
20
|
-
Enabled: false
|
|
21
|
-
Gemspec/RequiredRubyVersion:
|
|
22
|
-
Enabled: false
|
|
23
|
-
Metrics/MethodLength:
|
|
24
|
-
Enabled: false
|
|
25
|
-
Metrics/ParameterLists:
|
|
26
|
-
Enabled: false
|
|
27
|
-
Metrics/AbcSize:
|
|
28
|
-
Enabled: false
|
|
29
|
-
Metrics/CyclomaticComplexity:
|
|
30
|
-
Enabled: false
|
|
31
|
-
Metrics/PerceivedComplexity:
|
|
32
|
-
Enabled: false
|
|
33
|
-
Layout/EmptyLineAfterGuardClause:
|
|
34
|
-
Enabled: false
|
data/.rultor.yml
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
# yamllint disable rule:line-length
|
|
5
|
-
docker:
|
|
6
|
-
image: yegor256/ruby
|
|
7
|
-
assets:
|
|
8
|
-
rubygems.yml: yegor256/home#assets/rubygems.yml
|
|
9
|
-
install: |
|
|
10
|
-
pdd -f /dev/null
|
|
11
|
-
bundle install --no-color
|
|
12
|
-
release:
|
|
13
|
-
pre: false
|
|
14
|
-
script: |-
|
|
15
|
-
[[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit -1
|
|
16
|
-
DONCE_SUDO=true bundle exec rake
|
|
17
|
-
rm -rf *.gem
|
|
18
|
-
sed -i "s/0\.0\.0/${tag}/g" donce.gemspec
|
|
19
|
-
git add donce.gemspec
|
|
20
|
-
git commit -m "version set to ${tag}"
|
|
21
|
-
gem build donce.gemspec
|
|
22
|
-
chmod 0600 ../rubygems.yml
|
|
23
|
-
gem push *.gem --config-file ../rubygems.yml
|
|
24
|
-
merge:
|
|
25
|
-
script: |-
|
|
26
|
-
DONCE_SUDO=true bundle exec rake
|
data/.yamllint.yml
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
2
|
-
# SPDX-License-Identifier: MIT
|
|
3
|
-
---
|
|
4
|
-
extends: default
|
|
5
|
-
rules:
|
|
6
|
-
line-length: disable
|
|
7
|
-
brackets:
|
|
8
|
-
min-spaces-inside: 0
|
|
9
|
-
max-spaces-inside: 2
|
|
10
|
-
truthy:
|
|
11
|
-
level: warning
|
|
12
|
-
allowed-values: [ 'on', 'true', 'false', 'yes', 'no' ]
|
data/renovate.json
DELETED
data/test/test__helper.rb
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
4
|
-
# SPDX-License-Identifier: MIT
|
|
5
|
-
|
|
6
|
-
$stdout.sync = true
|
|
7
|
-
|
|
8
|
-
require 'simplecov'
|
|
9
|
-
require 'simplecov-cobertura'
|
|
10
|
-
unless SimpleCov.running
|
|
11
|
-
SimpleCov.command_name('test')
|
|
12
|
-
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
|
|
13
|
-
[
|
|
14
|
-
SimpleCov::Formatter::HTMLFormatter,
|
|
15
|
-
SimpleCov::Formatter::CoberturaFormatter
|
|
16
|
-
]
|
|
17
|
-
)
|
|
18
|
-
SimpleCov.minimum_coverage 80
|
|
19
|
-
SimpleCov.minimum_coverage_by_file 80
|
|
20
|
-
SimpleCov.start do
|
|
21
|
-
add_filter 'test/'
|
|
22
|
-
add_filter 'vendor/'
|
|
23
|
-
add_filter 'target/'
|
|
24
|
-
track_files 'lib/**/*.rb'
|
|
25
|
-
track_files '*.rb'
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
require 'minitest/autorun'
|
|
30
|
-
require 'minitest/reporters'
|
|
31
|
-
Minitest::Reporters.use! [Minitest::Reporters::SpecReporter.new]
|
|
32
|
-
|
|
33
|
-
# To make tests retry on failure:
|
|
34
|
-
require 'minitest/retry'
|
|
35
|
-
Minitest::Retry.use!(methods_to_skip: [])
|
data/test/test_donce.rb
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
4
|
-
# SPDX-License-Identifier: MIT
|
|
5
|
-
|
|
6
|
-
require 'logger'
|
|
7
|
-
require 'loog'
|
|
8
|
-
require 'minitest/autorun'
|
|
9
|
-
require_relative '../lib/donce'
|
|
10
|
-
|
|
11
|
-
# Test.
|
|
12
|
-
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
|
13
|
-
# Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
|
|
14
|
-
# License:: MIT
|
|
15
|
-
class TestDonce < Minitest::Test
|
|
16
|
-
def test_runs_simple_echo
|
|
17
|
-
stdout = donce(dockerfile: "FROM ubuntu\nCMD echo hello", log: Loog::NULL)
|
|
18
|
-
assert_equal("hello\n", stdout)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def test_prints_build_args
|
|
22
|
-
stdout = donce(
|
|
23
|
-
dockerfile: [
|
|
24
|
-
'FROM ubuntu',
|
|
25
|
-
'ARG FOO=what?',
|
|
26
|
-
'RUN echo $FOO > /tmp/foo',
|
|
27
|
-
'CMD cat /tmp/foo'
|
|
28
|
-
],
|
|
29
|
-
build_args: { 'FOO' => 'hello' },
|
|
30
|
-
log: Loog::NULL
|
|
31
|
-
)
|
|
32
|
-
assert_equal("hello\n", stdout)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def test_runs_existing_image
|
|
36
|
-
stdout = donce(image: 'ubuntu:22.04', command: 'echo hello', log: Loog::NULL)
|
|
37
|
-
assert_equal("hello\n", stdout)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def test_runs_from_home
|
|
41
|
-
Dir.mktmpdir do |home|
|
|
42
|
-
File.write(File.join(home, 'Dockerfile'), "FROM ubuntu\nCMD echo hello")
|
|
43
|
-
stdout = donce(home:, log: Loog::NULL)
|
|
44
|
-
assert_equal("hello\n", stdout)
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def test_copies_resources
|
|
49
|
-
content = 'hello!'
|
|
50
|
-
Dir.mktmpdir do |home|
|
|
51
|
-
File.write(File.join(home, 'test.txt'), content)
|
|
52
|
-
File.write(
|
|
53
|
-
File.join(home, 'Dockerfile'),
|
|
54
|
-
[
|
|
55
|
-
'FROM ubuntu',
|
|
56
|
-
'WORKDIR /foo',
|
|
57
|
-
'COPY test.txt .',
|
|
58
|
-
'CMD cat test.txt'
|
|
59
|
-
].join("\n")
|
|
60
|
-
)
|
|
61
|
-
stdout = donce(home:, log: Loog::NULL)
|
|
62
|
-
assert_equal(content, stdout)
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def test_runs_daemon
|
|
67
|
-
seen = false
|
|
68
|
-
donce(dockerfile: "FROM ubuntu\nCMD while true; do sleep 1; echo sleeping; done", log: Loog::NULL) do |id|
|
|
69
|
-
seen = true
|
|
70
|
-
refute_empty(id)
|
|
71
|
-
sleep 1
|
|
72
|
-
end
|
|
73
|
-
assert(seen)
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def test_returns_stdout_from_daemon
|
|
77
|
-
stdout = donce(dockerfile: "FROM ubuntu\nCMD echo hello", log: Loog::NULL) { |_| sleep 0.1 }
|
|
78
|
-
assert_equal("hello\n", stdout)
|
|
79
|
-
end
|
|
80
|
-
end
|