include: ".ci/dockerfile-hash.yaml" workflow: rules: # Tag pushes (releases) always build. - if: "$CI_COMMIT_TAG" # A release pushes the `next` branch and a `vX.Y.Z` tag at the same commit, # which would otherwise spawn two pipelines that build everything twice. The # tag pipeline above already covers it, so skip the redundant `next` build. # Release commits are titled like the tag (e.g. "v0.10.40"), so match on that. - if: '$CI_COMMIT_BRANCH == "next" && $CI_COMMIT_TITLE =~ /^v?\d+\.\d+\.\d+$/' when: never # Everything else (normal branch pushes) builds as usual. - when: always variables: DOCKER_REPO: "public.ecr.aws/m4j3c0j7/streamplace" build-bunny: stage: build interruptible: true image: name: gcr.io/kaniko-project/executor:v1.14.0-debug entrypoint: [""] timeout: 2 hours script: - mkdir -p /kaniko/.docker - cp "$DOCKER_AUTH_CONFIG" /kaniko/.docker/config.json - /kaniko/executor --context "${CI_PROJECT_DIR}/docker" --dockerfile "${CI_PROJECT_DIR}/docker/bunny.Dockerfile" --destination "$DOCKER_REPO:bunny" builder: stage: build interruptible: true allow_failure: true image: name: gcr.io/kaniko-project/executor:v1.14.0-debug entrypoint: [""] variables: FQ_IMAGE_NAME: "$DOCKER_REPO:builder-$DOCKERFILE_HASH" TARGET: builder timeout: 2 hours script: - mkdir -p /kaniko/.docker - cp "$DOCKER_AUTH_CONFIG" /kaniko/.docker/config.json - /kaniko/executor --build-arg TARGETARCH=amd64 --build-arg DOCKERFILE_HASH=$DOCKERFILE_HASH --cache=true --context "${CI_PROJECT_DIR}" --dockerfile "${CI_PROJECT_DIR}/docker/build.Dockerfile" --destination "$FQ_IMAGE_NAME" --target "$TARGET" builder-rebuild: tags: - tiny-job stage: build allow_failure: true interruptible: true image: name: curlimages/curl:latest entrypoint: [""] needs: - job: builder timeout: 2 hours script: - echo "CI_PIPELINE_ID=$CI_PIPELINE_ID" - echo "CI_PIPELINE_ID=$CI_PIPELINE_IID" - echo "CI_PROJECT_ID=$CI_PROJECT_ID" - > curl --data-raw '{"project_id": "'$CI_PROJECT_ID'", "pipeline_id": "'$CI_PIPELINE_ID'", "job_token": "'$CI_JOB_TOKEN'"}' --fail-with-body https://retry-gitlab.iameli.workers.dev/ .build: stage: build interruptible: true image: "$DOCKER_REPO:builder-$DOCKERFILE_HASH" timeout: 2 hours script: - rm -rf /usr/x86_64-w64-mingw32/include/d3dcompiler.h /usr/share/mingw-w64/include/d3dcompiler.h /usr/lib/gcc/x86_64-w64-mingw32/10-posix/libssp.dll.a /usr/lib/gcc/x86_64-w64-mingw32/10-posix/libssp-0.dll /usr/lib/gcc/x86_64-w64-mingw32/10-win32/libssp-0.dll /usr/lib/gcc/x86_64-w64-mingw32/10-win32/libssp.dll.a - git fetch --unshallow || echo 'already unshallow' - bash -c "make version && make $TARGET && make test-vod && make desktop-$TARGET && make pkg-$TARGET && make ci-upload-node-$TARGET -j$(nproc)" artifacts: reports: dotenv: .ci/build.env build-linux-amd64: extends: - .build variables: TARGET: linux-amd64 build-linux-arm64: extends: - .build variables: TARGET: linux-arm64 build-windows-amd64: extends: - .build variables: TARGET: windows-amd64 build-darwin-arm64: extends: - .build variables: TARGET: darwin-arm64 build-darwin-amd64: extends: - .build variables: TARGET: darwin-amd64 leak-test-viewers: stage: build interruptible: true needs: - job: build-linux-amd64 artifacts: true - job: build-bunny image: name: "$DOCKER_REPO:bunny" variables: SP_WIDE_OPEN: "true" SP_NO_FIREHOSE: "true" SP_WHIP_TEST: "--file=/bunny.mp4 --count=1 --viewers=50 --duration=5m" KUBERNETES_MEMORY_REQUEST: "2Gi" KUBERNETES_MEMORY_LIMIT: "2Gi" GOGC: "20" GOMEMLIMIT: "2GiB" timeout: "10 minutes" allow_failure: true script: - /bunny.sh leak-test-streamers: stage: build interruptible: true needs: - job: build-linux-amd64 artifacts: true - job: build-bunny image: name: "$DOCKER_REPO:bunny" variables: SP_WIDE_OPEN: "true" SP_NO_FIREHOSE: "true" SP_WHIP_TEST: "--file=/bunny.mp4 --count=10 --duration=5m" KUBERNETES_MEMORY_REQUEST: "2Gi" KUBERNETES_MEMORY_LIMIT: "2Gi" GOGC: "20" GOMEMLIMIT: "2GiB" timeout: "10 minutes" allow_failure: true script: - /bunny.sh test: stage: build interruptible: true image: "$DOCKER_REPO:builder-$DOCKERFILE_HASH" timeout: 2 hours variables: STREAMPLACE_TEST_COUNT: "1" STREAMPLACE_TEST_POSTGRES_COMMAND: "install -d -o postgres -g postgres -m 2775 /var/run/postgresql && install -d -o postgres -g postgres -m 3775 /var/run/postgresql/14-main.pg_stat_tmp && sudo -u postgres /usr/lib/postgresql/14/bin/postgres -D /etc/postgresql/14/main/" script: - git fetch --unshallow || echo 'already unshallow' - make dev-setup && make dev && make dev-test && make ci-lexicons artifacts: when: always paths: - test.xml reports: junit: test.xml build-docker-mistserver: stage: build interruptible: true needs: - job: build-linux-amd64 artifacts: true image: name: gcr.io/kaniko-project/executor:v1.14.0-debug entrypoint: [""] timeout: 2 hours script: - mkdir -p /kaniko/.docker - cp "$DOCKER_AUTH_CONFIG" /kaniko/.docker/config.json - /kaniko/executor --build-arg TARGETARCH=amd64 --build-arg STREAMPLACE_URL=$STREAMPLACE_URL_LINUX_AMD64 --context "${CI_PROJECT_DIR}" --dockerfile "${CI_PROJECT_DIR}/docker/mistserver.Dockerfile" --destination "$DOCKER_REPO:$STREAMPLACE_BRANCH-mistserver" --destination "$DOCKER_REPO:$STREAMPLACE_VERSION-mistserver" build-docker-amd64: stage: build interruptible: true needs: - job: build-linux-amd64 artifacts: true image: name: gcr.io/kaniko-project/executor:v1.14.0-debug entrypoint: [""] timeout: 2 hours script: - mkdir -p /kaniko/.docker - cp "$DOCKER_AUTH_CONFIG" /kaniko/.docker/config.json - /kaniko/executor --build-arg TARGETARCH=amd64 --build-arg STREAMPLACE_URL=$STREAMPLACE_URL_LINUX_AMD64 --context "${CI_PROJECT_DIR}" --dockerfile "${CI_PROJECT_DIR}/docker/release.Dockerfile" --destination "$DOCKER_REPO:$STREAMPLACE_BRANCH-amd64" --destination "$DOCKER_REPO:$STREAMPLACE_VERSION-amd64" build-docker-arm64: stage: build interruptible: true tags: - linux - arm64 needs: - job: build-linux-arm64 artifacts: true image: name: gcr.io/kaniko-project/executor:v1.14.0-debug entrypoint: [""] timeout: 2 hours script: - mkdir -p /kaniko/.docker - cp "$DOCKER_AUTH_CONFIG" /kaniko/.docker/config.json - /kaniko/executor --build-arg TARGETARCH=arm64 --build-arg STREAMPLACE_URL=$STREAMPLACE_URL_LINUX_ARM64 --context "${CI_PROJECT_DIR}" --dockerfile "${CI_PROJECT_DIR}/docker/release.Dockerfile" --destination "$DOCKER_REPO:$STREAMPLACE_BRANCH-arm64" --destination "$DOCKER_REPO:$STREAMPLACE_VERSION-arm64" --customPlatform=linux/arm64 build-docker-manifest: stage: build interruptible: true image: name: curlimages/curl:latest entrypoint: [""] needs: - job: build-docker-arm64 - job: build-docker-amd64 - job: build-linux-amd64 # just for the environment variables artifacts: true before_script: - curl -s -L https://github.com/estesp/manifest-tool/releases/download/v2.1.7/binaries-manifest-tool-2.1.7.tar.gz | tar xvz - mv manifest-tool-linux-amd64 ./manifest-tool - chmod +x ./manifest-tool timeout: 2 hours script: - ./manifest-tool --docker-cfg "$DOCKER_AUTH_CONFIG" push from-args --platforms linux/amd64,linux/arm64 --template $DOCKER_REPO:$STREAMPLACE_VERSION-ARCH --tags $STREAMPLACE_BRANCH --target $DOCKER_REPO:$STREAMPLACE_VERSION .build-android: stage: build interruptible: true image: "$DOCKER_REPO:builder-$DOCKERFILE_HASH" timeout: 2 hours script: - git fetch --unshallow || echo 'already unshallow' - make $TARGET -j$(nproc) build-android-debug: extends: - .build-android variables: TARGET: ci-android-debug build-android-release: extends: - .build-android variables: TARGET: ci-android-release .build-on-mac: stage: build interruptible: true image: ghcr.io/cirruslabs/macos-tahoe-xcode:26.3 tags: - tart-installed variables: STREAMPLACE_TEST_COUNT: "1" NODE_OPTIONS: "--max_old_space_size=4096" timeout: 2 hours script: # workaround for https://gitlab.com/gitlab-org/gitlab/-/issues/501457 # which is a workaround for ios builds failing due to /tmp vs /private/tmp weirdness - cd .. - mv streamplace /Users/admin/streamplace - cd /Users/admin/streamplace - git fetch --unshallow || echo 'already unshallow' - brew install ninja go openssl@3 && go version - export PATH="/opt/homebrew/opt/node@22/bin:$PATH" - brew install node@22 - node --version - npm install -g corepack@latest --force - corepack enable - sudo gem uninstall xcodeproj -x --ignore-dependencies - sudo gem install xcodeproj -v 1.25.1 - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh && bash rustup.sh -y && rm rustup.sh - export PATH="$PATH:$HOME/.cargo/bin" - echo $PATH - 'echo "which xcodeproj: $(which xcodeproj)"' - 'echo "xcodeproj --version: $(xcodeproj --version)"' - "$(which xcodeproj) --version" - > export GOTOOLCHAIN=go1.26.5 && python3 -m pip install virtualenv && python3 -m virtualenv ~/venv && source ~/venv/bin/activate && python3 -m pip install meson && ${=COMMAND} # ^^ zsh-ism for running command with spaces build-ios: extends: - .build-on-mac variables: COMMAND: make ci-ios -j16 build-desktop-darwin: extends: - .build-on-mac needs: - build-darwin-amd64 - build-darwin-arm64 variables: COMMAND: make ci-desktop-darwin # windows-selftest: # interruptible: true # stage: build # # for the moment... # tags: # - windows # timeout: 2 hours # needs: # - job: build-windows-amd64 # artifacts: true # variables: # MSYSTEM: "MINGW32" # CHERE_INVOKING: "yes" # script: # - C:\msys64\usr\bin\bash -lc "bash -x ./util/windows-selftest.sh $STREAMPLACE_DESKTOP_URL_WINDOWS_AMD64" .release-template: stage: build interruptible: true image: "$DOCKER_REPO:builder-$DOCKERFILE_HASH" needs: # The linux build jobs upload the .deb / .tar.gz files that the release # jobs download from the package registry, so they must finish first. # They used to be pulled in transitively via the build-docker-* jobs; # those were removed, so depend on them directly to avoid a download race. - build-linux-amd64 - build-linux-arm64 - build-darwin-amd64 - build-darwin-arm64 - build-android-debug - build-android-release - build-docker-amd64 - build-docker-arm64 - build-docker-manifest - build-desktop-darwin - build-ios - test rules: - if: '$CI_COMMIT_TAG =~ /^v?\d+\.\d+\.\d+$/' timeout: 2 hours npm-release: extends: - .release-template script: - make ci-npm-release release: extends: - .release-template script: - make ci-release deb-release: extends: - .release-template script: - make ci-deb-release homebrew-release: extends: - .release-template script: - make ci-homebrew .report-status: tags: - tiny-job interruptible: true image: name: curlimages/curl entrypoint: [""] variables: STATUS_PROJECT: streamplace/streamplace STATUS_NAME: git.stream.place script: # For complete details on the GitHub API please see: # https://developer.github.com/v3/repos/statuses - > set -eu && curl -L --fail-with-body --silent -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/${STATUS_PROJECT}/statuses/${CI_COMMIT_SHA} -d '{"state":"'${CI_JOB_NAME}'","target_url":"'${CI_PIPELINE_URL}'","description":"'${STATUS_NAME}'","context":"'${STATUS_NAME}'"}' environment: name: reporting-github dependencies: [] pending: stage: .pre extends: - .report-status success: stage: .post extends: - .report-status failure: stage: .post extends: - .report-status rules: - when: on_failure