rake-compiler-dock 1.11.0 → 1.12.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.
@@ -25,7 +25,7 @@ concurrency:
25
25
  cancel-in-progress: true
26
26
 
27
27
  jobs:
28
- <% parallel_docker_build.tree_deps.to_a.flatten.uniq.each do |tree_dep|
28
+ <% parallel_docker_build.all_deps.each do |tree_dep|
29
29
  dockerfile = parallel_docker_build.final_deps.invert[tree_dep]
30
30
  job = dockerfile ? dockerfile[/[-\w]+$/] : tree_dep
31
31
  %>
@@ -49,6 +49,11 @@ jobs:
49
49
  with:
50
50
  ruby-version: "3.4"
51
51
  bundler-cache: true
52
+ - uses: docker/login-action@v3
53
+ with:
54
+ registry: ghcr.io
55
+ username: ${{github.actor}}
56
+ password: ${{secrets.GITHUB_TOKEN}}
52
57
 
53
58
  - name: Fetch docker buildx layer cache
54
59
  uses: actions/cache@v4
@@ -59,49 +64,37 @@ jobs:
59
64
  ${{ runner.os }}-on-${{ runner.arch }}-<%= job %>
60
65
  ${{ runner.os }}-on-${{ runner.arch }}-<%= need %>
61
66
  enableCrossOsArchive: true
67
+
68
+ <%
69
+ # push the final per-platform images in order to merge them in the job below
70
+ if dockerfile && (plat = dockerfile[/[-\w]+$/])
71
+ version = {version: "snapshot"} unless release
72
+ tag = RakeCompilerDock::Starter.container_image_name(platform: plat, **version)
73
+ push_tag = "-t #{tag}-${{ runner.arch }} --push"
74
+ end
75
+ %>
62
76
  - name: Build the image layers <%= job %> on ${{ runner.arch }}
63
77
  env:
64
78
  RCD_TASK_DEPENDENCIES: "false"
65
79
  run: |
66
80
  # Change docker to a cache-able driver
67
81
  docker buildx create --driver docker-container --use
68
- bundle exec rake build:<%= tree_dep %> RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new"
82
+ bundle exec rake build:<%= tree_dep %> RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new <%= push_tag %>"
69
83
  - name: Update and prune docker buildx layer cache
70
84
  run: |
71
85
  rm -rf tmp/build-cache-${{ runner.arch }}
72
86
  mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }}
73
87
  <% end %>
74
88
 
75
- push:
76
- name: push
89
+ merge:
90
+ name: merge
77
91
  needs: [<%= parallel_docker_build.final_deps.keys.map{|a| a[/[-\w]+$/] }.join(",") %>]
78
92
  strategy:
79
93
  fail-fast: false
80
- matrix:
81
- platform:
82
- <% parallel_docker_build.final_deps.each do |dockerfile, _| %>
83
- - <%= dockerfile[/[-\w]+$/] %>
84
- <% end %>
85
94
  runs-on: ubuntu-24.04-arm
86
95
  steps:
87
96
  - uses: actions/checkout@v4
88
97
 
89
- - name: Use X64 cache from tree pipeline of ${{ matrix.platform }}
90
- uses: actions/cache/restore@v4
91
- with:
92
- path: tmp/build-cache-X64
93
- key: ${{ runner.os }}-on-X64-${{ matrix.platform }}-${{ github.sha }}
94
- restore-keys: ${{ runner.os }}-on-X64-${{ matrix.platform }}
95
- enableCrossOsArchive: true
96
- - name: Use ARM64 cache from tree pipeline of ${{ matrix.platform }}
97
- uses: actions/cache/restore@v4
98
- with:
99
- path: tmp/build-cache-ARM64
100
- key: ${{ runner.os }}-on-ARM64-${{ matrix.platform }}-${{ github.sha }}
101
- restore-keys: ${{ runner.os }}-on-ARM64-${{ matrix.platform }}
102
- enableCrossOsArchive: true
103
- fail-on-cache-miss: true
104
-
105
98
  - uses: ruby/setup-ruby@v1
106
99
  with:
107
100
  ruby-version: "3.4"
@@ -111,11 +104,11 @@ jobs:
111
104
  registry: ghcr.io
112
105
  username: ${{github.actor}}
113
106
  password: ${{secrets.GITHUB_TOKEN}}
114
- - name: Use cache and push docker image
107
+
108
+ - name: Merge pushed images and build a manifest for both host platform
109
+ <% unless release %>
115
110
  env:
116
111
  RCD_IMAGE_VERSION: snapshot
117
- RCD_DOCKER_BUILD: docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-X64 --cache-from=type=local,compression=zstd,src=tmp/build-cache-ARM64
118
- RCD_TASK_DEPENDENCIES: "false"
112
+ <% end %>
119
113
  run: |
120
- docker buildx create --driver docker-container --use
121
- bundle exec rake release:${{ matrix.platform }}
114
+ bundle exec rake release:manifests