-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ci): save cache on
build-main
workflows and only restore cache…
… on `docker-build-and-push-main` workflows (#4865) * fix ccache_dir Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp> * update build-main Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp> * restore only Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp> * reorder Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp> * MUST REVERT Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp> * add cache-tag-suffix arg Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp> * rename Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp> * Revert "MUST REVERT" This reverts commit adced0d. * Revert "Revert "MUST REVERT"" This reverts commit 7004dbe. * Revert "Revert "Revert "MUST REVERT""" This reverts commit e6d62e4. --------- Signed-off-by: Yutaka Kondo <yutaka.kondo@youtalk.jp>
- Loading branch information
Showing
6 changed files
with
101 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: docker-build | ||
description: "" | ||
|
||
inputs: | ||
name: | ||
description: "" | ||
required: true | ||
platform: | ||
description: "" | ||
required: true | ||
cache-tag-suffix: | ||
description: "" | ||
required: true | ||
build-args: | ||
description: "" | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Setup Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Install vcstool | ||
run: | | ||
sudo apt-get -y update | ||
sudo apt-get -y install python3-pip | ||
pip install --no-cache-dir vcstool | ||
shell: bash | ||
|
||
- name: Run vcs import | ||
run: | | ||
mkdir src | ||
vcs import src < autoware.repos | ||
shell: bash | ||
|
||
- name: Cache | ||
uses: actions/cache@v3 | ||
id: cache | ||
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.0 | ||
with: | ||
cache-map: | | ||
{ | ||
"root-ccache": "/root/.ccache" | ||
} | ||
skip-extraction: ${{ steps.cache.outputs.cache-hit }} | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ github.token }} | ||
|
||
- name: Run docker build | ||
uses: docker/build-push-action@v5 | ||
with: | ||
file: docker/Dockerfile | ||
context: . | ||
push: false | ||
build-args: ${{ inputs.build-args }} | ||
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:${{ inputs.name }}-${{ inputs.platform }}-${{ inputs.cache-tag-suffix }} | ||
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:${{ inputs.name }}-${{ inputs.platform }}-${{ inputs.cache-tag-suffix }},mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters