Skip to content

Commit aad7df5

Browse files
authored
Merge pull request #84 from rake-compiler/71-flavorjones-publish-images-to-ghcr
publish image snapshots to ghcr.io
2 parents 358b63e + b38eac1 commit aad7df5

File tree

3 files changed

+78
-12
lines changed

3 files changed

+78
-12
lines changed

.github/workflows/ci.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ jobs:
4040
env:
4141
PLATFORM: ${{ matrix.platform }}
4242
steps:
43-
- uses: actions/checkout@v2
43+
- uses: actions/checkout@v3
4444

4545
- name: Cache Docker layers
46-
uses: actions/cache@v2
46+
uses: actions/cache@v3
4747
with:
4848
path: tmp/build-cache
4949
key: ${{ runner.os }}-${{ matrix.platform }}-buildx-${{ github.sha }}
@@ -75,14 +75,14 @@ jobs:
7575
bundle exec rake gem:${PLATFORM}
7676
7777
- name: Upload binary gem
78-
uses: actions/upload-artifact@v2
78+
uses: actions/upload-artifact@v3
7979
with:
8080
name: gem-${{ matrix.platform }}
8181
path: test/rcd_test/pkg/*-*-*.gem
8282

8383
- if: matrix.platform == 'jruby'
8484
name: Upload source gem
85-
uses: actions/upload-artifact@v2
85+
uses: actions/upload-artifact@v3
8686
with:
8787
name: gem-ruby
8888
path: test/rcd_test/pkg/*-?.?.?.gem
@@ -101,7 +101,7 @@ jobs:
101101
102102
- if: contains(matrix.platform, 'x64-mingw')
103103
name: Upload static binary gem
104-
uses: actions/upload-artifact@v2
104+
uses: actions/upload-artifact@v3
105105
with:
106106
name: gem-${{ matrix.platform }}-static
107107
path: test/rcd_test/pkg/*-*-*.gem
@@ -144,13 +144,13 @@ jobs:
144144

145145
runs-on: ${{ matrix.os }}-latest
146146
steps:
147-
- uses: actions/checkout@v2
147+
- uses: actions/checkout@v3
148148
- uses: ruby/setup-ruby@v1
149149
with:
150150
ruby-version: ${{ matrix.ruby }}
151151
- run: ruby --version
152152
- name: Download gem-${{matrix.platform}}
153-
uses: actions/download-artifact@v2
153+
uses: actions/download-artifact@v3
154154
with:
155155
name: gem-${{ matrix.platform }}
156156
- name: Install gem-${{matrix.platform}}
@@ -188,13 +188,13 @@ jobs:
188188

189189
runs-on: ${{ matrix.os }}-latest
190190
steps:
191-
- uses: actions/checkout@v2
191+
- uses: actions/checkout@v3
192192
- uses: ruby/setup-ruby@v1
193193
with:
194194
ruby-version: ${{ matrix.ruby }}
195195
- run: ruby --version
196196
- name: Download gem-${{matrix.platform}}-static
197-
uses: actions/download-artifact@v2
197+
uses: actions/download-artifact@v3
198198
with:
199199
name: gem-${{ matrix.platform }}-static
200200
- name: Install gem-${{matrix.platform}}-static
@@ -230,9 +230,9 @@ jobs:
230230

231231
runs-on: ubuntu-latest
232232
steps:
233-
- uses: actions/checkout@v2
233+
- uses: actions/checkout@v3
234234
- name: Download gem-${{matrix.platform}}
235-
uses: actions/download-artifact@v2
235+
uses: actions/download-artifact@v3
236236
with:
237237
name: gem-${{ matrix.platform }}
238238
- name: Build image and Run tests

.github/workflows/publish-images.yml

+55-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,62 @@ concurrency:
44
cancel-in-progress: true
55
on:
66
workflow_dispatch:
7+
schedule:
8+
- cron: "0 3 * * 3" # At 03:00 on Wednesday # https://crontab.guru/#0_3_*_*_3
79

810
jobs:
911
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+
include:
26+
- platform: jruby
27+
tag: jruby
28+
runs-on: ubuntu-latest
1029
steps:
11-
- run: echo "this is a stub pipeline so that I can ship a working version in #84"
30+
- uses: actions/checkout@v3
31+
- name: Use cache from primary pipeline
32+
uses: actions/cache@v3
33+
with:
34+
path: tmp/build-cache
35+
key: ${{runner.os}}-${{matrix.platform}}-buildx-${{github.sha}}
36+
restore-keys: |
37+
${{runner.os}}-${{matrix.platform}}-buildx
38+
- uses: ruby/setup-ruby@v1
39+
with:
40+
ruby-version: "3.1"
41+
bundler-cache: true
42+
- id: rcd_image_version
43+
run: bundle exec ruby -e 'require "rake_compiler_dock"; puts "rcd_image_version=#{RakeCompilerDock::IMAGE_VERSION}"' >> $GITHUB_OUTPUT
44+
- name: Build docker image
45+
env:
46+
DOCKERHUB_USER: rake-compiler
47+
RCD_DOCKER_BUILD: docker buildx build --cache-from=type=local,src=tmp/build-cache --cache-to=type=local,dest=tmp/build-cache-new --load
48+
run: |
49+
docker buildx create --driver docker-container --use
50+
bundle exec rake build:${{matrix.platform}}
51+
# move build cache and remove outdated layers
52+
rm -rf tmp/build-cache
53+
mv tmp/build-cache-new tmp/build-cache
54+
- uses: docker/login-action@v2
55+
with:
56+
registry: ghcr.io
57+
username: ${{github.actor}}
58+
password: ${{secrets.GITHUB_TOKEN}}
59+
- env:
60+
OLD_TAG: rake-compiler/rake-compiler-dock-${{matrix.tag || format('mri-{0}', matrix.platform)}}:${{steps.rcd_image_version.outputs.rcd_image_version}}
61+
NEW_TAG: ghcr.io/rake-compiler/rake-compiler-dock-snapshot:${{matrix.platform}}
62+
run: |
63+
docker images
64+
docker tag ${OLD_TAG} ${NEW_TAG}
65+
docker push ${NEW_TAG}

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,18 @@ end
218218

219219
For an example of rake tasks that support this style of invocation, visit https://github.com/flavorjones/ruby-c-extensions-explained/tree/main/precompiled
220220

221+
222+
### Living on the edge: using weekly snapshots
223+
224+
OCI images snapshotted from `master` are published weekly to Github Container Registry:
225+
226+
> https://github.com/rake-compiler/rake-compiler-dock/pkgs/container/rake-compiler-dock-snapshot
227+
228+
The images are named `ghcr.io/rake-compiler/rake-compiler-dock-snapshot` and are tagged with the platform name (e.g., `ghcr.io/rake-compiler/rake-compiler-dock-snapshot:x86_64-linux`.
229+
230+
These images are intended for integration testing. They may not work properly and should not be considered production ready.
231+
232+
221233
## Environment Variables
222234

223235
Rake-compiler-dock makes use of several environment variables.

0 commit comments

Comments
 (0)