rake-compiler-dock 1.2.1 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99e2b1ce6f914bd9b6449320d1c65bb5ac3cdd7f9afcf0189ee15a48e0bd8aac
4
- data.tar.gz: 661f6b93c01a36993f89f121d1316d999c3e2f61fa7d577660a1e9d6a5898ff4
3
+ metadata.gz: d0c53a8e4fde2b4ad57875b1e8ca11037cb9d9f101b451aaea52cdcef60dc56c
4
+ data.tar.gz: 9be653f556704bc9725aeec603c45a83491f62dd71b7e5b5e4eccd1635864a4a
5
5
  SHA512:
6
- metadata.gz: 3a4639688aeeb8c3b6d0142fadcf6c088f86f3672aca2873df1af672b22b7cff93245905ac6b00aac0c4467f495a5df6d9309f3660bbf27ee8f98d3dc47d8b92
7
- data.tar.gz: bbc042289e0ad041c42a5b6fd13ee55930546535505e59d310c11d7b9a0130718f5c84f78bc6b539437b58e1329ad2a5a2e082125fffeefd40f6173df739eab1
6
+ metadata.gz: 0c56bc4e310a1b5eb278ceb1da8b06a6bdbea9be2ddd6acf3be2c509afe60f542b8171e1c88cdcc6df9e21087028d91df1b46763f15c571d8ca71d4be6fdddc7
7
+ data.tar.gz: 2b2a2504d952cfe709cf0dece45d8ef7c83ac768af42eac27ec888a36c913c9e5d2b07f0e90bdb839945d3d4570b6ada0abb01b797e1e6a5249a521c83d59a88
@@ -1,37 +1,49 @@
1
- name: Build docker images
1
+ name: CI
2
2
  concurrency:
3
3
  group: "${{github.workflow}}-${{github.ref}}"
4
4
  cancel-in-progress: true
5
- on: [push, pull_request]
5
+ on:
6
+ workflow_dispatch:
7
+ schedule:
8
+ - cron: "0 5 * * 3" # At 05:00 on Wednesday # https://crontab.guru/#0_5_*_*_3
9
+ push:
10
+ branches:
11
+ - master
12
+ tags:
13
+ - "*.*.*"
14
+ pull_request:
15
+ types: [opened, synchronize]
16
+ branches:
17
+ - "*"
6
18
 
7
19
  jobs:
8
20
  # These jobs use Buildx layer caching
9
21
  docker_build:
10
- name: Build
22
+ name: build image
11
23
 
12
24
  strategy:
13
25
  fail-fast: false
14
26
  matrix:
15
- include:
16
- - platform: x86-mingw32
17
- - platform: x64-mingw-ucrt
18
- - platform: x64-mingw32
19
- - platform: x86-linux
20
- - platform: x86_64-linux
21
- - platform: x86_64-darwin
22
- - platform: arm64-darwin
23
- - platform: arm-linux
24
- - platform: aarch64-linux
25
- - platform: jruby
27
+ platform:
28
+ - x86-mingw32
29
+ - x64-mingw-ucrt
30
+ - x64-mingw32
31
+ - x86-linux
32
+ - x86_64-linux
33
+ - x86_64-darwin
34
+ - arm64-darwin
35
+ - arm-linux
36
+ - aarch64-linux
37
+ - jruby
26
38
 
27
39
  runs-on: ubuntu-latest
28
40
  env:
29
41
  PLATFORM: ${{ matrix.platform }}
30
42
  steps:
31
- - uses: actions/checkout@v2
43
+ - uses: actions/checkout@v3
32
44
 
33
45
  - name: Cache Docker layers
34
- uses: actions/cache@v2
46
+ uses: actions/cache@v3
35
47
  with:
36
48
  path: tmp/build-cache
37
49
  key: ${{ runner.os }}-${{ matrix.platform }}-buildx-${{ github.sha }}
@@ -47,83 +59,195 @@ jobs:
47
59
  run: |
48
60
  docker buildx create --driver docker-container --use
49
61
  bundle exec rake build:${PLATFORM} RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,src=tmp/build-cache --cache-to=type=local,dest=tmp/build-cache-new --load"
