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,15 @@ jobs:
3429 # https://github.com/actions/runner-images/issues/2840
3530 - name : Free disk space
3631 run : |
37- sudo rm -rf /opt/ghc
38- sudo rm -rf /usr/share/dotnet
39- sudo rm -rf /usr/local/lib/android
40- sudo rm -rf "/usr/local/share/boost"
32+ sudo rm -rf /usr/share/dotnet /usr/local/lib/android
4133 -
42- name : Cache Docker layers
43- uses : actions/cache@v4
34+ name : Login to ghcr.io
35+ uses : docker/login-action@v3
36+ # if: github.ref == 'refs/heads/main'
4437 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-
38+ registry : ghcr.io
39+ username : ${{ github.actor }}
40+ password : ${{ secrets.GITHUB_TOKEN }}
4941 -
5042 name : Set up QEMU
5143 uses : docker/setup-qemu-action@v3
@@ -57,74 +49,67 @@ jobs:
5749 images : ${{ env.DOCKER_IMAGE }}
5850 flavor : |
5951 latest=false
60- suffix=-amd64
6152 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
53+ type=raw,value=devel-amd64
7054 -
7155 name : Set up Docker Buildx
7256 uses : docker/setup-buildx-action@v3
7357 with :
7458 driver-opts : network=host
7559 -
76- name : Build and export to Docker client
60+ name : Build image & push
7761 uses : docker/build-push-action@v6
7862 with :
7963 context : .
8064 platforms : linux/amd64
8165 file : docker/amd64/base/Dockerfile
82- load : true
8366 tags : ${{ steps.meta.outputs.tags }}
8467 labels : ${{ steps.meta.outputs.labels }}
8568 build-args : |
8669 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
70+ push : false
71+ load : true
72+ cache-from : type=gha,scope=devel-amd64
73+ cache-to : type=gha,scope=devel-amd64,mode=max
9074 -
9175 name : Inspect image
9276 run : |
9377 docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.version }}
9478 -
9579 name : Check manifest
96- if : github.event_name != 'pull_request '
80+ # if: github.ref == 'refs/heads/master '
9781 run : |
9882 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
111- -
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
116- run : |
117- rm -rf /tmp/.buildx-cache
118- mv /tmp/.buildx-cache-new /tmp/.buildx-cache
119-
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
12095 -
121- name : Cache Docker layers (libs)
122- uses : actions/cache@v4
96+ name : Build image & push
97+ uses : docker/build-push-action@v6
12398 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-
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+ # # Docker AMD64 libs
112+
128113 -
129114 name : Docker meta (libs)
130115 id : meta2
@@ -133,69 +118,70 @@ jobs:
133118 images : ${{ env.DOCKER_IMAGE }}
134119 flavor : |
135120 latest=false
136- suffix=-amd64-libs
137121 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
122+ type=raw,value=devel-libs-amd64
145123 -
146124 name : Set up Docker Buildx (libs)
147125 uses : docker/setup-buildx-action@v3
148126 with :
149127 driver-opts : network=host
150128 -
151- name : Build and export to Docker client
129+ name : Build image (libs)
152130 uses : docker/build-push-action@v6
153131 with :
154132 context : .
155133 platforms : linux/amd64
156134 file : docker/amd64/libs/Dockerfile
157- load : true
158135 tags : ${{ steps.meta2.outputs.tags }}
159136 labels : ${{ steps.meta2.outputs.labels }}
160137 build-args : |
161138 VERSION=0.0.0
162- push : ${{ github.event_name != 'pull_request' }}
139+ push : false
140+ load : true
163141 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
142+ type=gha,scope=devel-libs-amd64
143+ type=gha,scope=devel-amd64
144+ cache-to : type=gha,scope=devel-libs-amd64,mode=max
168145 -
169- name : Inspect image
146+ name : Inspect image (libs)
170147 run : |
171148 docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta2.outputs.version }}
172149 -
173- name : Check manifest
174- if : github.event_name != 'pull_request '
150+ name : Check manifest (libs)
151+ # if: github.ref == 'refs/heads/master '
175152 run : |
176153 docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta2.outputs.version }}
177154 -
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
191168 -
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
196- run : |
197- rm -rf /tmp/.buildx-cache2
198- mv /tmp/.buildx-cache2-new /tmp/.buildx-cache2
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
199185
200186 # docker-arm64:
201187 # name: Docker test (arm64)
0 commit comments