Skip to content

Commit 75c93b8

Browse files
committed
refactor: use ghcr as cache
1 parent c1d8430 commit 75c93b8

File tree

1 file changed

+33
-62
lines changed

1 file changed

+33
-62
lines changed

.github/workflows/devel.yml

Lines changed: 33 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,12 @@ on:
1414
- .github/workflows/*.yml
1515

1616
env:
17-
DOCKER_IMAGE: localhost:5000/github.com/joseluisq/rust-linux-darwin-builder
17+
DOCKER_IMAGE: ghcr.io/${{ github.repository }}
1818

1919
jobs:
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,24 @@ jobs:
3429
# https://github.com/actions/runner-images/issues/2840
3530
- name: Free disk space
3631
run: |
37-
sudo rm -rf /opt/ghc
32+
sudo du -sh /usr/share/dotnet
3833
sudo rm -rf /usr/share/dotnet
34+
- name: Free disk space
35+
run: |
36+
sudo du -sh /usr/local/lib/android
3937
sudo rm -rf /usr/local/lib/android
38+
- name: Free disk space
39+
run: |
40+
sudo du -sh "/usr/local/share/boost"
4041
sudo rm -rf "/usr/local/share/boost"
4142
-
42-
name: Cache Docker layers
43-
uses: actions/cache@v4
43+
name: Login to ghcr.io
44+
uses: docker/login-action@v3
45+
# if: github.ref == 'refs/heads/main'
4446
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-
47+
registry: ghcr.io
48+
username: ${{ github.actor }}
49+
password: ${{ secrets.GITHUB_TOKEN }}
4950
-
5051
name: Set up QEMU
5152
uses: docker/setup-qemu-action@v3
@@ -57,16 +58,8 @@ jobs:
5758
images: ${{ env.DOCKER_IMAGE }}
5859
flavor: |
5960
latest=false
60-
suffix=-amd64
6161
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
62+
type=raw,value=devel-amd64
7063
-
7164
name: Set up Docker Buildx
7265
uses: docker/setup-buildx-action@v3
@@ -79,21 +72,21 @@ jobs:
7972
context: .
8073
platforms: linux/amd64
8174
file: docker/amd64/base/Dockerfile
82-
load: true
8375
tags: ${{ steps.meta.outputs.tags }}
8476
labels: ${{ steps.meta.outputs.labels }}
8577
build-args: |
8678
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
79+
# push: ${{ github.ref == 'refs/heads/master' }}
80+
push: true
81+
cache-from: type=gha,scope=devel-amd64
82+
cache-to: type=gha,scope=devel-amd64,mode=max
9083
-
9184
name: Inspect image
9285
run: |
9386
docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.version }}
9487
-
9588
name: Check manifest
96-
if: github.event_name != 'pull_request'
89+
# if: github.ref == 'refs/heads/master'
9790
run: |
9891
docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.version }}
9992
-
@@ -108,14 +101,8 @@ jobs:
108101
cat /etc/debian_version
109102
uname -a
110103
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
104+
105+
## Docker AMD64 libs
119106

120107
-
121108
name: Cache Docker layers (libs)
@@ -133,49 +120,41 @@ jobs:
133120
images: ${{ env.DOCKER_IMAGE }}
134121
flavor: |
135122
latest=false
136-
suffix=-amd64-libs
137123
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
124+
type=raw,value=devel-libs-amd64
145125
-
146126
name: Set up Docker Buildx (libs)
147127
uses: docker/setup-buildx-action@v3
148128
with:
149129
driver-opts: network=host
150130
-
151-
name: Build and export to Docker client
131+
name: Build and export to Docker client (libs)
152132
uses: docker/build-push-action@v6
153133
with:
154134
context: .
155135
platforms: linux/amd64
156136
file: docker/amd64/libs/Dockerfile
157-
load: true
158137
tags: ${{ steps.meta2.outputs.tags }}
159138
labels: ${{ steps.meta2.outputs.labels }}
160139
build-args: |
161140
VERSION=0.0.0
162-
push: ${{ github.event_name != 'pull_request' }}
141+
# push: ${{ github.ref == 'refs/heads/master' }}
142+
push: true
163143
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
144+
type=gha,scope=devel-libs-amd64
145+
type=gha,scope=devel-amd64
146+
cache-to: type=gha,scope=devel-libs-amd64,mode=max
168147
-
169-
name: Inspect image
148+
name: Inspect image (libs)
170149
run: |
171150
docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta2.outputs.version }}
172151
-
173-
name: Check manifest
174-
if: github.event_name != 'pull_request'
152+
name: Check manifest (libs)
153+
# if: github.ref == 'refs/heads/master'
175154
run: |
176155
docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta2.outputs.version }}
177156
-
178-
name: Run tests
157+
name: Run tests (libs)
179158
uses: addnab/docker-run-action@v3
180159
with:
181160
image: "${{ env.DOCKER_IMAGE }}:${{ steps.meta2.outputs.version }}"
@@ -188,14 +167,6 @@ jobs:
188167
make test-app
189168
make test-zlib
190169
make test-openssl
191-
-
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
199170
200171
# docker-arm64:
201172
# name: Docker test (arm64)

0 commit comments

Comments
 (0)