-
Notifications
You must be signed in to change notification settings - Fork 11
174 lines (140 loc) · 5.91 KB
/
ci-pipeline.yml
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: CI
on:
push:
# Publish `master` as Docker `latest` image.
branches:
- master
# Publish `v1.2.3` tags as releases.
tags:
- v*
# Run tests for any PRs
pull_request:
jobs:
x86_64:
runs-on: ubuntu-20.04
env:
IMAGE_DIR: ${{matrix.image}}
IMAGE_NAME: odp-ci-${{matrix.image}}
strategy:
fail-fast: false
matrix:
image: ['ubuntu_18.04-i386',
'ubuntu_20.04-arm64',
'ubuntu_20.04-armhf',
'ubuntu_20.04-ppc64el',
'ubuntu_20.04-riscv64',
'ubuntu_20.04-x86_64',
'ubuntu_20.04-x86_64-dpdk_19.11',
'ubuntu_20.04-x86_64-dpdk_20.11',
'ubuntu_20.04-x86_64-dpdk_21.11',
'ubuntu_20.04-x86_64-dpdk_22.11',
'ubuntu_20.04-x86_64-dpdk_23.11',
'ubuntu_22.04-x86_64',
'ubuntu_22.04-x86_64-static',
'ubuntu_23.04-x86_64',
'centos_7-x86_64',
'rocky_linux_8-x86_64',
'rocky_linux_9-x86_64']
steps:
- uses: actions/checkout@v4
- name: Build image
run: docker build $IMAGE_DIR -t $IMAGE_NAME
- name: Log into registry
if: github.event_name == 'push'
run: echo "${{ secrets.CONTAINER_REGISTRY_TOKEN }}" | docker login ghcr.io -u ${{ secrets.CONTAINER_REGISTRY_USER }} --password-stdin
- name: Push image
if: github.event_name == 'push'
run: |
IMAGE_ID=ghcr.io/${{ github.repository }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
arm64:
# Ensuring CI is only run on repo where self-hosted runners are installed
if: ${{ github.repository == 'OpenDataPlane/odp-docker-images' }}
runs-on: self-hosted
env:
IMAGE_DIR: ${{matrix.image}}
IMAGE_NAME: odp-ci-${{matrix.image}}
strategy:
fail-fast: false
matrix:
image: ['ubuntu_20.04-arm64-native',
'ubuntu_20.04-arm64-native-dpdk_19.11',
'ubuntu_20.04-arm64-native-dpdk_20.11',
'ubuntu_20.04-arm64-native-dpdk_21.11',
'ubuntu_20.04-arm64-native-dpdk_22.11',
'ubuntu_20.04-arm64-native-dpdk_23.11',
'ubuntu_22.04-arm64-native',
'ubuntu_23.04-arm64-native',
'rocky_linux_8-arm64-native',
'rocky_linux_9-arm64-native']
steps:
- uses: actions/checkout@v3
- name: Build image
run: docker build $IMAGE_DIR -t $IMAGE_NAME
- name: Log into registry
if: github.event_name == 'push'
run: echo "${{ secrets.CONTAINER_REGISTRY_TOKEN }}" | docker login ghcr.io -u ${{ secrets.CONTAINER_REGISTRY_USER }} --password-stdin
- name: Push image
if: github.event_name == 'push'
run: |
IMAGE_ID=ghcr.io/${{ github.repository }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
Coverity:
runs-on: ubuntu-20.04
env:
COVERITY_TOKEN_ODP: ${{ secrets.COVERITY_TOKEN_ODP }}
COVERITY_TOKEN_ODP_DPDK: ${{ secrets.COVERITY_TOKEN_ODP_DPDK }}
IMAGE_DIR: ${{matrix.image}}
IMAGE_NAME: odp-ci-${{matrix.image}}
strategy:
fail-fast: false
matrix:
image: ['ubuntu_20.04-x86_64-coverity-linux-generic',
'ubuntu_20.04-x86_64-coverity-linux-dpdk']
steps:
- uses: actions/checkout@v4
- name: Build linux-generic image
if: ${{ env.COVERITY_TOKEN_ODP && env.IMAGE_DIR == 'ubuntu_20.04-x86_64-coverity-linux-generic' }}
run: |
docker build --build-arg COVERITY_TOKEN=${{ secrets.COVERITY_TOKEN_ODP }} $IMAGE_DIR -t $IMAGE_NAME
echo "push_image=true" >> $GITHUB_ENV
- name: Build linux-dpdk image
if: ${{ env.COVERITY_TOKEN_ODP_DPDK && env.IMAGE_DIR == 'ubuntu_20.04-x86_64-coverity-linux-dpdk' }}
run: |
docker build --build-arg COVERITY_TOKEN=${{ secrets.COVERITY_TOKEN_ODP_DPDK }} $IMAGE_DIR -t $IMAGE_NAME
echo "push_image=true" >> $GITHUB_ENV
- name: Log into registry
if: env.push_image
run: echo "${{ secrets.CONTAINER_REGISTRY_TOKEN }}" | docker login ghcr.io -u ${{ secrets.CONTAINER_REGISTRY_USER }} --password-stdin
- name: Push image
if: env.push_image
run: |
IMAGE_ID=ghcr.io/${{ github.repository }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION