-
Notifications
You must be signed in to change notification settings - Fork 11
124 lines (111 loc) · 4.36 KB
/
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
name: build
on:
push:
branches: [ "develop-sdk12" ]
pull_request:
branches: [ "develop-sdk12" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
prepare_container:
runs-on: self-hosted
outputs:
uid: ${{ steps.uid_step.outputs.user }}
gid: ${{ steps.uid_step.outputs.userid }}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Get user id/group
id: uid_step
run: |
echo "user=$(id -un)" >> "$GITHUB_OUTPUT"
echo "userid=$(id -u)" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-config: /etc/docker/cibuilder.toml
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
registry: ciserver.ci:5000
username: ${{ secrets.CI_CACHE_REGISTRY_LOGIN }}
password: ${{ secrets.CI_CACHE_REGISTRY_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: docker
push: true
tags: ciserver.ci:5000/${{ github.repository_id }}:sdk12
cache-from: type=registry,ref=ciserver.ci:5000/${{ github.repository_id }}:cache
cache-to: type=registry,ref=ciserver.ci:5000/${{ github.repository_id }}:cache,mode=max
build-args: |
user=${{ steps.uid_step.outputs.user }}
userid=${{ steps.uid_step.outputs.userid }}
build_images:
needs: prepare_container
runs-on: self-hosted
timeout-minutes: 1080
container:
image: ciserver.ci:5000/${{ github.repository_id }}:sdk12
credentials:
username: ${{ secrets.CI_CACHE_REGISTRY_LOGIN }}
password: ${{ secrets.CI_CACHE_REGISTRY_PASSWORD }}
options: --user "${{ needs.prepare_container.outputs.uid }}:${{ needs.prepare_container.outputs.gid }}"
outputs:
build_tag: ${{ steps.tag_step.outputs.build_tag }}
steps:
- name: Checkout pull-request version of lx2160a_build
uses: actions/checkout@v4
- name: Get build tag
shell: bash {0}
id: tag_step
run: |
build_tag=$(date +%Y-%m-%d)_$(git rev-parse --short HEAD)
echo "build_tag=$build_tag" >> "$GITHUB_OUTPUT"
- name: Build
shell: bash -x {0}
run: |
for env in spi mmc:0:0 mmc:0:1 mmc:0:2 mmc:1:0; do for config in 0 1 2 3; do for distro in debian ubuntu; do UBOOT_ENVIRONMENT=$env BOARD_CONFIG=$config DISTRO=$distro ./runme.sh; done; done; done
- name: Select artifacts for publishing
shell: bash -e {0}
run: |
mkdir -p deploy/u-boot
cp -L -v images/*.bin deploy/u-boot
cp -L -v images/*.img deploy
xz -9 deploy/*.img
- name: Deploy to the local minio storage
uses: yakubique/[email protected]
with:
endpoint: http://ciserver.ci:9000
insecure: true
access_key: ${{ secrets.CI_CACHE_MINIO_ACCESS }}
secret_key: ${{ secrets.CI_CACHE_MINIO_SECRET }}
bucket: cipublish
source: ./deploy
target: "/${{ github.repository_id }}/${{ steps.tag_step.outputs.build_tag }}"
recursive: true
publish_images:
needs: build_images
runs-on: self-hosted
if: github.ref == 'refs/heads/develop-sdk12' && github.event_name != 'pull_request'
steps:
- name: Download an artifacts from MinIO
uses: yakubique/[email protected]
with:
endpoint: http://ciserver.ci:9000
insecure: true
access_key: ${{ secrets.CI_CACHE_MINIO_ACCESS }}
secret_key: ${{ secrets.CI_CACHE_MINIO_SECRET }}
bucket: cipublish
source: "/${{ github.repository_id }}/${{ needs.build_images.outputs.build_tag }}/"
target: "."
recursive: true
- name: Upload to S3
uses: shallwefootball/[email protected]
with:
aws_key_id: ${{ secrets.IMAGES_S3_ACCESS }}
aws_secret_access_key: ${{ secrets.IMAGES_S3_SECRET }}
aws_bucket: ${{ secrets.IMAGES_S3_BUCKET }}
endpoint: ${{ secrets.IMAGES_S3_HOST }}
source_dir: deploy
destination_dir: CN913x/cn913x_build/sdk12/${{ needs.build_images.outputs.build_tag }}