-
Notifications
You must be signed in to change notification settings - Fork 147
143 lines (133 loc) · 5.23 KB
/
build-opencv-base-container.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
name: Build OpenCV Base
on:
push:
branches: [ main ]
paths:
- .github/actions/build-intermediate/**
- .github/workflows/build-opencv-base-container.yml
- build/containers/intermediate/Dockerfile.opencvsharp-build
- build/intermediate-containers.mk
- Makefile
pull_request:
types: [opened, synchronize, reopened, labeled]
branches: [ main ]
paths:
- .github/actions/build-intermediate/**
- .github/workflows/build-opencv-base-container.yml
- build/containers/intermediate/Dockerfile.opencvsharp-build
- build/intermediate-containers.mk
- Makefile
issue_comment:
types: [created, edited]
branches: [ main ]
env:
AKRI_COMPONENT: opencvsharp-build
MAKEFILE_COMPONENT: opencv-base
jobs:
add-same-version-label-to-pr:
runs-on: ubuntu-latest
if: github.event_name == 'issue_comment' && contains(github.event.comment.body, '/add-same-version-label')
steps:
- uses: actions/checkout@v3
- name: Add same version label
uses: actions/github-script@v6
if: success()
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['same version']
})
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '👋 Added [same version] label :)!'
})
add-build-label-to-pr:
runs-on: ubuntu-latest
if: github.event_name == 'issue_comment' && contains(github.event.comment.body, '/add-build-dependency-containers-label')
steps:
- uses: actions/checkout@v3
- name: Add build dependency containers label
uses: actions/github-script@v6
if: success()
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['build dependency containers']
})
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '👋 Added [build dependency containers] label :)!'
})
add-label-missing-comment:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && (github.event.action == 'opened') && !contains(github.event.pull_request.labels.*.name, 'build dependency containers')
steps:
- uses: actions/checkout@v3
- name: Add comment about missing build dependency containers label
uses: actions/github-script@v6
if: success()
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.createComment({
issue_number: context.payload.pull_request.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Hi there, this change should run build dependency containers, but running it will take hours. Do you want to run it? If so, please add label "build dependency containers" by commenting "/add-build-dependency-containers-label".'
})
per-arch:
if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'build dependency containers')
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- arm64v8
- arm32v7
- amd64
steps:
- name: Checkout the head commit of the branch
uses: actions/checkout@v3
with:
persist-credentials: false
# Only run build version change check if PR does not have "same version" label
- if: >-
startsWith(github.event_name, 'pull_request') &&
!contains(github.event.pull_request.labels.*.name, 'same version')
name: Ensure that ${{ env.AKRI_COMPONENT }} version has changed
run: |
git fetch origin main
git diff origin/main -- ./build/intermediate-containers.mk | grep "BUILD_OPENCV_BASE_VERSION = " | wc -l | grep -v 0
- name: Prepare To Install
uses: actions/setup-node@v3
with:
node-version: 12
- name: Install Deps
run: |
yarn install
yarn add @actions/core @actions/github @actions/exec fs
- name: Run Per-Arch component build for ${{ env.AKRI_COMPONENT }}
uses: ./.github/actions/build-intermediate
with:
github_event_name: ${{ github.event_name }}
github_ref: ${{ github.ref }}
github_event_action: ${{ github.event.action }}
github_merged: ${{ github.event.pull_request.merged }}
container_name: ${{ env.AKRI_COMPONENT }}
container_prefix: ghcr.io/project-akri/akri
container_registry_base_url: ghcr.io
container_registry_username: ${{ secrets.crUsername }}
container_registry_password: ${{ secrets.crPassword }}
makefile_component_name: ${{ env.MAKEFILE_COMPONENT }}
platform: ${{ matrix.arch }}