Skip to content

Commit db7ad39

Browse files
Merge pull request #8 from SoftwareDefinedVehicle/main
Migration to latest version of source code
2 parents 189bc53 + 619bb2a commit db7ad39

File tree

95 files changed

+3494
-1870
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+3494
-1870
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Copyright 2022 Contributors to the Eclipse Foundation
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# SPDX-License-Identifier: Apache-2.0
16+
17+
name: Build and push container image
18+
19+
inputs:
20+
arch:
21+
required: true
22+
description: "Architecture amd64/arm64"
23+
run_number:
24+
required: true
25+
description: "Workflow run number"
26+
commit_hash:
27+
required: true
28+
description: "Git commit hash"
29+
username:
30+
required: true
31+
description: "User name"
32+
token:
33+
required: true
34+
description: "Auth token"
35+
36+
runs:
37+
using: "composite"
38+
steps:
39+
- id: repo_name
40+
uses: ASzc/change-string-case-action@v1
41+
with:
42+
string: ${{ github.repository }}
43+
44+
- name: Checkout repository
45+
uses: actions/checkout@v3
46+
with:
47+
submodules: recursive
48+
49+
# Workaround: https://github.com/docker/build-push-action/issues/461
50+
- name: Setup Docker buildx
51+
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
52+
53+
# Login against a Docker registry except on PR
54+
- name: Log into registry ghcr.io
55+
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
56+
with:
57+
registry: ghcr.io
58+
username: ${{ inputs.username }}
59+
password: ${{ inputs.token }}
60+
61+
# https://github.com/docker/build-push-action
62+
- name: Build and push docker image to ghcr.io
63+
id: build-and-push
64+
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
65+
with:
66+
push: true
67+
context: .
68+
platforms: linux/${{ inputs.arch }}
69+
file: Dockerfile.${{ inputs.arch }}
70+
labels: ${{ steps.meta.outputs.labels }}
71+
build-args: |
72+
GITHUB_RUN_NUMBER=${{ inputs.run_number }}
73+
GITHUB_COMMIT_HASH=${{ inputs.commit_hash }}
74+
tags: |
75+
ghcr.io/${{ steps.repo_name.outputs.lowercase }}/self-update-agent:latest_${{ inputs.arch }}
76+
ghcr.io/${{ steps.repo_name.outputs.lowercase }}/self-update-agent:build-${{ inputs.run_number }}_${{ inputs.arch }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Copyright 2022 Contributors to the Eclipse Foundation
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# SPDX-License-Identifier: Apache-2.0
16+
17+
name: Build native binaries
18+
19+
inputs:
20+
arch:
21+
required: true
22+
description: "Architecture amd64/arm64"
23+
run_number:
24+
required: true
25+
description: "Workflow run number"
26+
27+
runs:
28+
using: "composite"
29+
steps:
30+
- uses: actions/checkout@v3
31+
with:
32+
submodules: recursive
33+
34+
# Remove apt repos that are known to break from time to time
35+
- name: Remove broken apt repos
36+
run: |
37+
for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done
38+
shell: bash
39+
40+
- name: Install tools
41+
run: |
42+
sudo apt-get install apt-transport-https --yes
43+
sudo apt-get -y update
44+
sudo apt-get -y upgrade
45+
sudo apt-get -y install autoconf binutils cmake file \
46+
gcc g++ git libtool make \
47+
build-essential libcurl4-openssl-dev \
48+
binutils-aarch64-linux-gnu gcc-9-aarch64-linux-gnu g++-9-aarch64-linux-gnu \
49+
python3 python3-pip python3-setuptools python3-wheel ninja-build python3-pip \
50+
libselinux1-dev libmount-dev libmount1 libblkid-dev
51+
pip3 install meson
52+
shell: bash
53+
54+
- name: Build for ${{ inputs.arch }}
55+
run: |
56+
mkdir build_${{ inputs.arch }}
57+
./scripts/build_openssl_${{ inputs.arch }}.sh
58+
./scripts/build_glib_${{ inputs.arch }}.sh
59+
cd build_${{ inputs.arch }}
60+
cmake \
61+
-DCMAKE_INSTALL_PREFIX=../dist_${{ inputs.arch }} \
62+
-DCMAKE_TOOLCHAIN_FILE=../cmake/linux/${{ matrix.arch }}/toolchain.cmake \
63+
-DOPENSSL_ROOT_DIR=../build_${{ matrix.arch }} \
64+
-DOPENSSL_CRYPTO_LIBRARY=../build_${{ matrix.arch }}/lib/libcrypto.so \
65+
-DSUA_BUILD_NUMBER=${{ inputs.run_number }} ..
66+
make
67+
make install
68+
shell: bash
69+
70+
- name: Run unit tests
71+
if: ${{ inputs.arch=='amd64' }}
72+
run: |
73+
cd dist_${{ inputs.arch }}/utest
74+
./TestSDVSelfUpdateAgent
75+
shell: bash
76+
77+
- name: Compress artifacts
78+
run: |
79+
tar -czvf self-update-agent-${{ inputs.arch }}-build-${{ inputs.run_number }}.tar.gz \
80+
--transform s/dist_${{ inputs.arch }}/self-update-agent-${{ inputs.arch }}-build-${{ inputs.run_number }}/ \
81+
--exclude=dist_${{ inputs.arch }}/lib/cmake \
82+
--exclude=dist_${{ inputs.arch }}/lib/pkgconfig \
83+
dist_${{ inputs.arch }}/bin/sdv-self-update-agent \
84+
dist_${{ inputs.arch }}/lib
85+
shell: bash
86+

.github/workflows/docker-publish.yml

-111
This file was deleted.

.github/workflows/main.yaml

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Copyright 2022 Contributors to the Eclipse Foundation
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# SPDX-License-Identifier: Apache-2.0
16+
17+
name: Build All
18+
19+
on:
20+
push:
21+
branches: [ main ]
22+
pull_request:
23+
branches: [ main ]
24+
25+
jobs:
26+
build-container-image:
27+
runs-on: ubuntu-latest
28+
permissions:
29+
contents: read
30+
packages: write
31+
id-token: write
32+
strategy:
33+
matrix:
34+
arch: [ amd64, arm64 ]
35+
steps:
36+
- uses: actions/checkout@v3
37+
with:
38+
submodules: recursive
39+
40+
- name: Build Docker image
41+
uses: ./.github/actions/build-container-image
42+
with:
43+
arch: ${{ matrix.arch }}
44+
run_number: ${{ github.run_number }}
45+
commit_hash: ${{ github.sha }}
46+
username: ${{ github.actor }}
47+
token: ${{ secrets.GITHUB_TOKEN }}
48+
49+
push-container-image:
50+
runs-on: ubuntu-latest
51+
needs: build-container-image
52+
steps:
53+
- uses: actions/checkout@v3
54+
with:
55+
submodules: recursive
56+
57+
- id: repo_name
58+
uses: ASzc/change-string-case-action@v1
59+
with:
60+
string: ${{ github.repository }}
61+
62+
- name: Log into registry ghcr.io
63+
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
64+
with:
65+
registry: ghcr.io
66+
username: ${{ github.actor }}
67+
password: ${{ secrets.GITHUB_TOKEN }}
68+
69+
- name: Create merged manifest and push
70+
env:
71+
REPO: ghcr.io/${{ steps.repo_name.outputs.lowercase }}
72+
run: |
73+
docker buildx imagetools create -t ghcr.io/${{ steps.repo_name.outputs.lowercase }}/self-update-agent:build-${{ github.run_number }} ghcr.io/${{ steps.repo_name.outputs.lowercase }}/self-update-agent:build-${{ github.run_number }}_arm64 ghcr.io/${{ steps.repo_name.outputs.lowercase }}/self-update-agent:build-${{ github.run_number }}_amd64 ghcr.io/${{ steps.repo_name.outputs.lowercase }}/self-update-agent:latest ghcr.io/${{ steps.repo_name.outputs.lowercase }}/self-update-agent:latest_arm64 ghcr.io/${{ steps.repo_name.outputs.lowercase }}/self-update-agent:latest_amd64
74+
build-native-binary:
75+
runs-on: ubuntu-latest
76+
strategy:
77+
matrix:
78+
arch: [ arm64, amd64 ]
79+
steps:
80+
- uses: actions/checkout@v3
81+
with:
82+
submodules: recursive
83+
84+
- name: Build native binary
85+
id: build-native-binary
86+
uses: ./.github/actions/build-native-binary
87+
with:
88+
arch: ${{ matrix.arch }}
89+
run_number: ${{ github.run_number }}
90+
91+
- name: Upload ${{ matrix.arch }} artifact to workspace
92+
uses: actions/upload-artifact@v3
93+
with:
94+
name: self-update-agent-${{ matrix.arch }}-build-${{ github.run_number }}.tar.gz
95+
path: self-update-agent-${{ matrix.arch }}-build-${{ github.run_number }}.tar.gz
96+
97+
upload-native-binary:
98+
runs-on: ubuntu-latest
99+
needs: build-native-binary
100+
steps:
101+
- uses: actions/checkout@v3
102+
with:
103+
submodules: recursive
104+
105+
- name: Download artifacts
106+
uses: actions/download-artifact@v2
107+
108+
- name: Upload artifacts to build results
109+
uses: marvinpinto/action-automatic-releases@latest
110+
with:
111+
repo_token: ${{ secrets.GITHUB_TOKEN }}
112+
draft: false
113+
prerelease: true
114+
automatic_release_tag: build_${{ github.run_number }}
115+
title: "Build ${{ github.run_number }}"
116+
files: "**/self-update-agent-*-build-${{ github.run_number }}.tar.gz"
117+

0 commit comments

Comments
 (0)