Skip to content

Commit

Permalink
refactor action
Browse files Browse the repository at this point in the history
Signed-off-by: Yutaka Kondo <[email protected]>
  • Loading branch information
youtalk committed Jul 4, 2024
1 parent 8a4d143 commit 149e589
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 46 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/[email protected]
with:
cache-map: |
{
"root-ccache": "/root/.ccache"
}
skip-extraction: true

- name: Set Docker tags
id: set-docker-tags
run: |
Expand Down
23 changes: 2 additions & 21 deletions .github/workflows/docker-build-and-push-self-hosted.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,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 +64,12 @@ 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/[email protected]
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
27 changes: 2 additions & 25 deletions .github/workflows/docker-build-and-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,39 +51,16 @@ 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:
token: ${{ secrets.GITHUB_TOKEN }}

- 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/[email protected]
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 149e589

Please sign in to comment.