新增docker ci并全面整理ci

This commit is contained in:
xiongziliang 2022-06-19 15:54:30 +08:00
parent ca66858da2
commit 0eacda5327
8 changed files with 103 additions and 17 deletions

View File

@ -16,7 +16,7 @@ jobs:
cache: gradle cache: gradle
- name: 下载submodule源码 - name: 下载submodule源码
run: git submodule update --init run: mv -f .gitmodules_github .gitmodules && git submodule sync && git submodule update --init
- name: 赋予gradlew文件可执行权限 - name: 赋予gradlew文件可执行权限
run: chmod +x ./Android/gradlew run: chmod +x ./Android/gradlew

View File

@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: 下载submodule源码 - name: 下载submodule源码
run: git submodule update --init run: mv -f .gitmodules_github .gitmodules && git submodule sync && git submodule update --init
- name: apt-get安装依赖库(非必选) - name: apt-get安装依赖库(非必选)
run: sudo apt-get update && sudo apt-get install -y cmake libssl-dev libsdl-dev libavcodec-dev libavutil-dev 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 run: cd 3rdpart/libsrtp && ./configure --enable-openssl && make -j4 && sudo make install
- name: 编译 - 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 - name: 运行MediaServer
run: pwd && cd release/linux/Debug && sudo ./MediaServer -d & run: pwd && cd release/linux/Debug && sudo ./MediaServer -d &

82
.github/workflows/docker.yml vendored Normal file
View File

@ -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 }}

View File

@ -11,7 +11,7 @@ jobs:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: 下载submodule源码 - name: 下载submodule源码
run: git submodule update --init run: mv -f .gitmodules_github .gitmodules && git submodule sync && git submodule update --init
# - name: 安装brew # - name: 安装brew
# run: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" # 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 # run: cd 3rdpart/libsrtp && ./configure --enable-openssl && make -j4 && sudo make install
- name: 编译 - name: 编译
run: mkdir -p build && cd build && cmake .. && make -j4 run: mkdir -p build && cd build && cmake .. && make -j ${nproc}
- name: 运行MediaServer - name: 运行MediaServer
run: pwd && cd release/linux/Debug && sudo ./MediaServer -d & run: pwd && cd release/linux/Debug && sudo ./MediaServer -d &

View File

@ -8,9 +8,9 @@ jobs:
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
with:
submodules: 'recursive' - name: 下载submodule源码
fetch-depth: 1 run: mv -Force .gitmodules_github .gitmodules && git submodule sync && git submodule update --init
- name: 配置 vcpkg - name: 配置 vcpkg
uses: lukka/run-vcpkg@v7 uses: lukka/run-vcpkg@v7

6
.gitmodules_github Normal file
View File

@ -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

View File

@ -308,7 +308,7 @@ if (JEMALLOC_FOUND)
endif () endif ()
#openssl #openssl
find_package(OPENSSL QUIET) find_package(OpenSSL QUIET)
if (OPENSSL_FOUND AND ENABLE_OPENSSL) if (OPENSSL_FOUND AND ENABLE_OPENSSL)
message(STATUS "found library:${OPENSSL_LIBRARIES},ENABLE_OPENSSL defined") message(STATUS "found library:${OPENSSL_LIBRARIES},ENABLE_OPENSSL defined")
include_directories(${OPENSSL_INCLUDE_DIR}) include_directories(${OPENSSL_INCLUDE_DIR})

View File

@ -10,7 +10,7 @@ EXPOSE 10000/udp
EXPOSE 10000/tcp EXPOSE 10000/tcp
EXPOSE 8000/udp EXPOSE 8000/udp
ADD sources.list /etc/apt/sources.list # ADD sources.list /etc/apt/sources.list
RUN apt-get update && \ RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" \ DEBIAN_FRONTEND="noninteractive" \
@ -29,12 +29,11 @@ RUN apt-get update && \
libfaac-dev \ libfaac-dev \
gcc \ gcc \
g++ \ g++ \
gdb \ gdb && \
libmp4v2-dev && \
apt-get autoremove -y && \ apt-get autoremove -y && \
apt-get clean -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 && \ 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/* rm -rf /var/lib/apt/lists/*
RUN mkdir -p /opt/media RUN mkdir -p /opt/media
@ -45,12 +44,12 @@ RUN mkdir -p build release/linux/${MODEL}/
WORKDIR /opt/media/ZLMediaKit/build WORKDIR /opt/media/ZLMediaKit/build
RUN cmake -DCMAKE_BUILD_TYPE=${MODEL} -DENABLE_WEBRTC=true -DENABLE_TESTS=false -DENABLE_API=false .. && \ RUN cmake -DCMAKE_BUILD_TYPE=${MODEL} -DENABLE_WEBRTC=true -DENABLE_TESTS=false -DENABLE_API=false .. && \
make -j8 make -j ${nproc}
FROM ubuntu:18.04 FROM ubuntu:18.04
ARG MODEL ARG MODEL
ADD sources.list /etc/apt/sources.list # ADD sources.list /etc/apt/sources.list
RUN apt-get update && \ RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" \ DEBIAN_FRONTEND="noninteractive" \
@ -66,8 +65,7 @@ RUN apt-get update && \
ffmpeg \ ffmpeg \
gcc \ gcc \
g++ \ g++ \
gdb \ gdb && \
libmp4v2-dev && \
apt-get autoremove -y && \ apt-get autoremove -y && \
apt-get clean -y && \ apt-get clean -y && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*