Skip to content

Build OpenCV Base

Build OpenCV Base #910

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 }}