62
+ docker images
50
63
 
51
64
  - name: Move build cache and remove outdated layers
52
65
  run: |
53
66
  rm -rf tmp/build-cache
54
67
  mv tmp/build-cache-new tmp/build-cache
55
68
 
69
+ - name: Basic tests on the generated image
70
+ env:
71
+ TEST_PLATFORM: ${{ matrix.platform }}
72
+ run: |
73
+ bundle exec rake test
74
+
56
75
  - name: Build rcd_test.gem
57
76
  run: |
58
- gem build rake-compiler-dock.gemspec
59
- gem install -l rake-compiler-dock-*.gem
60
77
  cd test/rcd_test/
61
78
  bundle install
79
+ bundle exec rake clean clobber
62
80
  bundle exec rake gem:${PLATFORM}
63
81
 
64
82
  - name: Upload binary gem
65
- uses: actions/upload-artifact@v2
83
+ uses: actions/upload-artifact@v3
66
84
  with:
67
85
  name: gem-${{ matrix.platform }}
68
86
  path: test/rcd_test/pkg/*-*-*.gem
69
87
 
70
- - name: Upload source gem
71
- uses: actions/upload-artifact@v2
72
- if: matrix.platform == 'jruby'
88
+ - if: matrix.platform == 'jruby'
89
+ name: Upload source gem
90
+ uses: actions/upload-artifact@v3
73
91
  with:
74
92
  name: gem-ruby
75
93
  path: test/rcd_test/pkg/*-?.?.?.gem
76
94
 
95
+ - if: contains(matrix.platform, 'x64-mingw')
96
+ name: Build static rcd_test.gem for windows
97
+ env:
98
+ RCD_TEST_CONFIG: "--link-static"
99
+ run: |
100
+ gem build rake-compiler-dock.gemspec
101
+ gem install -l rake-compiler-dock-*.gem
102
+ cd test/rcd_test/
103
+ bundle install
104
+ bundle exec rake clean clobber
105
+ bundle exec rake gem:${PLATFORM}
106
+
107
+ - if: contains(matrix.platform, 'x64-mingw')
108
+ name: Upload static rcd_test.gem
109
+ uses: actions/upload-artifact@v3
110
+ with:
111
+ name: gem-${{ matrix.platform }}-static
112
+ path: test/rcd_test/pkg/*-*-*.gem
113
+
114
+ job_test_source:
115
+ name: source gem
116
+ needs: docker_build
117
+ strategy:
118
+ fail-fast: false
119
+ matrix:
120
+ os:
121
+ - ubuntu
122
+ ruby:
123
+ - "3.2"
124
+ - "3.1"
125
+ - "3.0"
126
+ - "2.7"
127
+ - "2.6"
128
+ - "2.5"
129
+ - "2.4"
130
+ runs-on: ${{ matrix.os }}-latest
131
+ steps:
132
+ - uses: actions/checkout@v3
133
+ - uses: ruby/setup-ruby@v1
134
+ with:
135
+ ruby-version: ${{ matrix.ruby }}
136
+ - name: Download gem-ruby
137
+ uses: actions/download-artifact@v3
138
+ with:
139
+ name: gem-ruby
140
+ - name: Install gem-ruby
141
+ run: gem install --local *.gem --verbose
142
+ - name: Run tests
143
+ run: |
144
+ cd test/rcd_test/
145
+ bundle install
146
+ ruby -rrcd_test -S rake test
77
147
 
78
148
  job_test_native:
79
- name: Test
149
+ name: native
80
150
  needs: docker_build
81
151
  strategy:
82
152
  fail-fast: false
83
153
  matrix:
154
+ os:
155
+ - windows
156
+ - macos
157
+ - ubuntu
158
+ ruby:
159
+ - "3.2"
160
+ - "3.1"
161
+ - "3.0"
162
+ - "2.7"
163
+ - "2.6"
164
+ - "2.5"
165
+ - "2.4"
84
166
  include:
85
167
  - os: windows
86
- ruby: "3.0"
87
168
  platform: x64-mingw32
88
- - os: windows
89
- ruby: "2.4"
90
- platform: x64-mingw32
91
- - os: macos
92
- ruby: "3.0"
93
- platform: x86_64-darwin
94
169
  - os: macos
95
- ruby: "2.4"
96
170
  platform: x86_64-darwin
97
171
  - os: ubuntu
98
- ruby: "3.0"
99
- platform: x86_64-linux
100
- - os: ubuntu
101
- ruby: "2.4"
102
172
  platform: x86_64-linux
103
173
  - os: ubuntu
104
174
  ruby: jruby-head
105
175
  platform: jruby
106
- - os: ubuntu
107
- ruby: "3.0"
108
- platform: ruby
176
+ - os: windows
177
+ ruby: "3.1"
178
+ platform: x64-mingw-ucrt
179
+ - os: windows
180
+ ruby: "3.2"
181
+ platform: x64-mingw-ucrt
182
+ exclude:
183
+ - os: windows
184
+ ruby: "3.1"
185
+ - os: windows
186
+ ruby: "3.2"
109
187
 
110
188
  runs-on: ${{ matrix.os }}-latest
111
189
  steps:
112
- - uses: actions/checkout@v2
113
- - name: Set up Ruby
114
- uses: ruby/setup-ruby@v1
190
+ - uses: actions/checkout@v3
191
+ - uses: ruby/setup-ruby@v1
115
192
  with:
116
193
  ruby-version: ${{ matrix.ruby }}
117
-
118
194
  - run: ruby --version
119
-
120
- - name: Download gem from build job
121
- uses: actions/download-artifact@v2
195
+ - name: Download gem-${{matrix.platform}}
196
+ uses: actions/download-artifact@v3
122
197
  with:
123
198
  name: gem-${{ matrix.platform }}
199
+ - name: Install gem-${{matrix.platform}}
200
+ run: gem install --local *.gem --verbose
201
+ - name: Run tests
202
+ run: |
203
+ cd test/rcd_test/
204
+ bundle install
205
+ ruby -rrcd_test -S rake test
124
206
 
125
- - run: gem install --local *.gem --verbose
207
+ job_test_native_static:
208
+ name: native static
209
+ needs: docker_build
210
+ strategy:
211
+ fail-fast: false
212
+ matrix:
213
+ os:
214
+ - windows
215
+ ruby:
216
+ - "3.2"
217
+ - "3.1"
218
+ - "3.0"
219
+ - "2.7"
220
+ - "2.6"
221
+ - "2.5"
222
+ - "2.4"
223
+ include:
224
+ - os: windows
225
+ platform: x64-mingw32
226
+ - os: windows
227
+ ruby: "3.1"
228
+ platform: x64-mingw-ucrt
229
+ - os: windows
230
+ ruby: "3.2"
231
+ platform: x64-mingw-ucrt
232
+ exclude:
233
+ - os: windows
234
+ ruby: "3.1"
235
+ - os: windows
236
+ ruby: "3.2"
126
237
 
238
+ runs-on: ${{ matrix.os }}-latest
239
+ steps:
240
+ - uses: actions/checkout@v3
241
+ - uses: ruby/setup-ruby@v1
242
+ with:
243
+ ruby-version: ${{ matrix.ruby }}
244
+ - run: ruby --version
245
+ - name: Download gem-${{matrix.platform}}-static
246
+ uses: actions/download-artifact@v3
247
+ with:
248
+ name: gem-${{ matrix.platform }}-static
249
+ - name: Install gem-${{matrix.platform}}-static
250
+ run: gem install --local *.gem --verbose
127
251
  - name: Run tests
128
252
  run: |
129
253
  cd test/rcd_test/
@@ -131,7 +255,7 @@ jobs:
131
255
  ruby -rrcd_test -S rake test
132
256
 
133
257
  job_test_multiarch:
134
- name: Test
258
+ name: multiarch (${{matrix.platform}} on ${{matrix.from_image}})
135
259
  needs: docker_build
136
260
  strategy:
137
261
  fail-fast: false
@@ -155,12 +279,11 @@ jobs:
155
279
 
156
280
  runs-on: ubuntu-latest
157
281
  steps:
158
- - uses: actions/checkout@v2
159
- - name: Download gem from build job
160
- uses: actions/download-artifact@v2
282
+ - uses: actions/checkout@v3
283
+ - name: Download gem-${{matrix.platform}}
284
+ uses: actions/download-artifact@v3
161
285
  with:
162
286
  name: gem-${{ matrix.platform }}
163
-
164
287
  - name: Build image and Run tests
165
288
  run: |
166
289
  docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
@@ -0,0 +1,67 @@
1
+ name: Publish docker images to GHCR
2
+ concurrency:
3
+ group: "${{github.workflow}}-${{github.ref}}"
4
+ cancel-in-progress: true
5
+ on:
6
+ workflow_dispatch:
7
+ schedule:
8
+ - cron: "0 3 * * 3" # At 03:00 on Wednesday # https://crontab.guru/#0_3_*_*_3
9
+
10
+ jobs:
11
+ build:
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ platform:
16
+ - x86-mingw32
17
+ - x64-mingw-ucrt
18
+ - x64-mingw32
19
+ - x86-linux
20
+ - x86_64-linux
21
+ - x86_64-darwin
22
+ - arm64-darwin
23
+ - arm-linux
24
+ - aarch64-linux
25
+ - jruby
26
+ runs-on: ubuntu-latest
27
+ steps:
28
+ - uses: actions/checkout@v3
29
+ - name: Use cache from primary pipeline
30
+ uses: actions/cache@v3
31
+ with:
32
+ path: tmp/build-cache
33
+ key: ${{runner.os}}-${{matrix.platform}}-buildx-${{github.sha}}
34
+ restore-keys: |
35
+ ${{runner.os}}-${{matrix.platform}}-buildx
36
+ - uses: ruby/setup-ruby@v1
37
+ with:
38
+ ruby-version: "3.1"
39
+ bundler-cache: true
40
+ - id: rcd_config
41
+ run: |
42
+ bundle exec ruby -e ' \
43
+ require "rake_compiler_dock"; \
44
+ print "image_name="; \
45
+ puts RakeCompilerDock::Starter.container_image_name(:platform => %q(${{matrix.platform}})); \
46
+ print "snapshot_name="; \
47
+ puts RakeCompilerDock::Starter.container_image_name(:platform => %q(${{matrix.platform}}), :version => %q(snapshot)); \
48
+ ' | tee -a $GITHUB_OUTPUT
49
+
50
+ - name: Build docker image
51
+ env:
52
+ RCD_DOCKER_BUILD: docker buildx build --cache-from=type=local,src=tmp/build-cache --cache-to=type=local,dest=tmp/build-cache-new --load
53
+ run: |
54
+ docker buildx create --driver docker-container --use
55
+ bundle exec rake build:${{matrix.platform}}
56
+ # move build cache and remove outdated layers
57
+ rm -rf tmp/build-cache
58
+ mv tmp/build-cache-new tmp/build-cache
59
+ - uses: docker/login-action@v2
60
+ with:
61
+ registry: ghcr.io
62
+ username: ${{github.actor}}
63
+ password: ${{secrets.GITHUB_TOKEN}}
64
+ - run: |
65
+ docker images
66
+ docker tag ${{steps.rcd_config.outputs.image_name}} ${{steps.rcd_config.outputs.snapshot_name}}
67
+ docker push ${{steps.rcd_config.outputs.snapshot_name}}
data/.gitignore CHANGED
@@ -4,6 +4,7 @@
4
4
  /Dockerfile.mri.arm-linux
5
5
  /Dockerfile.mri.arm64-darwin
6
6
  /Dockerfile.mri.arm64-linux
7
+ /Dockerfile.mri.x64-mingw-ucrt
7
8
  /Dockerfile.mri.x64-mingw32
8
9
  /Dockerfile.mri.x86-linux
9
10
  /Dockerfile.mri.x86-mingw32
@@ -11,6 +12,7 @@
11
12
  /Dockerfile.mri.x86_64-linux
12
13
  /Gemfile.lock
13
14
  /_yardoc/
15
+ /cache/
14
16
  /coverage/
15
17
  /doc/
16
18
  /pkg/
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,38 @@
1
+ # Contributing
2
+
3
+ This document is intended for the rake-compiler-dock contributors.
4
+
5
+ ## Building a versioned image
6
+
7
+ We want to preserve the cache if we can, so patch releases don't change _all_ the layers. There are a few ways to do this.
8
+
9
+
10
+ ### Using local docker
11
+
12
+ If you're going to keep your local docker cache, around, you can run things in parallel:
13
+
14
+ ```
15
+ bundle exec rake build
16
+ ```
17
+
18
+
19
+ ### Use a custom docker command
20
+
21
+ If you're a pro and want to run a custom command and still run things in parallel:
22
+
23
+ ```
24
+ export RCD_DOCKER_BUILD="docker build --arg1 --arg2"
25
+ bundle exec rake build
26
+ ```
27
+
28
+
29
+ ### Using the buildx backend and cache
30
+
31
+ Here's one way to leverage the buildx cache, which will turn off parallel builds but generates an external cache directory that can be saved and re-used:
32
+
33
+ ```
34
+ export RCD_USE_BUILDX_CACHE=t
35
+ docker buildx create --use --driver=docker-container
36
+ bundle exec rake build
37
+ ```
38
+
data/Dockerfile.jruby CHANGED
@@ -26,19 +26,22 @@ ENV BASH_ENV /etc/rubybashrc
26
26
 
27
27
  # install rubies and fix permissions on
28
28
  RUN bash -c " \
29
- export CFLAGS='-s -O3 -fno-fast-math -fPIC' && \
30
- for v in jruby-9.3.2.0 ; do \
31
- rvm install --binary \$v --patch \$(echo ~/patches/ruby-\$v/* | tr ' ' ','); \
32
- done && \
33
- rvm cleanup all && \
34
- find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw "
29
+ export CFLAGS='-s -O3 -fno-fast-math -fPIC' && \
30
+ for v in jruby-9.4.0.0 ; do \
31
+ rvm install --binary \$v --patch \$(echo ~/patches/ruby-\$v/* | tr ' ' ','); \
32
+ done && \
33
+ rvm cleanup all && \
34
+ find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw \
35
+ "
35
36
 
36
- # Install rake-compiler and typical gems in all Rubies
37
- # do not generate documentation for gems
38
- RUN echo "gem: --no-ri --no-rdoc" >> ~/.gemrc && \
39
- bash -c " \
40
- rvm all do gem install --no-document bundler 'bundler:~>1.16' rake-compiler hoe rubygems-tasks && \
41
- find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw "
37
+ RUN bash -c " \
38
+ echo "gem: --no-ri --no-rdoc" >> ~/.gemrc && \
39
+ rvm all do gem update --system --no-document && \
40
+ rvm all do gem update --no-document && \
41
+ rvm all do gem install bundler --no-document && \
42
+ rvm all do gem install --no-document rake-compiler:1.2.1 && \
43
+ find /usr/local/rvm -type d -print0 | sudo xargs -0 chmod g+sw \
44
+ "
42
45
 
43
46
  # Install rake-compiler's cross rubies in global dir instead of /root
44
47
  RUN sudo mkdir -p /usr/local/rake-compiler && \
@@ -47,8 +50,8 @@ RUN sudo mkdir -p /usr/local/rake-compiler && \
47
50
 
48
51
  USER root
49
52
 
50
- RUN bash -c "rvm alias create default jruby-9.3.2.0"
51
- RUN echo "rvm use jruby-9.3.2.0 > /dev/null" >> /etc/rubybashrc
53
+ RUN bash -c "rvm alias create default jruby-9.4.0.0"
54
+ RUN echo "rvm use jruby-9.4.0.0 > /dev/null" >> /etc/rubybashrc
52
55
 
53
56
  # Add rvm to the global bashrc
54
57
  RUN echo "source /etc/profile.d/rvm.sh" >> /etc/bash.bashrc