tinyci 0.3.2 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8445b7ae2f18191cd7c5cb7612feba04b2f0ef20
4
- data.tar.gz: 4296892877900713e20279d66cc1a0a7df8d52ed
2
+ SHA256:
3
+ metadata.gz: 67c0c2cdfc2c4897dd17a0d9d3c19ea63a416726f8df3a35b355a344f7a966fd
4
+ data.tar.gz: b77bd08bdab867aec1c9ec02057d8519b55c9b23ca0f504afc74bb6b83e01165
5
5
  SHA512:
6
- metadata.gz: 386fdbdbb0cdfd4f35632807044e35c3c7e0c36ecfba328d539d52971799168211a9a19b652631895e02e4897a7c14379a900c78565104b153a214181501fd75
7
- data.tar.gz: 814edf8e891fc8810eb125b9f6cfd15164179946a56d65e06dbd4440c4b5c44eef356a9ae831d7af2bf110e7e8aa1524bfd8511d7a5a5f000ccf3f333c322729
6
+ metadata.gz: 66b4ef9b258a6381a78af29a69904d33655bb7d1970740449ad21c823fc084883bd12ce0d5bcdfaf1bdf364b49918156c27cc243797c6868fb0a35d8544c402e
7
+ data.tar.gz: 60cd46b3b67adf5473202b6d392d5b6897c7f7deb4f5017fc2f57a6433e4af4d67cec99655d22c28478f05a648338d0165f65b46ef5c99abba048e8d0dc7e4aa
data/.gitignore CHANGED
@@ -6,3 +6,7 @@ spec/examples.txt
6
6
  tmp
7
7
  pkg
8
8
  coverage
9
+ .pry_history
10
+ .DS_Store
11
+ rubocop.txt
12
+ spec/support/tmp
data/.rspec CHANGED
@@ -1,3 +1,5 @@
1
1
  --color
2
2
  --require spec_helper
3
3
  --order random
4
+ --format Fuubar
5
+ --format Nc
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.4.2
1
+ 2.6.1
data/.tinyci.yml CHANGED
@@ -1,8 +1,2 @@
1
- builder:
2
- class: ScriptBuilder
3
- config:
4
- command: docker build -t tinyci .
5
- tester:
6
- class: ScriptTester
7
- config:
8
- command: docker run tinyci bundle exec rspec --format documentation
1
+ build: docker build -t tinyci .
2
+ test: docker run tinyci bundle exec rspec --format documentation
data/.yardopts CHANGED
@@ -1 +1 @@
1
- --markup=markdown
1
+ --load lib/yard_plugin.rb
data/ARCHITECTURE.md ADDED
@@ -0,0 +1,38 @@
1
+ TinyCI Architecture
2
+ ===================
3
+
4
+ This document contains details about TinyCI's implementation.
5
+
6
+ ### Architecture
7
+
8
+ #### Requirements
9
+
10
+ TinyCI is written in ruby 2. It is tested against git 2.7.4, the version packaged for ubuntu 16.04.
11
+
12
+ It does not have a heavy dependency on ruby 2, mainly making use of convenient syntactic features. Porting to ruby 1.9 would be very simple.
13
+
14
+ #### Eligible Commits
15
+
16
+ When TinyCI is executed, it runs against all eligible commits, from oldest to newest. At the present time, all commits without any `tinyci-result` git-notes object attached are eligible. This means that the first time TinyCI executes, it will run against every commit in the repository's history.
17
+
18
+ While this is obviously suboptimal, note that if no configuration file is found, the exported copy of the commit is deleted and TinyCI moves on to the next commit, so this will not create a huge number of extraneous exports. It would be desirable to check for the presence of the config file before exporting the entire commit with a call to `git-cat-file`, see [TODO.md](TODO.md)
19
+
20
+ #### Executor Classes
21
+
22
+ Building and Testing are done by subclasses of {TinyCI::Executor}. An instance of each is created for every commit TinyCI runs against. This enables "pluggable backends" for TinyCI. At present there is only the `ScriptBuilder` and `ScriptTester`, which just run a command specified in the config file.
23
+
24
+ #### Export Path
25
+
26
+ The export path is where exported copies of commits are placed. Currently it is hardcoded: a directory called `builds` is created under the repo root, or under the the `.git` directory in the case of a non-bare repository. Within this, for each commit a directory named after the datetime along with the commit hash is created, and inside there you will find an `export` directory which contains the tree exported from that commit.
27
+
28
+ #### Configuration
29
+
30
+ TinyCI is configured with a YAML file named `.tinyci.yml` in the root directory of the repo. There are two sections, one for the builder and one for the tester. Each has a `class` key which specifies the {TinyCI::Executor} subclass to be used, and a `config` key which contains specific configuration for that executor. This `config` object can contain anything, it is passed wholesale to the executor object. For an example, see below, or see the example project.
31
+
32
+ #### Execution Model
33
+
34
+ TinyCI uses a pidfile to guarantee only a single executing process at a time. This ensures that multiple team members committing to a repository concurrently, or rapid commits in succession by a single user do not result in multiple concurrent executions of the test suite.
35
+
36
+ Because TinyCI checks anew for eligible git objects to run against after each iteration of its main loop, and runs until no more are found, in the event of multiple commits being pushed concurrently, or further commits being pushed while an initial commit is still being built and tested, the first TinyCI instance will eventually execute against all commits.
37
+
38
+ It is of course possible that commits might be pushed consistently faster than they can be tested, resulting in a never-to-be-cleared backlog; if this is the case the a more substantial CI solution is probably advisable for your project.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ 0.4 - May 27, 2019
2
+ New, terser configuration format
3
+ `after_all` hook
4
+ Command interpolation
1
5
  0.3.2 - October 19, 2018
2
6
  Fix hook execution order
3
7
  0.3.1 - October 19, 2018
data/Dockerfile CHANGED
@@ -1,35 +1,22 @@
1
- FROM alpine:3.8
2
-
3
- RUN mkdir -p /etc \
4
- && { \
5
- echo 'install: --no-document'; \
6
- echo 'update: --no-document'; \
7
- } >> /etc/gemrc
8
-
9
- RUN apk add --no-cache -u \
10
- ruby \
11
- ruby-dev \
12
- ruby-irb \
13
- ruby-etc \
14
- libffi-dev \
1
+ FROM ruby:2.6.3-alpine3.9
2
+
3
+ RUN apk add --no-cache \
15
4
  build-base \
