1414 - .github/workflows/*.yml
1515
1616env :
17- DOCKER_IMAGE : localhost:5000/ github.com/joseluisq/rust-linux-darwin-builder
17+ DOCKER_IMAGE : ghcr.io/${{ github.repository }}
1818
1919jobs :
2020 docker-amd64 :
2121 name : Docker test (amd64)
2222 runs-on : ubuntu-22.04
23- services :
24- registry :
25- image : registry:2
26- ports :
27- - 5000:5000
2823 steps :
2924 -
3025 name : Checkout
@@ -34,18 +29,20 @@ jobs:
3429 # https://github.com/actions/runner-images/issues/2840
3530 - name : Free disk space
3631 run : |
37- sudo rm -rf /opt/ghc
3832 sudo rm -rf /usr/share/dotnet
39- sudo rm -rf /usr/local/lib/android
40- sudo rm -rf "/usr/local/share/boost"
33+ sudo rm -rf /usr/local/lib/android/sdk/build-tools
34+ sudo rm -rf /usr/local/lib/android/sdk/cmake
35+ sudo rm -rf /usr/local/lib/android/sdk/cmdline-tools
36+ sudo rm -rf /usr/local/lib/android/sdk/extras
37+ sudo rm -rf /usr/local/lib/android/sdk/ndk
4138 -
42- name : Cache Docker layers
43- uses : actions/cache@v4
39+ name : Login to ghcr.io
40+ uses : docker/login-action@v3
41+ # if: github.ref == 'refs/heads/main'
4442 with :
45- path : /tmp/.buildx-cache
46- key : rust-linux-darwin-builder-amd64-buildx-${{ github.sha }}
47- restore-keys : |
48- rust-linux-darwin-builder-amd64-buildx-
43+ registry : ghcr.io
44+ username : ${{ github.actor }}
45+ password : ${{ secrets.GITHUB_TOKEN }}
4946 -
5047 name : Set up QEMU
5148 uses : docker/setup-qemu-action@v3
@@ -57,74 +54,67 @@ jobs:
5754 images : ${{ env.DOCKER_IMAGE }}
5855 flavor : |
5956 latest=false
60- suffix=-amd64
6157 tags : |
62- type=schedule
63- type=ref,event=branch
64- type=ref,event=pr
65- type=semver,pattern={{version}}
66- type=semver,pattern={{major}}.{{minor}}
67- type=semver,pattern={{major}}
68- type=sha
69- type=raw,value=devel,suffix=-amd64
58+ type=raw,value=devel-amd64
7059 -
7160 name : Set up Docker Buildx
7261 uses : docker/setup-buildx-action@v3
7362 with :
7463 driver-opts : network=host
7564 -
76- name : Build and export to Docker client
65+ name : Build image
7766 uses : docker/build-push-action@v6
7867 with :
7968 context : .
8069 platforms : linux/amd64
8170 file : docker/amd64/base/Dockerfile
82- load : true
8371 tags : ${{ steps.meta.outputs.tags }}
8472 labels : ${{ steps.meta.outputs.labels }}
8573 build-args : |
8674 VERSION=0.0.0
87- push : ${{ github.event_name != 'pull_request' }}
88- cache-from : type=local,src=/tmp/.buildx-cache
89- cache-to : type=local,dest=/tmp/.buildx-cache-new,mode=max
75+ push : false
76+ load : true
77+ cache-from : type=gha,scope=devel-amd64
78+ cache-to : type=gha,scope=devel-amd64,mode=max
9079 -
9180 name : Inspect image
9281 run : |
9382 docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.version }}
94- -
95- name : Check manifest
96- if : github.event_name != 'pull_request'
97- run : |
98- docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.version }}
9983 -
10084 name : Run tests
10185 uses : addnab/docker-run-action@v3
10286 with :
103- image : " ${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.version }}"
104- shell : bash
105- options : -v ${{ github.workspace }}:/root/src
106- run : |
107- set -eux
108- cat /etc/debian_version
109- uname -a
110- make test-app
87+ image : " ${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.version }}"
88+ shell : bash
89+ options : -v ${{ github.workspace }}:/root/src
90+ run : |
91+ set -eux
92+ cat /etc/debian_version
93+ uname -a
94+ make test-app
11195 -
112- # Temp fix
113- # https://github.com/docker/build-push-action/issues/252
114- # https://github.com/moby/buildkit/issues/1896
115- name : Move cache
96+ name : Build image & push
97+ uses : docker/build-push-action@v6
98+ with :
99+ context : .
100+ platforms : linux/amd64
101+ file : docker/amd64/base/Dockerfile
102+ tags : ${{ steps.meta.outputs.tags }}
103+ labels : ${{ steps.meta.outputs.labels }}
104+ build-args : |
105+ VERSION=0.0.0
106+ # push: ${{ github.ref == 'refs/heads/master' }}
107+ push : true
108+ cache-from : type=gha,scope=devel-amd64
109+ cache-to : type=gha,scope=devel-amd64,mode=max
110+ -
111+ name : Check manifest
112+ # if: github.ref == 'refs/heads/master'
116113 run : |
117- rm -rf /tmp/.buildx-cache
118- mv /tmp/.buildx-cache-new /tmp/.buildx-cache
114+ docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.version }}
115+
116+ # # Docker AMD64 libs
119117
120- -
121- name : Cache Docker layers (libs)
122- uses : actions/cache@v4
123- with :
124- path : /tmp/.buildx-cache2
125- key : rust-linux-darwin-builder-amd64-libs-buildx-${{ github.sha }}
126- restore-keys : |
127- rust-linux-darwin-builder-amd64-libs-buildx-
128118 -
129119 name : Docker meta (libs)
130120 id : meta2
@@ -133,69 +123,70 @@ jobs:
133123 images : ${{ env.DOCKER_IMAGE }}
134124 flavor : |
135125 latest=false
136- suffix=-amd64-libs
137126 tags : |
138- type=schedule
139- type=ref,event=branch
140- type=ref,event=pr
141- type=semver,pattern={{version}}
142- type=semver,pattern={{major}}.{{minor}}
143- type=semver,pattern={{major}}
144- type=sha
127+ type=raw,value=devel-libs-amd64
145128 -
146129 name : Set up Docker Buildx (libs)
147130 uses : docker/setup-buildx-action@v3
148131 with :
149132 driver-opts : network=host
150133 -
151- name : Build and export to Docker client
134+ name : Build image (libs)
152135 uses : docker/build-push-action@v6
153136 with :
154137 context : .
155138 platforms : linux/amd64
156139 file : docker/amd64/libs/Dockerfile
157- load : true
158140 tags : ${{ steps.meta2.outputs.tags }}
159141 labels : ${{ steps.meta2.outputs.labels }}
160142 build-args : |
161143 VERSION=0.0.0
162- push : ${{ github.event_name != 'pull_request' }}
144+ push : false
145+ load : true
163146 cache-from : |
164- type=local,src=/tmp/.buildx-cache
165- type=local,src=/tmp/.buildx-cache2
166- cache-to : |
167- type=local,dest=/tmp/.buildx-cache2-new,mode=max
147+ type=gha,scope=devel-libs-amd64
148+ type=gha,scope=devel-amd64
149+ cache-to : type=gha,scope=devel-libs-amd64,mode=max
168150 -
169- name : Inspect image
151+ name : Inspect image (libs)
170152 run : |
171153 docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta2.outputs.version }}
172154 -
173- name : Check manifest
174- if : github.event_name != 'pull_request'
175- run : |
176- docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta2.outputs.version }}
177- -
178- name : Run tests
155+ name : Run tests (libs)
179156 uses : addnab/docker-run-action@v3
180157 with :
181- image : " ${{ env.DOCKER_IMAGE }}:${{ steps.meta2.outputs.version }}"
182- shell : bash
183- options : -v ${{ github.workspace }}:/root/src
184- run : |
185- set -eux
186- cat /etc/debian_version
187- uname -a
188- make test-app
189- make test-zlib
190- make test-openssl
158+ image : " ${{ env.DOCKER_IMAGE }}:${{ steps.meta2.outputs.version }}"
159+ shell : bash
160+ options : -v ${{ github.workspace }}:/root/src
161+ run : |
162+ set -eux
163+ cat /etc/debian_version
164+ uname -a
165+ make test-app
166+ make test-zlib
167+ make test-openssl
168+ -
169+ name : Build image & push (libs)
170+ uses : docker/build-push-action@v6
171+ with :
172+ context : .
173+ platforms : linux/amd64
174+ file : docker/amd64/libs/Dockerfile
175+ tags : ${{ steps.meta2.outputs.tags }}
176+ labels : ${{ steps.meta2.outputs.labels }}
177+ build-args : |
178+ VERSION=0.0.0
179+ # push: ${{ github.ref == 'refs/heads/master' }}
180+ push : true
181+ cache-from : |
182+ type=gha,scope=devel-libs-amd64
183+ type=gha,scope=devel-amd64
184+ cache-to : type=gha,scope=devel-libs-amd64,mode=max
191185 -
192- # Temp fix
193- # https://github.com/docker/build-push-action/issues/252
194- # https://github.com/moby/buildkit/issues/1896
195- name : Move cache
186+ name : Check manifest (libs)
187+ # if: github.ref == 'refs/heads/master'
196188 run : |
197- rm -rf /tmp/.buildx-cache2
198- mv /tmp/.buildx-cache2-new /tmp/.buildx-cache2
189+ docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta2.outputs.version }}
199190
200191 # docker-arm64:
201192 # name: Docker test (arm64)
0 commit comments