chore: Revamp build system to overcome Cross issues #917
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] | |
env: | |
AKRI_COMPONENT: opencvsharp-build | |
MAKEFILE_COMPONENT: opencv-base | |
jobs: | |
build-container: | |
runs-on: ubuntu-latest | |
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: Get version.txt | |
id: version-string | |
run: | | |
grep "BUILD_OPENCV_BASE_VERSION =" build/intermediate-containers.mk | tr -d ' ' >> $GITHUB_OUTPUT | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- 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.GITHUB_TOKEN }} | |
- name: Docker meta | |
uses: docker/metadata-action@v5 | |
id: meta | |
with: | |
images: ghcr.io/project-akri/akri/opcua-monitoring-broker | |
tags: | | |
type=ref,event=pr | |
type=raw,value=${{steps.version-string.outputs.version}} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
file: build/containers/intermediate/Dockerfile.opencvsharp-build | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |