-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
Copy pathaction.yaml
112 lines (100 loc) · 3.37 KB
/
action.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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:
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- 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 ccache
uses: actions/cache@v4
if: ${{ inputs.name == 'no-cuda' && github.ref == 'refs/heads/main' }}
id: cache-ccache
with:
path: |
root-ccache
key: ccache-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('src/**/*.cpp') }}
restore-keys: |
ccache-${{ inputs.platform }}-${{ inputs.name }}-
ccache-${{ inputs.platform }}-
- name: Cache apt-get
uses: actions/cache@v4
if: ${{ inputs.name == 'no-cuda' && github.ref == 'refs/heads/main' }}
id: cache-apt-get
with:
path: |
var-cache-apt
key: apt-get-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('src/**/package.xml') }}
restore-keys: |
apt-get-${{ inputs.platform }}-${{ inputs.name }}-
apt-get-${{ inputs.platform }}-
- name: Restore ccache
uses: actions/cache/restore@v4
if: ${{ inputs.name != 'no-cuda' || github.ref != 'refs/heads/main' }}
with:
path: |
root-ccache
key: ccache-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('src/**/*.cpp') }}
restore-keys: |
ccache-${{ inputs.platform }}-${{ inputs.name }}-
ccache-${{ inputs.platform }}-
- name: Restore apt-get
uses: actions/cache/restore@v4
if: ${{ inputs.name != 'no-cuda' || github.ref != 'refs/heads/main' }}
with:
path: |
var-cache-apt
key: apt-get-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('src/**/package.xml') }}
restore-keys: |
apt-get-${{ inputs.platform }}-${{ inputs.name }}-
apt-get-${{ inputs.platform }}-
- name: Inject cache into docker
uses: reproducible-containers/buildkit-cache-dance@v3.1.2
with:
cache-map: |
{
"root-ccache": "/root/.ccache",
"var-cache-apt": "/var/cache/apt"
}
skip-extraction: ${{ steps.cache-ccache.outputs.cache-hit && steps.cache-apt-get.outputs.cache-hit }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- name: Run docker build
uses: docker/build-push-action@v6
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 }}