Skip to content

Commit

Permalink
refactor(ci): refactor docker-build-and-push action (#4948)
Browse files Browse the repository at this point in the history
* cache only on no-cuda

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* version up

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* version up

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* rename

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* rename

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* rename to health-check

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* refactor action

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* remove old comment

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

* revert free disk

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>

---------

Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>
  • Loading branch information
youtalk committed Jul 5, 2024
1 parent 766c81b commit 78f680e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 56 deletions.
28 changes: 28 additions & 0 deletions .github/actions/docker-build-and-push/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ name: docker-build-and-push
description: ""

inputs:
name:
description: ""
required: true
platform:
description: ""
required: true
bake-target:
description: ""
required: true
Expand Down Expand Up @@ -35,6 +41,28 @@ runs:
vcs import src < autoware.repos
shell: bash

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Restore cache
uses: actions/cache/restore@v4
with:
path: |
root-ccache
key: cache-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('autoware.repos') }}
restore-keys: |
cache-${{ inputs.platform }}-${{ inputs.name }}-
cache-${{ inputs.platform }}-
- name: Inject cache into docker
uses: reproducible-containers/buildkit-cache-dance@v3.1.2
with:
cache-map: |
{
"root-ccache": "/root/.ccache"
}
skip-extraction: true

- name: Set Docker tags
id: set-docker-tags
run: |
Expand Down
30 changes: 2 additions & 28 deletions .github/workflows/docker-build-and-push-self-hosted.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# EVENTS: push, schedule, workflow_dispatch
# workflow_dispatch: Build all. No publish to registry; save as tarball.
# schedule: Build only devel and prebuilt. TAGS: date, latest
# push-branch: Build only devel and prebuilt. TAGS: date, latest
# push-tag: Build all. TAGS: version, date, latest

name: docker-build-and-push-self-hosted

on:
Expand Down Expand Up @@ -56,9 +50,6 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set git config
uses: autowarefoundation/autoware-github-actions/set-git-config@v1
with:
Expand All @@ -67,28 +58,11 @@ jobs:
- name: Free disk space
uses: ./.github/actions/free-disk-space

- name: Restore cache
uses: actions/cache/restore@v4
with:
path: |
root-ccache
key: cache-${{ matrix.platform }}-${{ matrix.name }}-${{ hashFiles('autoware.repos') }}
restore-keys: |
cache-${{ matrix.platform }}-${{ matrix.name }}-
cache-${{ matrix.platform }}-
- name: Inject cache into docker
uses: reproducible-containers/buildkit-cache-dance@v3.1.2
with:
cache-map: |
{
"root-ccache": "/root/.ccache"
}
skip-extraction: true

- name: Build 'Autoware'
uses: ./.github/actions/docker-build-and-push
with:
name: ${{ matrix.name }}
platform: ${{ matrix.platform }}
bake-target: autoware
build-args: |
*.platform=linux/${{ matrix.platform }}
Expand Down
30 changes: 2 additions & 28 deletions .github/workflows/docker-build-and-push.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# EVENTS: push, schedule, workflow_dispatch
# workflow_dispatch: Build all. No publish to registry; save as tarball.
# schedule: Build only devel and prebuilt. TAGS: date, latest
# push-branch: Build only devel and prebuilt. TAGS: date, latest
# push-tag: Build all. TAGS: version, date, latest

name: docker-build-and-push

on:
Expand Down Expand Up @@ -51,9 +45,6 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set git config
uses: autowarefoundation/autoware-github-actions/set-git-config@v1
with:
Expand All @@ -62,28 +53,11 @@ jobs:
- name: Free disk space
uses: ./.github/actions/free-disk-space

- name: Restore cache
uses: actions/cache/restore@v4
with:
path: |
root-ccache
key: cache-${{ matrix.platform }}-${{ matrix.name }}-${{ hashFiles('autoware.repos') }}
restore-keys: |
cache-${{ matrix.platform }}-${{ matrix.name }}-
cache-${{ matrix.platform }}-
- name: Inject cache into docker
uses: reproducible-containers/buildkit-cache-dance@v3.1.2
with:
cache-map: |
{
"root-ccache": "/root/.ccache"
}
skip-extraction: true

- name: Build 'Autoware'
uses: ./.github/actions/docker-build-and-push
with:
name: ${{ matrix.name }}
platform: ${{ matrix.platform }}
bake-target: autoware
build-args: |
*.platform=linux/${{ matrix.platform }}
Expand Down

0 comments on commit 78f680e

Please sign in to comment.