Skip to content

Commit 78f680e

Browse files
authored
refactor(ci): refactor docker-build-and-push action (#4948)
* cache only on no-cuda Signed-off-by: Yutaka Kondo <[email protected]> * version up Signed-off-by: Yutaka Kondo <[email protected]> * version up Signed-off-by: Yutaka Kondo <[email protected]> * rename Signed-off-by: Yutaka Kondo <[email protected]> * rename Signed-off-by: Yutaka Kondo <[email protected]> * rename to health-check Signed-off-by: Yutaka Kondo <[email protected]> * refactor action Signed-off-by: Yutaka Kondo <[email protected]> * remove old comment Signed-off-by: Yutaka Kondo <[email protected]> * revert free disk Signed-off-by: Yutaka Kondo <[email protected]> --------- Signed-off-by: Yutaka Kondo <[email protected]>
1 parent 766c81b commit 78f680e

File tree

3 files changed

+32
-56
lines changed

3 files changed

+32
-56
lines changed

.github/actions/docker-build-and-push/action.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ name: docker-build-and-push
22
description: ""
33

44
inputs:
5+
name:
6+
description: ""
7+
required: true
8+
platform:
9+
description: ""
10+
required: true
511
bake-target:
612
description: ""
713
required: true
@@ -35,6 +41,28 @@ runs:
3541
vcs import src < autoware.repos
3642
shell: bash
3743

44+
- name: Setup Docker Buildx
45+
uses: docker/setup-buildx-action@v3
46+
47+
- name: Restore cache
48+
uses: actions/cache/restore@v4
49+
with:
50+
path: |
51+
root-ccache
52+
key: cache-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('autoware.repos') }}
53+
restore-keys: |
54+
cache-${{ inputs.platform }}-${{ inputs.name }}-
55+
cache-${{ inputs.platform }}-
56+
57+
- name: Inject cache into docker
58+
uses: reproducible-containers/[email protected]
59+
with:
60+
cache-map: |
61+
{
62+
"root-ccache": "/root/.ccache"
63+
}
64+
skip-extraction: true
65+
3866
- name: Set Docker tags
3967
id: set-docker-tags
4068
run: |

.github/workflows/docker-build-and-push-self-hosted.yaml

+2-28
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
# EVENTS: push, schedule, workflow_dispatch
2-
# workflow_dispatch: Build all. No publish to registry; save as tarball.
3-
# schedule: Build only devel and prebuilt. TAGS: date, latest
4-
# push-branch: Build only devel and prebuilt. TAGS: date, latest
5-
# push-tag: Build all. TAGS: version, date, latest
6-
71
name: docker-build-and-push-self-hosted
82

93
on:
@@ -56,9 +50,6 @@ jobs:
5650
- name: Check out repository
5751
uses: actions/checkout@v4
5852

59-
- name: Setup Docker Buildx
60-
uses: docker/setup-buildx-action@v3
61-
6253
- name: Set git config
6354
uses: autowarefoundation/autoware-github-actions/set-git-config@v1
6455
with:
@@ -67,28 +58,11 @@ jobs:
6758
- name: Free disk space
6859
uses: ./.github/actions/free-disk-space
6960

70-
- name: Restore cache
71-
uses: actions/cache/restore@v4
72-
with:
73-
path: |
74-
root-ccache
75-
key: cache-${{ matrix.platform }}-${{ matrix.name }}-${{ hashFiles('autoware.repos') }}
76-
restore-keys: |
77-
cache-${{ matrix.platform }}-${{ matrix.name }}-
78-
cache-${{ matrix.platform }}-
79-
80-
- name: Inject cache into docker
81-
uses: reproducible-containers/[email protected]
82-
with:
83-
cache-map: |
84-
{
85-
"root-ccache": "/root/.ccache"
86-
}
87-
skip-extraction: true
88-
8961
- name: Build 'Autoware'
9062
uses: ./.github/actions/docker-build-and-push
9163
with:
64+
name: ${{ matrix.name }}
65+
platform: ${{ matrix.platform }}
9266
bake-target: autoware
9367
build-args: |
9468
*.platform=linux/${{ matrix.platform }}

.github/workflows/docker-build-and-push.yaml

+2-28
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
# EVENTS: push, schedule, workflow_dispatch
2-
# workflow_dispatch: Build all. No publish to registry; save as tarball.
3-
# schedule: Build only devel and prebuilt. TAGS: date, latest
4-
# push-branch: Build only devel and prebuilt. TAGS: date, latest
5-
# push-tag: Build all. TAGS: version, date, latest
6-
71
name: docker-build-and-push
82

93
on:
@@ -51,9 +45,6 @@ jobs:
5145
- name: Check out repository
5246
uses: actions/checkout@v4
5347

54-
- name: Setup Docker Buildx
55-
uses: docker/setup-buildx-action@v3
56-
5748
- name: Set git config
5849
uses: autowarefoundation/autoware-github-actions/set-git-config@v1
5950
with:
@@ -62,28 +53,11 @@ jobs:
6253
- name: Free disk space
6354
uses: ./.github/actions/free-disk-space
6455

65-
- name: Restore cache
66-
uses: actions/cache/restore@v4
67-
with:
68-
path: |
69-
root-ccache
70-
key: cache-${{ matrix.platform }}-${{ matrix.name }}-${{ hashFiles('autoware.repos') }}
71-
restore-keys: |
72-
cache-${{ matrix.platform }}-${{ matrix.name }}-
73-
cache-${{ matrix.platform }}-
74-
75-
- name: Inject cache into docker
76-
uses: reproducible-containers/[email protected]
77-
with:
78-
cache-map: |
79-
{
80-
"root-ccache": "/root/.ccache"
81-
}
82-
skip-extraction: true
83-
8456
- name: Build 'Autoware'
8557
uses: ./.github/actions/docker-build-and-push
8658
with:
59+
name: ${{ matrix.name }}
60+
platform: ${{ matrix.platform }}
8761
bake-target: autoware
8862
build-args: |
8963
*.platform=linux/${{ matrix.platform }}

0 commit comments

Comments
 (0)