rake-compiler-dock 1.2.2 → 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 +4 -4
- data/.github/workflows/ci.yml +74 -23
- data/.github/workflows/publish-images.yml +67 -0
- data/.gitignore +2 -0
- data/CONTRIBUTING.md +38 -0
- data/Dockerfile.jruby +17 -14
- data/Dockerfile.mri.erb +83 -100
- data/History.md +24 -0
- data/README.md +12 -2
- data/Rakefile +21 -14
- data/build/mk_i686.rb +2 -0
- data/build/mk_osxcross.sh +38 -0
- data/build/parallel_docker_build.rb +21 -6
- data/build/patches/{ruby-3.1.0 → ruby-3.1.3}/no_sendfile.patch +0 -0
- data/build/patches2/{rake-compiler-1.1.6 → rake-compiler-1.2.1}/0004-Enable-build-of-static-libruby.patch +0 -0
- data/build/patches2/rake-compiler-1.2.1/0005-make-miniruby.patch +19 -0
- data/lib/rake_compiler_dock/starter.rb +35 -11
- data/lib/rake_compiler_dock/version.rb +2 -2
- data/test/env/Dockerfile.centos +3 -1
- data/test/rcd_test/Gemfile +1 -1
- data/test/rcd_test/Rakefile +8 -6
- data/test/rcd_test/ext/mri/extconf.rb +66 -0
- data/test/test_environment_variables.rb +27 -19
- data/test/test_parallel_docker_build.rb +1 -1
- data/test/test_starter.rb +119 -0
- metadata +10 -33
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0c53a8e4fde2b4ad57875b1e8ca11037cb9d9f101b451aaea52cdcef60dc56c
|
4
|
+
data.tar.gz: 9be653f556704bc9725aeec603c45a83491f62dd71b7e5b5e4eccd1635864a4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c56bc4e310a1b5eb278ceb1da8b06a6bdbea9be2ddd6acf3be2c509afe60f542b8171e1c88cdcc6df9e21087028d91df1b46763f15c571d8ca71d4be6fdddc7
|
7
|
+
data.tar.gz: 2b2a2504d952cfe709cf0dece45d8ef7c83ac768af42eac27ec888a36c913c9e5d2b07f0e90bdb839945d3d4570b6ada0abb01b797e1e6a5249a521c83d59a88
|
data/.github/workflows/ci.yml
CHANGED
@@ -1,12 +1,14 @@
|
|
1
|
-
name:
|
1
|
+
name: CI
|
2
2
|
concurrency:
|
3
3
|
group: "${{github.workflow}}-${{github.ref}}"
|
4
4
|
cancel-in-progress: true
|
5
5
|
on:
|
6
6
|
workflow_dispatch:
|
7
|
+
schedule:
|
8
|
+
- cron: "0 5 * * 3" # At 05:00 on Wednesday # https://crontab.guru/#0_5_*_*_3
|
7
9
|
push:
|
8
10
|
branches:
|
9
|
-
-
|
11
|
+
- master
|
10
12
|
tags:
|
11
13
|
- "*.*.*"
|
12
14
|
pull_request:
|
@@ -17,7 +19,7 @@ on:
|
|
17
19
|
jobs:
|
18
20
|
# These jobs use Buildx layer caching
|
19
21
|
docker_build:
|
20
|
-
name:
|
22
|
+
name: build image
|
21
23
|
|
22
24
|
strategy:
|
23
25
|
fail-fast: false
|
@@ -38,10 +40,10 @@ jobs:
|
|
38
40
|
env:
|
39
41
|
PLATFORM: ${{ matrix.platform }}
|
40
42
|
steps:
|
41
|
-
- uses: actions/checkout@
|
43
|
+
- uses: actions/checkout@v3
|
42
44
|
|
43
45
|
- name: Cache Docker layers
|
44
|
-
uses: actions/cache@
|
46
|
+
uses: actions/cache@v3
|
45
47
|
with:
|
46
48
|
path: tmp/build-cache
|
47
49
|
key: ${{ runner.os }}-${{ matrix.platform }}-buildx-${{ github.sha }}
|
@@ -57,36 +59,41 @@ jobs:
|
|
57
59
|
run: |
|
58
60
|
docker buildx create --driver docker-container --use
|
59
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
|
60
63
|
|
61
64
|
- name: Move build cache and remove outdated layers
|
62
65
|
run: |
|
63
66
|
rm -rf tmp/build-cache
|
64
67
|
mv tmp/build-cache-new tmp/build-cache
|
65
68
|
|
69
|
+
- name: Basic tests on the generated image
|
70
|
+
env:
|
71
|
+
TEST_PLATFORM: ${{ matrix.platform }}
|
72
|
+
run: |
|
73
|
+
bundle exec rake test
|
74
|
+
|
66
75
|
- name: Build rcd_test.gem
|
67
76
|
run: |
|
68
|
-
gem build rake-compiler-dock.gemspec
|
69
|
-
gem install -l rake-compiler-dock-*.gem
|
70
77
|
cd test/rcd_test/
|
71
78
|
bundle install
|
72
79
|
bundle exec rake clean clobber
|
73
80
|
bundle exec rake gem:${PLATFORM}
|
74
81
|
|
75
82
|
- name: Upload binary gem
|
76
|
-
uses: actions/upload-artifact@
|
83
|
+
uses: actions/upload-artifact@v3
|
77
84
|
with:
|
78
85
|
name: gem-${{ matrix.platform }}
|
79
86
|
path: test/rcd_test/pkg/*-*-*.gem
|
80
87
|
|
81
88
|
- if: matrix.platform == 'jruby'
|
82
89
|
name: Upload source gem
|
83
|
-
uses: actions/upload-artifact@
|
90
|
+
uses: actions/upload-artifact@v3
|
84
91
|
with:
|
85
92
|
name: gem-ruby
|
86
93
|
path: test/rcd_test/pkg/*-?.?.?.gem
|
87
94
|
|
88
95
|
- if: contains(matrix.platform, 'x64-mingw')
|
89
|
-
name: Build static rcd_test.gem
|
96
|
+
name: Build static rcd_test.gem for windows
|
90
97
|
env:
|
91
98
|
RCD_TEST_CONFIG: "--link-static"
|
92
99
|
run: |
|
@@ -98,14 +105,48 @@ jobs:
|
|
98
105
|
bundle exec rake gem:${PLATFORM}
|
99
106
|
|
100
107
|
- if: contains(matrix.platform, 'x64-mingw')
|
101
|
-
name: Upload static
|
102
|
-
uses: actions/upload-artifact@
|
108
|
+
name: Upload static rcd_test.gem
|
109
|
+
uses: actions/upload-artifact@v3
|
103
110
|
with:
|
104
111
|
name: gem-${{ matrix.platform }}-static
|
105
112
|
path: test/rcd_test/pkg/*-*-*.gem
|
106
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
|
147
|
+
|
107
148
|
job_test_native:
|
108
|
-
name:
|
149
|
+
name: native
|
109
150
|
needs: docker_build
|
110
151
|
strategy:
|
111
152
|
fail-fast: false
|
@@ -115,6 +156,7 @@ jobs:
|
|
115
156
|
- macos
|
116
157
|
- ubuntu
|
117
158
|
ruby:
|
159
|
+
- "3.2"
|
118
160
|
- "3.1"
|
119
161
|
- "3.0"
|
120
162
|
- "2.7"
|
@@ -128,27 +170,30 @@ jobs:
|
|
128
170
|
platform: x86_64-darwin
|
129
171
|
- os: ubuntu
|
130
172
|
platform: x86_64-linux
|
131
|
-
- os: ubuntu
|
132
|
-
platform: ruby
|
133
173
|
- os: ubuntu
|
134
174
|
ruby: jruby-head
|
135
175
|
platform: jruby
|
136
176
|
- os: windows
|
137
177
|
ruby: "3.1"
|
138
178
|
platform: x64-mingw-ucrt
|
179
|
+
- os: windows
|
180
|
+
ruby: "3.2"
|
181
|
+
platform: x64-mingw-ucrt
|
139
182
|
exclude:
|
140
183
|
- os: windows
|
141
184
|
ruby: "3.1"
|
185
|
+
- os: windows
|
186
|
+
ruby: "3.2"
|
142
187
|
|
143
188
|
runs-on: ${{ matrix.os }}-latest
|
144
189
|
steps:
|
145
|
-
- uses: actions/checkout@
|
190
|
+
- uses: actions/checkout@v3
|
146
191
|
- uses: ruby/setup-ruby@v1
|
147
192
|
with:
|
148
193
|
ruby-version: ${{ matrix.ruby }}
|
149
194
|
- run: ruby --version
|
150
195
|
- name: Download gem-${{matrix.platform}}
|
151
|
-
uses: actions/download-artifact@
|
196
|
+
uses: actions/download-artifact@v3
|
152
197
|
with:
|
153
198
|
name: gem-${{ matrix.platform }}
|
154
199
|
- name: Install gem-${{matrix.platform}}
|
@@ -160,7 +205,7 @@ jobs:
|
|
160
205
|
ruby -rrcd_test -S rake test
|
161
206
|
|
162
207
|
job_test_native_static:
|
163
|
-
name:
|
208
|
+
name: native static
|
164
209
|
needs: docker_build
|
165
210
|
strategy:
|
166
211
|
fail-fast: false
|
@@ -168,6 +213,7 @@ jobs:
|
|
168
213
|
os:
|
169
214
|
- windows
|
170
215
|
ruby:
|
216
|
+
- "3.2"
|
171
217
|
- "3.1"
|
172
218
|
- "3.0"
|
173
219
|
- "2.7"
|
@@ -180,19 +226,24 @@ jobs:
|
|
180
226
|
- os: windows
|
181
227
|
ruby: "3.1"
|
182
228
|
platform: x64-mingw-ucrt
|
229
|
+
- os: windows
|
230
|
+
ruby: "3.2"
|
231
|
+
platform: x64-mingw-ucrt
|
183
232
|
exclude:
|
184
233
|
- os: windows
|
185
234
|
ruby: "3.1"
|
235
|
+
- os: windows
|
236
|
+
ruby: "3.2"
|
186
237
|
|
187
238
|
runs-on: ${{ matrix.os }}-latest
|
188
239
|
steps:
|
189
|
-
- uses: actions/checkout@
|
240
|
+
- uses: actions/checkout@v3
|
190
241
|
- uses: ruby/setup-ruby@v1
|
191
242
|
with:
|
192
243
|
ruby-version: ${{ matrix.ruby }}
|
193
244
|
- run: ruby --version
|
194
245
|
- name: Download gem-${{matrix.platform}}-static
|
195
|
-
uses: actions/download-artifact@
|
246
|
+
uses: actions/download-artifact@v3
|
196
247
|
with:
|
197
248
|
name: gem-${{ matrix.platform }}-static
|
198
249
|
- name: Install gem-${{matrix.platform}}-static
|
@@ -204,7 +255,7 @@ jobs:
|
|
204
255
|
ruby -rrcd_test -S rake test
|
205
256
|
|
206
257
|
job_test_multiarch:
|
207
|
-
name:
|
258
|
+
name: multiarch (${{matrix.platform}} on ${{matrix.from_image}})
|
208
259
|
needs: docker_build
|
209
260
|
strategy:
|
210
261
|
fail-fast: false
|
@@ -228,9 +279,9 @@ jobs:
|
|
228
279
|
|
229
280
|
runs-on: ubuntu-latest
|
230
281
|
steps:
|
231
|
-
- uses: actions/checkout@
|
282
|
+
- uses: actions/checkout@v3
|
232
283
|
- name: Download gem-${{matrix.platform}}
|
233
|
-
uses: actions/download-artifact@
|
284
|
+
uses: actions/download-artifact@v3
|
234
285
|
with:
|
235
286
|
name: gem-${{ matrix.platform }}
|
236
287
|
- name: Build image and Run tests
|
@@ -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
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
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.
|
51
|
-
RUN echo "rvm use jruby-9.
|
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
|