16
5
  git
17
6
 
18
7
  RUN git config --global user.email "you@example.com"
19
8
  RUN git config --global user.name "Your Name"
20
9
 
21
- # RUN ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime
22
-
23
- RUN gem install bundler
24
- RUN bundle config --global silence_root_warning 1
25
-
26
10
  WORKDIR /tmp
27
11
  ADD Gemfile Gemfile
28
12
  ADD Gemfile.lock Gemfile.lock
29
13
  ADD tinyci.gemspec tinyci.gemspec
30
14
  ADD lib/tinyci/version.rb lib/tinyci/version.rb
31
15
  ADD lib/tinyci/logo.txt lib/tinyci/logo.txt
32
- RUN bundle install
16
+
17
+ RUN gem update bundler
18
+
19
+ RUN bundle install --no-cache --jobs=4
33
20
 
34
21
  ADD . /tinyci
35
22
 
data/Gemfile.lock CHANGED
@@ -1,27 +1,25 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tinyci (0.3.2)
4
+ tinyci (0.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- ast (2.4.0)
10
- awesome_print (1.8.0)
11
9
  barrier (1.0.2)
12
- byebug (9.1.0)
10
+ byebug (11.0.1)
13
11
  coderay (1.1.2)
14
12
  diff-lcs (1.3)
15
13
  docile (1.3.1)
16
- ffi (1.9.25)
14
+ ffi (1.10.0)
17
15
  formatador (0.2.5)
18
- fuubar (2.2.0)
16
+ fuubar (2.3.2)
19
17
  rspec-core (~> 3.0)
20
18
  ruby-progressbar (~> 1.4)
21
- guard (2.14.1)
19
+ guard (2.15.0)
22
20
  formatador (>= 0.2.4)
23
21
  listen (>= 2.7, < 4.0)
24
- lumberjack (~> 1.0)
22
+ lumberjack (>= 1.0.12, < 2.0)
25
23
  nenv (~> 0.1)
26
24
  notiffany (~> 0.0)
27
25
  pry (>= 0.9.12)
@@ -32,33 +30,30 @@ GEM
32
30
  guard (~> 2.1)
33
31
  guard-compat (~> 1.1)
34
32
  rspec (>= 2.99.0, < 4.0)
35
- jaro_winkler (1.5.1)
36
- json (2.1.0)
33
+ json (2.2.0)
37
34
  listen (3.1.5)
38
35
  rb-fsevent (~> 0.9, >= 0.9.4)
39
36
  rb-inotify (~> 0.9, >= 0.9.7)
40
37
  ruby_dep (~> 1.2)
41
- lumberjack (1.0.12)
42
- method_source (0.9.0)
38
+ lumberjack (1.0.13)
39
+ method_source (0.9.2)
43
40
  nenv (0.3.0)
44
41
  notiffany (0.1.1)
45
42
  nenv (~> 0.1)
46
43
  shellany (~> 0.0)
47
- parallel (1.12.1)
48
- parser (2.5.1.2)
49
- ast (~> 2.4.0)
50
- powerpack (0.1.2)
51
- pry (0.11.1)
44
+ pry (0.12.2)
52
45
  coderay (~> 1.1.0)
53
46
  method_source (~> 0.9.0)
54
- pry-byebug (3.5.0)
55
- byebug (~> 9.1)
47
+ pry-byebug (3.7.0)
48
+ byebug (~> 11.0)
56
49
  pry (~> 0.10)
57
- rainbow (3.0.0)
58
- rake (12.1.0)
59
- rb-fsevent (0.10.2)
60
- rb-inotify (0.9.10)
61
- ffi (>= 0.5.0, < 2)
50
+ pry-doc (1.0.0)
51
+ pry (~> 0.11)
52
+ yard (~> 0.9.11)
53
+ rake (12.3.2)
54
+ rb-fsevent (0.10.3)
55
+ rb-inotify (0.10.0)
56
+ ffi (~> 1.0)
62
57
  redcarpet (3.4.0)
63
58
  rspec (3.8.0)
64
59
  rspec-core (~> 3.8.0)
@@ -66,7 +61,7 @@ GEM
66
61
  rspec-mocks (~> 3.8.0)
67
62
  rspec-core (3.8.0)
68
63
  rspec-support (~> 3.8.0)
69
- rspec-expectations (3.8.1)
64
+ rspec-expectations (3.8.3)
70
65
  diff-lcs (>= 1.2.0, < 2.0)
71
66
  rspec-support (~> 3.8.0)
72
67
  rspec-mocks (3.8.0)
@@ -76,15 +71,7 @@ GEM
76
71
  rspec (>= 3)
77
72
  terminal-notifier (>= 1.4)
78
73
  rspec-support (3.8.0)
79
- rubocop (0.59.2)
80
- jaro_winkler (~> 1.5.1)
81
- parallel (~> 1.10)
82
- parser (>= 2.5, != 2.5.1.1)
83
- powerpack (~> 0.1)
84
- rainbow (>= 2.2.2, < 4.0)
85
- ruby-progressbar (~> 1.7)
86
- unicode-display_width (~> 1.0, >= 1.0.1)
87
- ruby-progressbar (1.8.1)
74
+ ruby-progressbar (1.10.0)
88
75
  ruby_dep (1.5.0)
89
76
  shellany (0.0.1)
90
77
  simplecov (0.16.1)
@@ -92,32 +79,28 @@ GEM
92
79
  json (>= 1.8, < 3)
93
80
  simplecov-html (~> 0.10.0)
94
81
  simplecov-html (0.10.2)
95
- terminal-notifier (1.7.1)
96
- thor (0.20.0)
97
- unicode-display_width (1.4.0)
98
- yard (0.9.12)
82
+ terminal-notifier (1.7.2)
83
+ thor (0.20.3)
84
+ yard (0.9.19)
99
85
 
100
86
  PLATFORMS
101
87
  ruby
102
88
 
103
89
  DEPENDENCIES
104
- awesome_print
105
90
  barrier
106
- bundler (~> 1.14)
107
- ffi (>= 1.9.24)
108
91
  fuubar
109
92
  guard-rspec
110
93
  pry
111
94
  pry-byebug
95
+ pry-doc
112
96
  rake
113
97
  redcarpet
114
- rspec
98
+ rspec (>= 3.8.0)
115
99
  rspec-nc
116
- rubocop
117
100
  simplecov
118
- terminal-notifier (= 1.7.1)
101
+ terminal-notifier (= 1.7.2)
119
102
  tinyci!
120
103
  yard
121
104
 
122
105
  BUNDLED WITH
123
- 1.16.3
106
+ 2.0.1
data/Guardfile CHANGED
@@ -4,4 +4,5 @@ guard :rspec, cmd: "bundle exec rspec", all_after_pass: true, all_on_start: true
4
4
  watch(%r{^lib\/tinyci\/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
5
5
  watch(%r{spec\/support\/.+}) { "spec" }
6
6
  watch(%r{^spec\/.+_spec\.rb$})
7
+ ignore 'coverage'
7
8
  end
@@ -1,4 +1,4 @@
1
- Copyright (c) 2018 Jonathan Davies
1
+ Copyright (c) 2019 Jonathan Davies
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -16,62 +16,41 @@ RDoc documentation is available at [rubydoc.org](https://www.rubydoc.info/gems/t
16
16
 
17
17
  Existing CI solutions like [Travis](https://travis-ci.org) and [Jenkins](https://jenkins.io) run as daemons requiring large amounts of RAM, typically in their own virtual machines. In particular Travis and systems like it are designed as SaaS products, and it's not really feasible to self-host them.
18
18
 
19
- A more lightweight system was desired, for use with small scale personal projects.
19
+ A more lightweight system was desired, for use with small-scale personal projects.
20
20
 
21
- ### Architecture
22
-
23
- #### Requirements
24
-
25
- TinyCI is written in ruby 2. It is not known exactly how recent a version of git is required, however development and testing was carried out against 2.7.4, the version packaged for ubuntu 16.04.
26
-
27
- It does not have a heavy dependency on ruby 2, mainly making use of convenient syntactic features. Porting to ruby 1.9 would be very simple.
28
-
29
- #### Stages
30
-
31
- TinyCI is executed via git `post-update` hooks. When a new commit is pushed, the following steps are executed:
32
-
33
- 1. Clean
34
- The [export path](#Export_Path) is removed
35
- 2. Export
36
- A clean copy of the commit is placed at the [export path](#Export_Path). Clean in this context means without any .git directory or similar.
37
- 3. Build
38
- The project's build command is executed
39
- 4. Test
40
- The project's test command is executed
41
-
42
- Finally the result is stored in git using the [git-notes](https://git-scm.com/docs/git-notes) feature. This is how TinyCI determines which commits to run against.
43
-
44
- #### Eligible Commits
45
-
46
- When TinyCI is executed, it runs against all eligible commits, from oldest to newest. At the present time, all commits without any `tinyci-result` git-notes object attached are eligible. This means that the first time TinyCI executes, it will run against every commit in the repository's history.
47
-
48
- While this is obviously suboptimal, note that if no configuration file is found, the exported copy of the commit is deleted and TinyCI moves on to the next commit, so this will not create a huge number of extraneous exports. It would be desirable to check for the presence of the config file before exporting the entire commit with a call to `git-cat-file`, see the [TODO section](#Limitations_TODO) below.
49
-
50
- #### Executor Classes
51
-
52
- Building and Testing are done by subclasses of {TinyCI::Executor}. An instance of each is created for every commit TinyCI runs against. This enables "pluggable backends" for TinyCI. At present there is only the `ScriptBuilder` and `ScriptTester`, which just run a command specified in the config file.
21
+ ### Usage
53
22
 
54
- #### Export Path
23
+ TinyCI works by installing a `post-update` hook into your remote repository. When a commit containing a TinyCI config file is pushed, the commit is exported and commands are executed as defined in the config.
55
24
 
56
- The export path is the location where exported copies of commits are placed. Currently it is hardcoded as a directory called `builds` under the repo root, or under the the `.git` directory in the case of a non-bare repository.
25
+ #### Instructions
57
26
 
58
- #### Configuration
27
+ First, add a configuration file to your project with the name `.tinyci.yml`:
59
28
 
60
- TinyCI is configured with a YAML file named `.tinyci.yml` in the root directory of the repo. There are two sections, one for the builder and one for the tester. Each has a `class` key which specifies the {TinyCI::Executor} subclass to be used, and a `config` key which contains specific configuration for that executor. This `config` object can contain anything, it is passed wholesale to the executor object. For an example, see below, or see the example project.
29
+ cat <<EOF > .tinyci.yml
30
+ build: ./build.sh
31
+ test: ./test.sh
32
+ EOF
61
33
 
62
- #### Execution Model
34
+ This config assumes you have files called `build.sh` and `test.sh` in the root of your project that execute the appropriate commands.
63
35
 
64
- TinyCI uses a pidfile to guarantee only a single executing process at a time. This ensures that multiple team members committing to a repository concurrently, or rapid commits in succession by a single user do not result in multiple concurrent executions of the test suite.
36
+ TinyCI is distributed as a ruby gem. Install it like so:
65
37
 
66
- Because TinyCI checks anew for eligible git objects to run against after each iteration of its main loop, and runs until no more are found, in the event of multiple commits being pushed concurrently, or further commits being pushed while an initial commit is still being built and tested, the first TinyCI instance will eventually execute against all commits.
38
+ gem install tinyci
39
+
40
+ The gem should be installed on the remote server where you want the tests to execute. On that server, install TinyCI into your repository with the install command:
67
41
 
68
- It is of course possible that commits might be pushed consistently faster than they can be tested, resulting in a never-to-be-cleared backlog; if this is the case the a more substantial CI solution is probably advisable for your project.
42
+ tinyci install
43
+
44
+ Now, commit the configuration file and push it to your remote repository. After some initial extraneous output (depending on the size of your repo's history,) you will see your build and test commands executed.
69
45
 
70
- If you look in the source code you will also find `RktBuilder` and `RktTester`, these were experimental attempts to integrate the Rkt container runtime. They are not recommended for use but are left for users to examine.
46
+ #### Example Project
71
47
 
72
- #### Hooks
48
+ There is an example project available at https://github.com/JonnieCache/tinyci-example
49
+
50
+ See that repo for a walkthrough demonstrating various TinyCI features.
73
51
 
74
- TinyCI supports hooks/callbacks, much like git itself. Here is the order of execution:
52
+ #### Stages
53
+ Here is a brief overview of the operations TinyCI goes through when processing a commit:
75
54
 
76
55
  ```
77
56
  * clean
@@ -81,35 +60,77 @@ TinyCI supports hooks/callbacks, much like git itself. Here is the order of exec
81
60
 
82
61
  * build
83
62
 
84
- after_build
85
63
  after_build_success
86
64
  after_build_failure
65
+ after_build
87
66
 
88
67
  before_test
89
68
 
90
69
  * test
91
70
 
92
- after_test
93
71
  after_test_success
94
72
  after_test_failure
73
+ after_test
74
+
75
+ after_all
95
76
  ```
96
-
97
77
  `*` indicates an actual phase of TinyCI's execution, the rest are callbacks.
98
78
 
79
+ 1. **Clean**
80
+ The [export path](ARCHITECTURE.md#Export_Path) is removed.
81
+ 2. **Export**
82
+ A clean copy of the commit is placed at the [export path](ARCHITECTURE.md#Export_Path). Clean in this context means without any `.git` directory or similar.
83
+ 3. `before_build`
84
+ The `before_build` hook is executed, and processing halts if the hook fails.
85
+ 4. **Build**
86
+ The project's build command is executed.
87
+ 5. `after_build_success`
88
+ If the build completed successfully, the `after_build_success` hook is executed.
89
+ 6. `after_build_failure`
90
+ If the build failed, the `after_build_failure` hook is executed.
91
+ 7. `before_test`
92
+ The `before_test` hook is executed, and processing halts if the hook fails.
93
+ 8. **Test**
94
+ The project's test command is executed.
95
+ 9. `after_test_success`
96
+ If the test completed successfully, the `after_test_success` hook is executed.
97
+ 10. `after_test_failure`
98
+ If the test failed, the `after_test_failure` hook is executed.
99
+ 11. `after_all`
100
+ The `after_all` hook is always exectued as the final stage of processing.
101
+
102
+ Finally the result is stored in git using the [git-notes](https://git-scm.com/docs/git-notes) feature. This is how TinyCI determines which commits to run against.
103
+
99
104
  Note that the `before_build` and `before_test` hooks will halt the processing of the commit completely if they fail (ie. return a status > 0)
100
105
 
106
+ The `after_all` hook runs at the end of a commit's processing, whether or not the build/test stages have succeeded or failed.
107
+
101
108
  To setup hooks, define a section like this in your config file:
102
109
 
103
110
  ```
104
- hooker:
105
- class: ScriptHooker
106
- config:
107
- after_build: ./after_build.sh
111
+ hooks:
112
+ after_build: ./after_build.sh
108
113
  ```
109
114
 
115
+ #### Interpolation
116
+
117
+ It is possible to interpolate values into the scripts defined in the TinyCI configuration file, using the [ERB](https://ruby-doc.org/stdlib/libdoc/erb/rdoc/ERB.html) syntax. Here is an example:
118
+
119
+ build: docker build -t app:<%= commit %> .
120
+ test: docker run app:<%= commit %> bundle exec rspec
121
+ hooks:
122
+ after_all: rm -rf <%= export %>
123
+
124
+ Here we are using the commit sha to tag our docker image, and then in our `after_all` hook we are removing the exported build directory, as in the docker use-case our build artifacts live in the local docker index.
125
+
126
+ The following variables are available for interpolation:
127
+
128
+ * `commit` the sha hash of the commit being processed
129
+ * `export` the absolute path to the commits exported tree
130
+
110
131
  #### Compactor
111
132
 
112
- With continued use, the `builds` directory will grow ever larger. TinyCI provides the `compact` command to deal with this. It compresses old builds into `.tar.gz` files.
133
+ With continued use, the [`builds`](ARCHITECTURE.md#Export_Path) directory will grow ever larger. TinyCI provides the `compact` command to deal with this. It compresses old builds into `.tar.gz` files.
113
134
 
114
135
  "Old" in this context is defined using two options to the `tinyci compact` command:
115
136
 
@@ -126,54 +147,13 @@ TinyCI is executed in a `post-update` git hook. As such, the output is shown to
126
147
 
127
148
  As well as logging to stdout, the TinyCI process writes a `tinyci.log` file in each exported directory.
128
149
 
129
- #### Limitations/TODO
130
-
131
- * As mentioned above, when TinyCI is executed against a commit without a configuration file, it exports the whole directory, finds the config file to be missing, then deletes the export. As such, when TinyCI installed against an existing project with many commits, this process will happen for every commit, wasting a lot of time and churning the disk.
132
- Instead, it would be preferable to check for the config file before doing the export, with a call to `git-cat-file`. An additional way to handle this would be to prevent the processing of commits created prior to the installation of TinyCI, perhaps by marking them with git-notes at install time, or by checking the creation date of the hook file.
133
-
134
- * Presently, if a user kills their local git process while TinyCI is running, it will continue to execute on the server. If they then push another commit, the original TinyCI process will go on to test the second commit as well, as expected. However, the output from the second git push will simply consist of an error message describing the behavior.
135
- Instead, this second TinyCI execution should begin tailing the output of the first process, perhaps gaining direct access to it's stdout stream.
136
-
137
- * It would be desirable to add a command to the TinyCI binary to SSH into the remote server and tail the the log output of a currently running TinyCI process, enabling functionality similar to that described in above, but without making a new commit.
138
-
139
- * More configuration options should be added, eg. specification of the export path.
140
-
141
- * In general, more local functionality for the TinyCI binary would be desirable, some way to retrieve the results of tests and query them from the local clone for example, or some way to show them in `git log` output.
142
-
143
- ### Usage
144
-
145
- #### Instructions
146
-
147
- First, add a configuration file to your project:
148
-
149
- cat <<EOF > .tinyci.yml
150
- builder:
151
- class: ScriptBuilder
152
- config:
153
- command: build.sh
154
- tester:
155
- class: ScriptTester
156
- config:
157
- command: test.sh
158
- EOF
159
-
160
- This config assumes you have files called `build.sh` and `test.sh` in the root of your project that execute the appropriate commands.
161
-
162
- TinyCI is distributed as a ruby gem. Install it like so:
163
-
164
- gem install tinyci
165
-
166
- The gem should be installed on the remote server where you want the tests to execute. On that server, install TinyCI into your repository with the install command:
150
+ ### Architecture
167
151
 
168
- tinyci install
169
-
170
- Now, commit the configuration file and push it to your remote repository. As discussed above, this will currently result in a large amount of output as every previous commit is exported, found to be missing a config file and then the export deleted. Eventually you will see your build and test scripts executed.
152
+ Implementation details are described in a separate document, [ARCHITECTURE.md](ARCHITECTURE.md)
171
153
 
172
- #### Example Project
154
+ ### Limitations/TODO
173
155
 
174
- There is an example project available at https://github.com/JonnieCache/tinyci-example.
175
-
176
- See that repo for a walkthrough demonstrating various TinyCI features.
156
+ See [TODO.md](TODO.md)
177
157
 
178
158
  ### Contributing
179
159
 
@@ -183,4 +163,4 @@ TinyCI has a suite of RSpec tests, please use them.
183
163
 
184
164
  ### Copyright
185
165
 
186
- Copyright (c) 2018 Jonathan Davies. See [LICENSE](LICENSE) for details.
166
+ Copyright (c) 2019 Jonathan Davies. See [LICENSE.md](LICENSE.md) for details.
data/TODO.md ADDED
@@ -0,0 +1,11 @@
1
+ * When TinyCI is executed against a commit without a configuration file, it exports the whole directory, finds the config file to be missing, then deletes the export. As such, when TinyCI installed against an existing project with many commits, this process will happen for every commit, wasting a lot of time and churning the disk.
2
+ Instead, it would be preferable to check for the config file before doing the export, with a call to `git-cat-file`. An additional way to handle this would be to prevent the processing of commits created prior to the installation of TinyCI, perhaps by marking them with git-notes at install time, or by checking the creation date of the hook file.
3
+
4
+ * Presently, if a user kills their local git process while TinyCI is running, it will continue to execute on the server. If they then push another commit, the original TinyCI process will go on to test the second commit as well, as expected. However, the output from the second git push will simply consist of an error message describing the behavior.
5
+ Instead, this second TinyCI execution should begin tailing the output of the first process, perhaps gaining direct access to it's stdout stream.
6
+
7
+ * It would be desirable to add a command to the TinyCI binary to SSH into the remote server and tail the the log output of a currently running TinyCI process, enabling functionality similar to that described in above, but without making a new commit.
8
+
9
+ * More configuration options should be added, eg. specification of the export path.
10
+
11
+ * In general, more local functionality for the TinyCI binary would be desirable, some way to retrieve the results of tests and query them from the local clone for example, or some way to show them in `git log` output.
@@ -4,7 +4,7 @@ module TinyCI
4
4
  module Builders
5
5
  class ScriptBuilder < TinyCI::Executor
6
6
  def build
7
- execute_stream(script_location, label: 'build', pwd: @config[:target])
7
+ execute_stream(command, label: 'build', pwd: @config[:export])
8
8
  end
9
9
  end
10
10
  end
data/lib/tinyci/cli.rb CHANGED
@@ -101,7 +101,7 @@ TXT
101
101
  def self.do_install(opts)
102
102
  logger = MultiLogger.new(quiet: opts[:quiet])
103
103
 
104
- TinyCI::Installer.new(logger: logger, working_dir: opts[:dir]).write!
104
+ TinyCI::Installer.new(logger: logger, working_dir: opts[:dir]).install!
105
105
  end
106
106
 
107
107
  def self.do_compact(opts)
data/lib/tinyci/config.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'tinyci/config_transformer'
1
2
  require 'tinyci/symbolize'
2
3
  require 'yaml'
3
4
 
@@ -5,6 +6,9 @@ module TinyCI
5
6
  # Represents the Configuration for a repo, parsed from the `.tinyci.yml` file in the repo root.
6
7
  # Mainly a wrapper around a the hash object parsed from the yaml in the config file.
7
8
  # The keys of the hash are recursively symbolized.
9
+ #
10
+ # As it is loaded, the configuration file data is passed through the {TinyCI::ConfigTransformer}
11
+ # class, which translates any definitions in the concise format into the more verbose format
8
12
  class Config
9
13
  include Symbolize
10
14
 
@@ -31,6 +35,8 @@ module TinyCI
31
35
  end
32
36
 
33
37
  # Return the raw hash representation
38
+ #
39
+ # @return [Hash] The configuration as a hash
34
40
  def to_hash
35
41
  config_content
36
42
  end
@@ -46,7 +52,11 @@ module TinyCI
46
52
  end
47
53
 
48
54
  def config_content
49
- @config_content ||= symbolize(YAML.safe_load(File.read(config_pathname))).freeze
55
+ @config_content ||= begin
56
+ config = YAML.safe_load(File.read(config_pathname))
57
+ transformed_config = ConfigTransformer.new(config).transform!
58
+ symbolize(transformed_config).freeze
59
+ end
50
60
  end
51
61
  end
52
62
 
@@ -0,0 +1,64 @@
1
+ module TinyCI
2
+ # Transforms the configuration format from the condensed format to the
3
+ # more verbose format accepted by the rest of the system
4
+ class ConfigTransformer
5
+
6
+ # Constructor
7
+ #
8
+ # @param [Hash] input The configuration object, in the condensed format
9
+ def initialize(input)
10
+ @input = input
11
+ end
12
+
13
+ # Transforms the config object
14
+ #
15
+ # @return [Hash] The config object in the verbose form
16
+ def transform!
17
+ @input.inject({}) do |acc, (key, value)|
18
+ method_name = "transform_#{key}"
19
+
20
+ if respond_to? method_name, true
21
+
22
+ acc.merge! send(method_name, value)
23
+ else
24
+ acc[key] = value
25
+ end
26
+
27
+ acc
28
+ end
29
+ end
30
+
31
+ private
32
+
33
+ def transform_build(value)
34
+ {
35
+ builder: {
36
+ :class => "ScriptBuilder",
37
+ config: {
38
+ command: value
39
+ }
40
+ }
41
+ }
42
+ end
43
+
44
+ def transform_test(value)
45
+ {
46
+ tester: {
47
+ :class => "ScriptTester",
48
+ config: {
49
+ command: value
50
+ }
51
+ }
52
+ }
53
+ end
54
+
55
+ def transform_hooks(value)
56
+ {
57
+ hooker: {
58
+ :class => "ScriptHooker",
59
+ config: value
60
+ }
61
+ }
62
+ end
63
+ end
64
+ end
@@ -1,5 +1,7 @@
1
1
  require 'tinyci/subprocesses'
2
2
  require 'tinyci/logging'
3
+ require 'ostruct'
4
+ require 'erb'
3
5
 
4
6
  module TinyCI
5
7
  # Parent class for Builder and Tester classes
@@ -18,11 +20,28 @@ module TinyCI
18
20
  @logger = logger
19
21
  end
20
22
 
23
+ def command
24
+ ['/bin/sh', '-c', "'#{interpolate(@config[:command])}'"]
25
+ end
26
+
21
27
  private
22
28
 
23
- def script_location
24
- # path = File.join @config[:target], @config[:command]
25
- ['/bin/sh', '-c', "'#{@config[:command]}'"]
29
+ def interpolate(command)
30
+ erb = ERB.new command
31
+
32
+ erb.result(erb_scope)
33
+ end
34
+
35
+ def template_vars
36
+ OpenStruct.new(
37
+ commit: @config[:commit],
38
+ export: @config[:export],
39
+ target: @config[:target]
40
+ )
41
+ end
42
+
43
+ def erb_scope
44
+ template_vars.instance_eval { binding }
26
45
  end
27
46
  end
28
47
  end
@@ -7,15 +7,19 @@ module TinyCI
7
7
  HOOKS = %w{
8
8
  before_build
9
9
 
10
- after_build
11
10
  after_build_success
12
11
  after_build_failure
13
12
 
13
+ after_build
14
+
14
15
  before_test
15
16
 
16
- after_test
17
17
  after_test_success
18
18
  after_test_failure
19
+
20
+ after_test
21
+
22
+ after_all
19
23
  }
20
24
 
21
25
  # Those hooks that will halt exectution if they fail
@@ -34,7 +38,7 @@ module TinyCI
34
38
 
35
39
  log_info "executing #{hook} hook..."
36
40
  begin
37
- execute_stream(script_location(hook), label: hook, pwd: @config[:target])
41
+ execute_stream(script_location(hook), label: hook, pwd: @config[:export])
38
42
 
39
43
  return true
40
44
  rescue SubprocessError => e
@@ -52,7 +56,7 @@ module TinyCI
52
56
  end
53
57
 
54
58
  def script_location(hook)
55
- ['/bin/sh', '-c', "'#{@config[hook.to_sym]}'"]
59
+ ['/bin/sh', '-c', "'#{interpolate(@config[hook.to_sym])}'"]
56
60
  end
57
61
  end
58
62
  end
@@ -17,7 +17,7 @@ module TinyCI
17
17
  end
18
18
 
19
19
  # Write the hook to the relevant path and make it executable
20
- def write!
20
+ def install!
21
21
  unless inside_repository?
22
22
  log_error "not currently in a git repository"
23
23
  return false
@@ -47,8 +47,9 @@ module TinyCI
47
47
  def hook_content
48
48
  <<-EOF
49
49
  #!/bin/sh
50
+ unset GIT_DIR
50
51
 
51
- tinyci run --all
52
+ #{Gem.bin_path('tinyci', 'tinyci')} run --all
52
53
  EOF
53
54
  end
54
55
  end
@@ -8,6 +8,8 @@ module TinyCI
8
8
  "[#{datetime.strftime "%T"}] #{msg}\n"
9
9
  end
10
10
 
11
+ LEVEL = Logger::INFO
12
+
11
13
  attr_accessor :quiet
12
14
 
13
15
  # Constructor
@@ -21,7 +23,7 @@ module TinyCI
21
23
 
22
24
  @stdout_logger = Logger.new($stdout)
23
25
  @stdout_logger.formatter = FORMAT
24
- @stdout_logger.level = Logger::INFO
26
+ @stdout_logger.level = LEVEL
25
27
  end
26
28
 
27
29
  def targets
@@ -36,7 +38,7 @@ module TinyCI
36
38
  if path
37
39
  @file_logger = Logger.new(path)
38
40
  @file_logger.formatter = FORMAT
39
- @file_logger.level = Logger::INFO
41
+ @file_logger.level = LEVEL
40
42
  end
41
43
  end
42
44
 
data/lib/tinyci/runner.rb CHANGED
@@ -6,9 +6,6 @@ require 'tinyci/config'
6
6
  require 'tinyci/builders/test_builder'
7
7
  require 'tinyci/testers/test_tester'
8
8
 
9
- require 'tinyci/builders/rkt_builder'
10
- require 'tinyci/testers/rkt_tester'
11
-
12
9
  require 'tinyci/builders/script_builder'
13
10
  require 'tinyci/testers/script_tester'
14
11
  require 'tinyci/hookers/script_hooker'
@@ -111,8 +108,6 @@ module TinyCI
111
108
  run_hook! :after_test
112
109
  end
113
110
 
114
-
115
-
116
111
  log_info "Finished #{@commit}"
117
112
  rescue => e
118
113
  raise e if ENV['TINYCI_ENV'] == 'test'
@@ -120,6 +115,8 @@ module TinyCI
120
115
  log_error e
121
116
  log_debug e.backtrace
122
117
  return false
118
+ ensure
119
+ run_hook! :after_all
123
120
  end
124
121
 
125
122
  true
@@ -157,13 +154,13 @@ module TinyCI
157
154
  # Instantiate the Builder object according to the class named in the config
158
155
  def instantiate_builder
159
156
  klass = TinyCI::Builders.const_get(@config[:builder][:class])
160
- klass.new(@config[:builder][:config].merge(target: export_path), logger: @logger)
157
+ klass.new(@config[:builder][:config].merge(target: target_path, export: export_path, commit: @commit), logger: @logger)
161
158
  end
162
159
 
163
160
  # Instantiate the Tester object according to the class named in the config
164
161
  def instantiate_tester
165
162
  klass = TinyCI::Testers.const_get(@config[:tester][:class])
166
- klass.new(@config[:tester][:config].merge(target: export_path), logger: @logger)
163
+ klass.new(@config[:tester][:config].merge(target: target_path, export: export_path, commit: @commit), logger: @logger)
167
164
  end
168
165
 
169
166
  # Instantiate the Hooker object according to the class named in the config
@@ -171,7 +168,7 @@ module TinyCI
171
168
  return nil unless @config[:hooker].is_a? Hash
172
169
 
173
170
  klass = TinyCI::Hookers.const_get(@config[:hooker][:class])
174
- klass.new(@config[:hooker][:config].merge(target: export_path), logger: @logger)
171
+ klass.new(@config[:hooker][:config].merge(target: target_path, export: export_path, commit: @commit), logger: @logger)
175
172
  end
176
173
 
177
174
  # Instantiate the {Config} object from the `.tinyci.yml` file in the exported directory
@@ -63,6 +63,8 @@ module TinyCI
63
63
  opts = {}
64
64
  opts[:chdir] = pwd unless pwd.nil?
65
65
 
66
+ log_debug "CMD: #{command.join(' ')}"
67
+
66
68
  Open3.popen2e(command.join(' '), opts) do |stdin, stdout_and_stderr, wait_thr|
67
69
  stdin.close
68
70
 
@@ -89,7 +91,7 @@ module TinyCI
89
91
  attr_reader :status
90
92
  attr_reader :command
91
93
 
92
- def initialize(label, command, status, message = "`#{label || command}` failed with status #{status.exitstatus}")
94
+ def initialize(label, command, status, message = "#{label}: `#{command}` failed with status #{status.exitstatus}")
93
95
  @status = status
94
96
  @command = command
95
97
  super(message)
@@ -4,7 +4,7 @@ module TinyCI
4
4
  module Testers
5
5
  class ScriptTester < TinyCI::Executor
6
6
  def test
7
- execute_stream(script_location, label: 'test', pwd: @config[:target])
7
+ execute_stream(command, label: 'test', pwd: @config[:export])
8
8
  end
9
9
  end
10
10
  end
@@ -1,3 +1,3 @@
1
1
  module TinyCI
2
- VERSION = "0.3.2"
2
+ VERSION = "0.4"
3
3
  end
@@ -0,0 +1,37 @@
1
+ require 'redcarpet'
2
+
3
+ # This file fixes the mismatch between how github handles links to other
4
+ # markdown files in the project vs. how yardoc handles them.
5
+
6
+ module YARD
7
+ module Templates
8
+ module Helpers
9
+ module HtmlHelper
10
+ class MDLinkRenderer < Redcarpet::Render::HTML
11
+ def link(link, title, contents)
12
+ if link.=~(/\.md(?:#\w+)?$/)
13
+ %(<a href="/docs/file/#{link}">#{contents}</a>)
14
+ elsif title
15
+ %(<a href="#{link}" title="#{title}"></a>)
16
+ else
17
+ %(<a href="#{link}">#{contents}</a>)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ class CompatMarkdown
26
+ attr_reader :to_html
27
+
28
+ def initialize(text)
29
+ renderer = YARD::Templates::Helpers::HtmlHelper::MDLinkRenderer.new
30
+ markdown = Redcarpet::Markdown.new(renderer, no_intra_emphasis: true, gh_blockcode: true, fenced_code_blocks: true, autolink: true)
31
+ @to_html = markdown.render(text)
32
+ end
33
+ end
34
+
35
+ helper = YARD::Templates::Helpers::MarkupHelper
36
+ helper.clear_markup_cache
37
+ helper::MARKUP_PROVIDERS[:markdown].unshift const: 'CompatMarkdown'
data/tinyci.gemspec CHANGED
@@ -34,20 +34,17 @@ Gem::Specification.new do |spec|
34
34
 
35
35
  spec.post_install_message = (LOGO % TinyCI::VERSION) + "\n"
36
36
 
37
- spec.add_development_dependency "bundler", "~> 1.14"
38
- spec.add_development_dependency 'awesome_print'
39
- spec.add_development_dependency 'rspec'
37
+ spec.add_development_dependency 'rspec', '>= 3.8.0'
40
38
  spec.add_development_dependency 'barrier'
41
39
  spec.add_development_dependency 'rake'
42
40
  spec.add_development_dependency 'yard'
43
41
  spec.add_development_dependency 'redcarpet'
44
42
  spec.add_development_dependency 'pry-byebug'
43
+ spec.add_development_dependency 'pry-doc'
45
44
  spec.add_development_dependency 'pry'
46
45
  spec.add_development_dependency 'guard-rspec'
47
46
  spec.add_development_dependency 'fuubar'
48
47
  spec.add_development_dependency 'simplecov'
49
48
  spec.add_development_dependency 'rspec-nc'
50
- spec.add_development_dependency 'terminal-notifier', '1.7.1'
51
- spec.add_development_dependency 'rubocop'
52
- spec.add_development_dependency 'ffi', '>= 1.9.24'
49
+ spec.add_development_dependency 'terminal-notifier', '1.7.2'
53
50
  end
metadata CHANGED
@@ -1,45 +1,31 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tinyci
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: '0.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Davies
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-19 00:00:00.000000000 Z
11
+ date: 2019-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.14'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.14'
27
- - !ruby/object:Gem::Dependency
28
- name: awesome_print
14
+ name: rspec
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - ">="
32
18
  - !ruby/object:Gem::Version
33
- version: '0'
19
+ version: 3.8.0
34
20
  type: :development
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
24
  - - ">="
39
25
  - !ruby/object:Gem::Version
40
- version: '0'
26
+ version: 3.8.0
41
27
  - !ruby/object:Gem::Dependency
42
- name: rspec
28
+ name: barrier
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - ">="
@@ -53,7 +39,7 @@ dependencies:
53
39
  - !ruby/object:Gem::Version
54
40
  version: '0'
55
41
  - !ruby/object:Gem::Dependency
56
- name: barrier
42
+ name: rake
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
45
  - - ">="
@@ -67,7 +53,7 @@ dependencies:
67
53
  - !ruby/object:Gem::Version
68
54
  version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
- name: rake
56
+ name: yard
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
59
  - - ">="
@@ -81,7 +67,7 @@ dependencies:
81
67
  - !ruby/object:Gem::Version
82
68
  version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
- name: yard
70
+ name: redcarpet
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
73
  - - ">="
@@ -95,7 +81,7 @@ dependencies:
95
81
  - !ruby/object:Gem::Version
96
82
  version: '0'
97
83
  - !ruby/object:Gem::Dependency
98
- name: redcarpet
84
+ name: pry-byebug
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
87
  - - ">="
@@ -109,7 +95,7 @@ dependencies:
109
95
  - !ruby/object:Gem::Version
110
96
  version: '0'
111
97
  - !ruby/object:Gem::Dependency
112
- name: pry-byebug
98
+ name: pry-doc
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
101
  - - ">="
@@ -198,42 +184,14 @@ dependencies:
198
184
  requirements:
199
185
  - - '='
200
186
  - !ruby/object:Gem::Version
201
- version: 1.7.1
187
+ version: 1.7.2
202
188
  type: :development
203
189
  prerelease: false
204
190
  version_requirements: !ruby/object:Gem::Requirement
205
191
  requirements:
206
192
  - - '='
207
193
  - !ruby/object:Gem::Version
208
- version: 1.7.1
209
- - !ruby/object:Gem::Dependency
210
- name: rubocop
211
- requirement: !ruby/object:Gem::Requirement
212
- requirements:
213
- - - ">="
214
- - !ruby/object:Gem::Version
215
- version: '0'
216
- type: :development
217
- prerelease: false
218
- version_requirements: !ruby/object:Gem::Requirement
219
- requirements:
220
- - - ">="
221
- - !ruby/object:Gem::Version
222
- version: '0'
223
- - !ruby/object:Gem::Dependency
224
- name: ffi
225
- requirement: !ruby/object:Gem::Requirement
226
- requirements:
227
- - - ">="
228
- - !ruby/object:Gem::Version
229
- version: 1.9.24
230
- type: :development
231
- prerelease: false
232
- version_requirements: !ruby/object:Gem::Requirement
233
- requirements:
234
- - - ">="
235
- - !ruby/object:Gem::Version
236
- version: 1.9.24
194
+ version: 1.7.2
237
195
  description: A minimal Continuous Integration system, written in ruby, powered by
238
196
  git
239
197
  email:
@@ -249,22 +207,24 @@ files:
249
207
  - ".ruby-version"
250
208
  - ".tinyci.yml"
251
209
  - ".yardopts"
210
+ - ARCHITECTURE.md
252
211
  - CHANGELOG.md
253
212
  - Dockerfile
254
213
  - Gemfile
255
214
  - Gemfile.lock
256
215
  - Guardfile
257
- - LICENSE
216
+ - LICENSE.md
258
217
  - README.md
259
218
  - Rakefile
219
+ - TODO.md
260
220
  - bin/tinyci
261
221
  - lib/pidfile.rb
262
- - lib/tinyci/builders/rkt_builder.rb
263
222
  - lib/tinyci/builders/script_builder.rb
264
223
  - lib/tinyci/builders/test_builder.rb
265
224
  - lib/tinyci/cli.rb
266
225
  - lib/tinyci/compactor.rb
267
226
  - lib/tinyci/config.rb
227
+ - lib/tinyci/config_transformer.rb
268
228
  - lib/tinyci/executor.rb
269
229
  - lib/tinyci/git_utils.rb
270
230
  - lib/tinyci/hookers/script_hooker.rb
@@ -276,10 +236,10 @@ files:
276
236
  - lib/tinyci/scheduler.rb
277
237
  - lib/tinyci/subprocesses.rb
278
238
  - lib/tinyci/symbolize.rb
279
- - lib/tinyci/testers/rkt_tester.rb
280
239
  - lib/tinyci/testers/script_tester.rb
281
240
  - lib/tinyci/testers/test_tester.rb
282
241
  - lib/tinyci/version.rb
242
+ - lib/yard_plugin.rb
283
243
  - tinyci.gemspec
284
244
  homepage: https://github.com/JonnieCache/tinyci
285
245
  licenses:
@@ -288,7 +248,7 @@ metadata:
288
248
  allowed_push_host: https://rubygems.org
289
249
  post_install_message: " _____ _ _____ _____\n/__ (_)_ __ _ _ /
290
250
  ___/ /_ _/\n | || | '_ \\| | | |/ / / /\n | || | | | | |_| / /___/\\/ /_
291
- \ \n |_||_|_| |_|\\__, \\____/\\____/ 0.3.2\n |___/\n\n"
251
+ \ \n |_||_|_| |_|\\__, \\____/\\____/ 0.4\n |___/\n\n"
292
252
  rdoc_options: []
293
253
  require_paths:
294
254
  - lib
@@ -303,8 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
303
263
  - !ruby/object:Gem::Version
304
264
  version: '0'
305
265
  requirements: []
306
- rubyforge_project:
307
- rubygems_version: 2.6.13
266
+ rubygems_version: 3.0.3
308
267
  signing_key:
309
268
  specification_version: 4
310
269
  summary: A minimal Continuous Integration system, written in ruby, powered by git
@@ -1,31 +0,0 @@
1
- require 'tinyci/executor'
2
-
3
- module TinyCI
4
- module Builders
5
- class RktBuilder < TinyCI::Executor
6
- def build
7
- cmd = [
8
- 'sudo',
9
- 'rkt',
10
- 'run',
11
- '--net=host',
12
- '--insecure-options=image',
13
- '--volume',
14
- "src,kind=host,source=#{@config[:target]}/src,readOnly=false",
15
- '--mount',
16
- "volume=src,target=#{@config[:src_path]}",
17
- @config[:image],
18
- '--working-dir',
19
- @config[:src_path],
20
- '--exec',
21
- @config[:command]
22
- ]
23
-
24
- log_info "RKT build command: #{cmd.join(' ')}"
25
-
26
- execute_stream(*cmd, label: 'build')
27
- end
28
-
29
- end
30
- end
31
- end
@@ -1,40 +0,0 @@
1
- require 'tinyci/executor'
2
-
3
- module TinyCI
4
- module Testers
5
- class RktTester < TinyCI::Executor
6
- def test
7
- cmd = [
8
- 'sudo',
9
- 'rkt',
10
- 'run',
11
- '--net=host',
12
- '--insecure-options=image',
13
- '--volume',
14
- "src,kind=host,source=#{@config[:target]}/src,readOnly=false",
15
- '--mount',
16
- "volume=src,target=#{@config[:src_path]}",
17
- @config[:image],
18
- '--working-dir',
19
- @config[:src_path],
20
- set_env,
21
- '--exec',
22
- @config[:command]
23
- ].flatten
24
-
25
- log_info "RKT test command: #{cmd.join(' ')}"
26
-
27
- execute_stream(*cmd, label: 'test')
28
-
29
- end
30
-
31
- private
32
-
33
- def set_env
34
- return [] if @config[:env].nil?
35
-
36
- @config[:env].map {|k,v| "--set-env=#{k.upcase}=#{v}"}
37
- end
38
- end
39
- end
40
- end