-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (94 loc) · 3.45 KB
/
lib-build.yml
File metadata and controls
109 lines (94 loc) · 3.45 KB
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
name: lib-build reusable
on:
workflow_call:
inputs:
base_image:
required: true
type: string
sdk_ver:
required: true
type: string
soc:
required: true
type: string
cpu:
required: true
type: string
secrets:
env_PAT:
required: true
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.env_PAT }}
- name: Set environment variables
id: set_env
run: |
base_image=${{ inputs.base_image }}
docker_tag=vision-apps-builder:${{ inputs.sdk_ver }}-arm64-${base_image//:/}
remote_docker_tag=ghcr.io/${{ github.repository_owner }}/$docker_tag
remote_docker_tag=${remote_docker_tag,,}
pkg_name=libti-vision-apps-${{ inputs.soc }}_${{ inputs.sdk_ver }}-${base_image//:/}.deb
soc=${{ inputs.soc }}
soc_upper=${soc^^}
pkg_path=workarea/vision_apps/out/${soc_upper}/${{ inputs.cpu }}/LINUX/release/${pkg_name}
echo "docker_tag=${docker_tag}" >> $GITHUB_ENV
echo "remote_docker_tag=${remote_docker_tag}" >> $GITHUB_ENV
echo "pkg_name=${pkg_name}" >> $GITHUB_ENV
echo "pkg_path=${pkg_path}" >> $GITHUB_ENV
- name: Pull and tag Docker image
run: |
set -e
docker pull $remote_docker_tag || { echo "Failed to pull Docker image."; exit 1; }
docker tag $remote_docker_tag $docker_tag
docker images
- name: Install repo tool
run: |
set -e
mkdir -p ~/bin
export PATH="${HOME}/bin:${PATH}"
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+rx ~/bin/repo
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1
- name: Install source repos
run: |
set -e
export PATH="${HOME}/bin:${PATH}"
BASE_IMAGE=${{ inputs.base_image }} ./init_setup.sh
- name: Build the vision-apps lib
run: |
set -e
# Remove '-it' in docker-run command in docker_run.sh
sed -i.bak 's/docker run -it --rm \\/docker run --rm --platform linux\/arm64 \\/' docker_run.sh
# Build the vision-apps lib
BASE_IMAGE=${{ inputs.base_image }} SOC=${{ inputs.soc }} ./docker_run.sh ./vision_apps_build.sh
- name: Check for output files
run: |
set -e
find workarea/vision_apps/out -name "libtivision_apps*.so" || { echo "Shared object not found."; exit 1; }
find workarea/vision_apps/out -name "libti-vision-apps*.deb" || { echo "Deb package not found."; exit 1; }
- name: Move output file to release folder
run: |
set -e
mkdir -p release
cp ${{ env.pkg_path }} release
find release -name "${{ env.pkg_name }}" || { echo "Deb package not found."; exit 1; }
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.pkg_name }}
path: release