diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 04506829..c71c3867 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -16,7 +16,7 @@ jobs: cache: gradle - name: 下载submodule源码 - run: git submodule update --init + run: mv -f .gitmodules_github .gitmodules && git submodule sync && git submodule update --init - name: 赋予gradlew文件可执行权限 run: chmod +x ./Android/gradlew diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index b9b3080d..0051a468 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -11,7 +11,7 @@ jobs: - uses: actions/checkout@v1 - name: 下载submodule源码 - run: git submodule update --init + run: mv -f .gitmodules_github .gitmodules && git submodule sync && git submodule update --init - name: apt-get安装依赖库(非必选) run: sudo apt-get update && sudo apt-get install -y cmake libssl-dev libsdl-dev libavcodec-dev libavutil-dev @@ -28,7 +28,7 @@ jobs: run: cd 3rdpart/libsrtp && ./configure --enable-openssl && make -j4 && sudo make install - name: 编译 - run: mkdir -p linux_build && cd linux_build && cmake .. -DENABLE_WEBRTC:BOOL=TRUE && make -j4 + run: mkdir -p linux_build && cd linux_build && cmake .. -DENABLE_WEBRTC:BOOL=TRUE && make -j ${nproc} - name: 运行MediaServer run: pwd && cd release/linux/Debug && sudo ./MediaServer -d & diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..7f6d8bf8 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,82 @@ +name: Docker + +on: [push, pull_request] + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: docker.io + IMAGE_NAME: zlmediakit/zlmediakit + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + # This is used to complete the identity challenge + # with sigstore/fulcio when running outside of PRs. + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: 下载submodule源码 + run: mv -f .gitmodules_github .gitmodules && git submodule sync && git submodule update --init + + # Install the cosign tool except on PR + # https://github.com/sigstore/cosign-installer + - name: Install cosign + if: github.event_name != 'pull_request' + uses: sigstore/cosign-installer@d6a3abf1bdea83574e28d40543793018b6035605 + with: + cosign-release: 'v1.7.1' + + + # Workaround: https://github.com/docker/build-push-action/issues/461 + - name: Setup Docker buildx + uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c + with: + registry: ${{ env.REGISTRY }} + username: zlmediakit + password: ${{ secrets.DOCKER_IO_SECRET }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + # Build and push Docker image with Buildx (don't push on PR) + # https://github.com/docker/build-push-action + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: MODEL=Release + + # Sign the resulting Docker image digest except on PRs. + # This will only write to the public Rekor transparency log when the Docker + # repository is public to avoid leaking data. If you would like to publish + # transparency data even for private images, pass --force to cosign below. + # https://github.com/sigstore/cosign +# - name: Sign the published Docker image +# if: ${{ github.event_name != 'pull_request' }} +# env: +# COSIGN_EXPERIMENTAL: "true" +# # This step uses the identity token to provision an ephemeral certificate +# # against the sigstore community Fulcio instance. +# run: cosign sign ${{ steps.meta.outputs.tags }}@${{ steps.build-and-push.outputs.digest }} diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 51898d1a..d14001e6 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -11,7 +11,7 @@ jobs: - uses: actions/checkout@v1 - name: 下载submodule源码 - run: git submodule update --init + run: mv -f .gitmodules_github .gitmodules && git submodule sync && git submodule update --init # - name: 安装brew # run: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" @@ -31,7 +31,7 @@ jobs: # run: cd 3rdpart/libsrtp && ./configure --enable-openssl && make -j4 && sudo make install - name: 编译 - run: mkdir -p build && cd build && cmake .. && make -j4 + run: mkdir -p build && cd build && cmake .. && make -j ${nproc} - name: 运行MediaServer run: pwd && cd release/linux/Debug && sudo ./MediaServer -d & diff --git a/.github/workflows/msvc-ci.yml b/.github/workflows/msvc-ci.yml index fcbfe10a..2fb629da 100644 --- a/.github/workflows/msvc-ci.yml +++ b/.github/workflows/msvc-ci.yml @@ -8,9 +8,9 @@ jobs: steps: - uses: actions/checkout@v1 - with: - submodules: 'recursive' - fetch-depth: 1 + + - name: 下载submodule源码 + run: mv -Force .gitmodules_github .gitmodules && git submodule sync && git submodule update --init - name: 配置 vcpkg uses: lukka/run-vcpkg@v7 diff --git a/.gitmodules_github b/.gitmodules_github new file mode 100644 index 00000000..572aff62 --- /dev/null +++ b/.gitmodules_github @@ -0,0 +1,6 @@ +[submodule "ZLToolKit"] + path = 3rdpart/ZLToolKit + url = https://github.com/ZLMediaKit/ZLToolKit +[submodule "3rdpart/media-server"] + path = 3rdpart/media-server + url = https://github.com/ireader/media-server diff --git a/CMakeLists.txt b/CMakeLists.txt index eb193431..1dc1b7db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -308,7 +308,7 @@ if (JEMALLOC_FOUND) endif () #查找openssl是否安装 -find_package(OPENSSL QUIET) +find_package(OpenSSL QUIET) if (OPENSSL_FOUND AND ENABLE_OPENSSL) message(STATUS "found library:${OPENSSL_LIBRARIES},ENABLE_OPENSSL defined") include_directories(${OPENSSL_INCLUDE_DIR}) diff --git a/dockerfile b/dockerfile index 0b3e1f0e..2be4d056 100644 --- a/dockerfile +++ b/dockerfile @@ -10,7 +10,7 @@ EXPOSE 10000/udp EXPOSE 10000/tcp EXPOSE 8000/udp -ADD sources.list /etc/apt/sources.list +# ADD sources.list /etc/apt/sources.list RUN apt-get update && \ DEBIAN_FRONTEND="noninteractive" \ @@ -29,12 +29,11 @@ RUN apt-get update && \ libfaac-dev \ gcc \ g++ \ - gdb \ - libmp4v2-dev && \ + gdb && \ apt-get autoremove -y && \ apt-get clean -y && \ wget https://github.com/cisco/libsrtp/archive/v2.2.0.tar.gz -O libsrtp-2.2.0.tar.gz && tar xfv libsrtp-2.2.0.tar.gz && \ - cd libsrtp-2.2.0 && ./configure --enable-openssl && make && make install && \ + cd libsrtp-2.2.0 && ./configure --enable-openssl && make -j ${nproc} && make install && \ rm -rf /var/lib/apt/lists/* RUN mkdir -p /opt/media @@ -45,12 +44,12 @@ RUN mkdir -p build release/linux/${MODEL}/ WORKDIR /opt/media/ZLMediaKit/build RUN cmake -DCMAKE_BUILD_TYPE=${MODEL} -DENABLE_WEBRTC=true -DENABLE_TESTS=false -DENABLE_API=false .. && \ - make -j8 + make -j ${nproc} FROM ubuntu:18.04 ARG MODEL -ADD sources.list /etc/apt/sources.list +# ADD sources.list /etc/apt/sources.list RUN apt-get update && \ DEBIAN_FRONTEND="noninteractive" \ @@ -66,8 +65,7 @@ RUN apt-get update && \ ffmpeg \ gcc \ g++ \ - gdb \ - libmp4v2-dev && \ + gdb && \ apt-get autoremove -y && \ apt-get clean -y && \ rm -rf /var/lib/apt/lists/*