forked from AxisCommunications/acap-runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (118 loc) · 3.86 KB
/
ci-cd-acap-runtime-proto.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
# yamllint disable rule:line-length
---
name: Proto Build Workflow
on:
# push:
# branches:
# - "main"
# tags:
# # semver, e.g. 1.2.0 (does not match 0.1.2)
# - "[1-9]+.[0-9]+.[0-9]+"
# # semver with prerelease info, e.g. 1.0.2-beta.1 or 1.2.3-rc.10
# - "[1-9]+.[0-9]+.[0-9]+-[a-z]+.[0-9]+"
# # do not match prerelease starting w/ 0, e.g. 1.0.2-beta.0 or 1.2.3-rc.01
# - "![1-9]+.[0-9]+.[0-9]+-[a-z]+.[0]*"
# # semver with date info, e.g. 1.0.2-20221125
# - "[1-9]+.[0-9]+.[0-9]+-[0-9]+"
# # do not match date starting w/ 0, e.g. 1.0.2-01232023
# - "![1-9]+.[0-9]+.[0-9]+-[0]*"
pull_request:
branches:
- "main"
workflow_dispatch:
jobs:
build_proto_image:
name: Build Proto Image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Create image metadata
id: meta
uses: ./.github/actions/metadata-action
with:
repository: axisecp/acap-runtime
get_version: "true"
- name: Check permissions
run: |
whoami
id
ls -l /var/lib/apt/lists/
- name: Check system info
run: |
uname -a
arch
- name: List installed packages
run: |
dpkg -l
- name: Check Docker version
run: |
docker version
docker info
- name: Build Proto image
uses: ./.github/actions/docker-build-push-action
with:
dockerfile: ./Dockerfile.proto
push: false
load: true
tags: axisecp/acap-runtime:${{ steps.meta.outputs.version }}-protofiles
use_qemu: true
- name: List Docker images
run: docker images
- name: Extract proto files
run: |
container_id=$(docker create axisecp/acap-runtime:${{ steps.meta.outputs.version }}-protofiles)
docker cp $container_id:/build/param/proto_utils ./proto_utils_param
docker cp $container_id:/build/vdo/proto_utils ./proto_utils_vdo
docker cp $container_id:/build/tf/proto_utils ./proto_utils_tf
docker rm $container_id
- name: Verify proto files
run: |
echo "Verifying proto files..."
# Check param proto files
if [ "$(ls -A ./proto_utils_param)" ]; then
echo "param proto files found:"
ls -l ./proto_utils_param
else
echo "Error: param proto files are missing"
exit 1
fi
# Check vdo proto files
if [ "$(ls -A ./proto_utils_vdo)" ]; then
echo "vdo proto files found:"
ls -l ./proto_utils_vdo
else
echo "Error: vdo proto files are missing"
exit 1
fi
# Check tf proto files
if [ "$(ls -A ./proto_utils_tf)" ]; then
echo "tf proto files found:"
ls -l ./proto_utils_tf
else
echo "Error: tf proto files are missing"
exit 1
fi
echo "All proto files verified successfully"
- name: Upload proto files artifacts
uses: actions/upload-artifact@v4
with:
name: proto-files
path: |
./proto_utils_param
./proto_utils_vdo
./proto_utils_tf
- name: Push Proto image
if: success() && github.event_name != 'pull_request'
uses: ./.github/actions/docker-build-push-action
with:
dockerfile: ./Dockerfile.proto
push: false # true
tags: axisecp/acap-runtime:${{ steps.meta.outputs.version }}-protofiles
registry_user: ${{ secrets.ECOSYSTEM_SERVICE_USER_DOCKER_HUB }}
registry_token: ${{ secrets.ECOSYSTEM_ACCESS_TOKEN_DOCKER_HUB }}
# - name: Clean up
# if: always()
# run: |
# docker image prune -af
#