This repository has been archived by the owner on Sep 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
156 lines (137 loc) · 5.37 KB
/
someip2val_build.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
# /********************************************************************************
# * Copyright (c) 2022 Contributors to the Eclipse Foundation
# *
# * See the NOTICE file(s) distributed with this work for additional
# * information regarding copyright ownership.
# *
# * This program and the accompanying materials are made available under the
# * terms of the Apache License 2.0 which is available at
# * http://www.apache.org/licenses/LICENSE-2.0
# *
# * SPDX-License-Identifier: Apache-2.0
# ********************************************************************************/
name: someip2val-build
on:
push:
branches: [ main ]
pull_request:
paths:
- ".github/workflows/someip2val_build.yml"
- "someip2val/**"
workflow_dispatch:
inputs:
build_binaries:
description: 'Build Binaries'
required: false
default: 'false'
jobs:
checkrights:
uses: ./.github/workflows/check_push_rights.yml
secrets: inherit
build:
name: Build Binaries
# build if explicitly requested or merging to main
if: ${{ github.event.inputs.build_binaries == 'true' || (needs.checkrights.outputs.have_secrets == 'true' && github.event_name != 'pull_request') }}
# reduce runtime requirements from ubuntu, ubuntu-18.04 fails for aarch64
runs-on: ubuntu-20.04
strategy:
matrix:
target-arch: [x86_64, aarch64]
fail-fast: true
steps:
- name: Install Pre-requisities
run: |
sudo apt-get update -qqy && \
sudo apt-get install -qqy --no-install-recommends \
cmake g++ build-essential \
g++-aarch64-linux-gnu binutils-aarch64-linux-gnu \
jq python3 python3-pip python3-setuptools &&
pip3 install conan==1.55.0
- name: Checkout
uses: actions/checkout@v3
- name: Run build
working-directory: ${{github.workspace}}/someip2val
run: ./build-release.sh ${{ matrix.target-arch }}
- name: Upload Binaries
uses: actions/upload-artifact@v3
with:
name: someip2val_${{ matrix.target-arch }}_release
path: |
${{github.workspace}}/someip2val/target/${{ matrix.target-arch }}/release/install/bin
${{github.workspace}}/someip2val/target/${{ matrix.target-arch }}/release/install/lib/libvsomeip*.so.3
if-no-files-found: error
build_docker:
# reduce runtime requirements from ubuntu, ubuntu-18.04 fails for aarch64
runs-on: ubuntu-20.04
name: Build Docker
needs: checkrights
steps:
- name: Check Setup
env:
OUT_HAVE_SECRETS: ${{ needs.checkrights.outputs.have_secrets }}
OUT_USER_NAME: ${{ github.repository_owner }}
OUT_EVENT_NAME: ${{ github.event_name }}
run: |
echo
echo "### have_secrets : $OUT_HAVE_SECRETS"
echo "### username : $OUT_USER_NAME"
echo "### event_name : $OUT_EVENT_NAME"
echo
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@v2
if: needs.checkrights.outputs.have_secrets == 'true'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository }}/someip-feeder
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: "Build someip2val container and push to ghcr.io"
if: ${{ needs.checkrights.outputs.have_secrets == 'true' && github.event_name != 'pull_request' }}
id: image_build_ghcr
uses: docker/build-push-action@v4
with:
pull: false
push: true
file: ./someip2val/Dockerfile
context: "./someip2val"
platforms: linux/amd64, linux/arm64
tags: |
${{ steps.meta.outputs.tags }}
ttl.sh/kuksa.val.feeders/someip-feeder-${{github.sha}}
labels: ${{ steps.meta.outputs.labels }}
# Provenance to solve that an unknown/unkown image is shown on ghcr.io
# Same problem as described in https://github.com/orgs/community/discussions/45969
provenance: false
- name: "Build someip2val container and push to ttl.sh"
if: ${{ needs.checkrights.outputs.have_secrets != 'true' || github.event_name == 'pull_request' }}
id: image_build_ttl
uses: docker/build-push-action@v4
with:
pull: false
push: true
file: ./someip2val/Dockerfile
context: "./someip2val"
platforms: linux/amd64, linux/arm64
tags: |
ttl.sh/kuksa.val.feeders/someip-feeder-${{github.sha}}
labels: ${{ steps.meta.outputs.labels }}
# Provenance to solve that an unknown/unkown image is shown on ghcr.io
# Same problem as described in https://github.com/orgs/community/discussions/45969
provenance: false