diff --git a/.github/workflows/OCV-PR-Linux-Alpine.yaml b/.github/workflows/OCV-PR-Linux-Alpine.yaml new file mode 100644 index 00000000..1caa61d8 --- /dev/null +++ b/.github/workflows/OCV-PR-Linux-Alpine.yaml @@ -0,0 +1,129 @@ +name: OCV PR Alpine Musl-C + +on: + pull_request: + branches: + - main + paths: + - '.github/workflows/OCV-PR-Linux-Alpine.yaml' + # TODO: are following paths necessary? + # - 'checkout-and-merge/*' + # - 'configure-and-build/*' + # - 'run-tests/*' + # - 'scripts/runner.py' + # - 'scripts/test-plan.json' + workflow_call: + inputs: + workflow_branch: + description: "Branch for ci-gha-workflow repository" + default: "main" + required: false + type: string + +concurrency: + group: OCV-PR-Linux-Alpine-${{ github.ref }} + cancel-in-progress: true + +jobs: + + branch_eval: + runs-on: ubuntu-24.04 + outputs: + branches: ${{ steps.determine-branches.outputs.branches }} + steps: + - id: determine-branches + shell: bash + run: | + if [ "${{ github.event.repository.name == 'ci-gha-workflow' }}" = "true" ] ; then + echo "branches=[ '4.x', '5.x' ]" >> "$GITHUB_OUTPUT" + else + echo "branches=[ '${{ github.base_ref }}' ]" >> "$GITHUB_OUTPUT" + fi + + Alpine: + runs-on: opencv-cn-lin-x86-64 + needs: + - branch_eval + strategy: + fail-fast: false + matrix: + branch: ${{ fromJSON(needs.branch_eval.outputs.branches )}} + defaults: + run: + shell: bash + container: + image: 'quay.io/opencv-ci/alpine-3:20260409' + volumes: + - /home/opencv-cn/git_cache:/opt/git_cache + - /home/opencv-cn/ci_cache/opencv/alpine-3:/opt/.ccache + - /home/opencv-cn/binaries_cache/alpine-3:/opt/binaries_cache + - /home/opencv-cn/dnn-models:/opt/dnn-models + env: + ANT_HOME: '/usr/share/ant' + DNN_MODELS: '/opt/dnn-models' + CCACHE_DIR: '/opt/.ccache' + CCACHE_MAXSIZE: '8G' + OPENCV_DOWNLOAD_PATH: '/opt/binaries_cache' + HOME: '/home/ci' + MAIN_BUILD_DIR: "build" + OPENCV_FOR_THREADS_NUM: 8 + CMAKE_BUILD_PARALLEL_LEVEL: 8 + steps: + + - name: Checkout workflow repository + uses: actions/checkout@v4 + with: + repository: opencv/ci-gha-workflow + ref: "${{ github.repository == 'opencv/ci-gha-workflow' && github.ref || inputs.workflow_branch }}" + + - name: Checkout and merge OpenCV + uses: ./checkout-and-merge + with: + target_branch: "${{ matrix.branch }}" + author: "${{ github.event.pull_request.user.login }}" + source_branch: "${{ github.event.repository.name == 'ci-gha-workflow' && '' || github.head_ref }}" + gitcache: '/opt/git_cache' + home: '${{ env.HOME }}' + workdir: '${{ env.HOME }}' + + - name: Update extra dnn models + timeout-minutes: 60 + working-directory: '${{ env.HOME }}' + run: | + ls -lR ${{ env.DNN_MODELS }} + python3 opencv_extra/testdata/dnn/download_models.py \ + --cleanup \ + --dst '${{ env.DNN_MODELS }}/dnn' + echo "OPENCV_DNN_TEST_DATA_PATH=${{ env.DNN_MODELS }}" >> $GITHUB_ENV + + - name: Configure and build OpenCV + uses: ./configure-and-build + with: + workdir: '${{ env.HOME }}' + builddir: 'build' + generator: 'Ninja' + options: '${{ env.CMAKE_OPT }}' + + - name: Run OpenCV tests + uses: ./run-tests + env: + OPENCV_TEST_DATA_PATH: '${{ env.HOME }}/opencv_extra/testdata' + OPENCV_TEST_REQUIRE_DATA: 1 + OPENCV_TEST_CHECK_OPTIONAL_DATA: 1 + PYTHONPATH: '${{ env.HOME }}/${{ env.MAIN_BUILD_DIR }}/python_loader:$PYTHONPATH' + with: + workdir: '${{ env.HOME }}' + builddir: '${{ env.MAIN_BUILD_DIR }}' + logdir: '${{ env.HOME }}/${{ env.MAIN_BUILD_DIR }}' + plan: "test-plan-${{ matrix.branch }}.json" + suite: "[ 'linux' ]" + filter: "[ 'ubuntu-common', 'ubuntu-avx2' ]" + enable_python: "true" + enable_java: "true" + suffix: 'alpine3_${{ matrix.branch }}' + + - if: ${{ always() && env.WARNINGS == '1' }} + name: Warnings check + run: | + echo "::error Warnings have been found!" + exit 1 diff --git a/docker/alpine/Dockerfile-musl b/docker/alpine/Dockerfile-musl new file mode 100644 index 00000000..cc9865fc --- /dev/null +++ b/docker/alpine/Dockerfile-musl @@ -0,0 +1,50 @@ +# version: 20260409 +# Image name: quay.io/opencv-ci/alpine-3 +FROM alpine:3.23.4 + +ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH + +RUN apk add --no-cache \ + build-base \ + diffutils \ + cmake \ + ccache \ + bash \ + git \ + curl \ + wget \ + tar \ + xz \ + zlib-dev \ + xz-dev \ + nasm \ + yasm \ + pkgconfig \ + openssl-dev \ + libjpeg-turbo-dev \ + fontconfig-dev \ + freetype-dev \ + expat-dev \ + libpng-dev \ + tiff-dev \ + libvpx-dev \ + libavif-dev \ + ffmpeg-dev \ + alsa-lib-dev \ + musl-dev \ + ttf-dejavu \ + linux-headers \ + py3-requests \ + perl \ + ninja + +# user`s UID is 1000 for self-runner +RUN adduser -D -u 1000 -h /home/ci ci && \ + mkdir -p /home/ci /io && \ + chown -R ci:ci /home/ci /io + +ENV HOME=/home/ci +WORKDIR /home/ci +USER ci + +ENV PATH "$HOME/bin:$PATH"