Skip to content

Commit

Permalink
Configure build matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterBowman committed Jun 19, 2024
1 parent 546c477 commit c6a292a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 20 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
paths-ignore:
- 'doc/**'
- 'docker/**'
- '**.md'
pull_request:
schedule:
Expand Down
45 changes: 26 additions & 19 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
name: Docker

on:
push:
# paths:
# - 'docker/**'
workflow_dispatch:
inputs:
ubuntu-tag:
description: 'The Ubuntu tag to use for the Docker image'
required: true
type: choice
options:
- '20.04'
- '22.04'
opencv-tag:
description: 'The OpenCV tag to use for the Docker image'
required: true
type: choice
options:
- '3.4'
- '4.x'
- '5.x'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{github.repository}}

jobs:
docker:
name: build (Ubuntu ${{matrix.ubuntu}}, OpenCV ${{matrix.opencv}})
runs-on: ubuntu-latest

permissions:
contents: read
packages: write
id-token: write

strategy:
matrix:
ubuntu: ['20.04', '22.04']
opencv: ['4.x']

steps:
- name: Check out main project
uses: actions/checkout@v4
Expand All @@ -36,12 +36,19 @@ jobs:
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}

- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: vision:ubuntu-${{inputs.ubuntu-tag}}
context: docker
tags: ${{env.IMAGE_NAME}}:ubuntu-${{matrix.ubuntu}}-opencv-${{matrix.opencv}}
labels: ${{steps.meta.outputs.labels}}
build-args: |
OPENCV_TAG=${{inputs.opencv-tag}}
UBUNTU_TAG=${{inputs.ubuntu-tag}}
OPENCV_TAG=${{matrix.opencv}}
UBUNTU_TAG=${{matrix.ubuntu}}
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUN apt-get update && \
-DBUILD_TESTS=OFF \
-DBUILD_PERF_TESTS=OFF \
-DOPENCV_ENABLE_NONFREE=ON && \
cmake --build opencv-${OPENCV_TAG}/build -j && \
cmake --build opencv-${OPENCV_TAG}/build && \
cmake --install opencv-${OPENCV_TAG}/build && \
rm -rf opencv.zip opencv_contrib.zip opencv-${OPENCV_TAG} opencv_contrib-${OPENCV_TAG} && \
apt-get clean

0 comments on commit c6a292a

Please sign in to comment.