Skip to content

Merge pull request #2127 from shimat/fix/ci-cache-scope #903

Merge pull request #2127 from shimat/fix/ci-cache-scope

Merge pull request #2127 from shimat/fix/ci-cache-scope #903

name: Docker Test
on:
pull_request:
types: [synchronize, opened]
paths:
- '.dockerignore'
- '.github/workflows/docker-test-ubuntu.yml'
- 'cmake/**'
- 'global.json'
- 'opencv'
- 'opencv_contrib'
- 'packaging/docker/ubuntu24-dotnet10-opencv5.0.0/**'
- 'packaging/docker/ubuntu24-dotnet10-opencv5.0.0-slim/**'
- 'src/**'
- 'test/**'
- 'vcpkg.json'
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
DEBIAN_FRONTEND: noninteractive
OPENCV_VERSION: 5.0.0
DOCKER_BUILD_CONTEXT_FULL: ./packaging/docker/ubuntu24-dotnet10-opencv5.0.0
DOCKER_BUILD_CONTEXT_SLIM: ./packaging/docker/ubuntu24-dotnet10-opencv5.0.0-slim
jobs:
build_full:
name: Docker (full)
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v7
- uses: docker/setup-buildx-action@v4
- name: Test native .so (full)
uses: docker/build-push-action@v7
with:
context: .
file: ${{ env.DOCKER_BUILD_CONTEXT_FULL }}/Dockerfile
target: test-native
build-args: |
OPENCV_VERSION=${{ env.OPENCV_VERSION }}
outputs: type=cacheonly
cache-from: |
type=gha,scope=full-test-native-main
type=gha,scope=full-main
cache-to: ${{ github.ref == 'refs/heads/main' && 'type=gha,mode=min,scope=full-test-native-main' || '' }}
- name: Test .NET class libraries (full)
uses: docker/build-push-action@v7
with:
context: .
file: ${{ env.DOCKER_BUILD_CONTEXT_FULL }}/Dockerfile
target: test-dotnet
build-args: |
OPENCV_VERSION=${{ env.OPENCV_VERSION }}
outputs: type=cacheonly
cache-from: |
type=gha,scope=full-test-dotnet-main
type=gha,scope=full-main
cache-to: ${{ github.ref == 'refs/heads/main' && 'type=gha,mode=min,scope=full-test-dotnet-main' || '' }}
- name: Build with Docker (full)
uses: docker/build-push-action@v7
with:
context: .
file: ${{ env.DOCKER_BUILD_CONTEXT_FULL }}/Dockerfile
build-args: |
OPENCV_VERSION=${{ env.OPENCV_VERSION }}
outputs: type=docker,name=shimat/ubuntu24-dotnet10-opencv5.0.0:latest
cache-from: type=gha,scope=full-main
cache-to: ${{ github.ref == 'refs/heads/main' && 'type=gha,mode=min,scope=full-main' || '' }}
build_slim:
name: Docker (slim)
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v7
- uses: docker/setup-buildx-action@v4
- name: Test native .so (slim)
uses: docker/build-push-action@v7
with:
context: .
file: ${{ env.DOCKER_BUILD_CONTEXT_SLIM }}/Dockerfile
target: test-native
build-args: |
OPENCV_VERSION=${{ env.OPENCV_VERSION }}
outputs: type=cacheonly
cache-from: |
type=gha,scope=slim-test-native-main
type=gha,scope=slim-main
cache-to: ${{ github.ref == 'refs/heads/main' && 'type=gha,mode=min,scope=slim-test-native-main' || '' }}
- name: Build with Docker (slim)
uses: docker/build-push-action@v7
with:
context: .
file: ${{ env.DOCKER_BUILD_CONTEXT_SLIM }}/Dockerfile
build-args: |
OPENCV_VERSION=${{ env.OPENCV_VERSION }}
outputs: type=docker,name=shimat/ubuntu24-dotnet10-opencv5.0.0-slim:latest
cache-from: type=gha,scope=slim-main
cache-to: ${{ github.ref == 'refs/heads/main' && 'type=gha,mode=min,scope=slim-main' || '' }}