diff --git a/.circleci/config.yml b/.circleci/config.yml index 1dde721b72..c8bd490cc1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,155 +1,155 @@ ---- -version: 2 - -workflows: - version: 2 - circleci: - jobs: - - bazel-asan - - bazel-dbg - - bazel-msan - - bazel-opt - - clang-analyze - - cpplint - - static-analysis - - cimple - - cimplefmt - - generate-events - -jobs: - bazel-asan: - working_directory: /tmp/cirrus-ci-build - docker: - - image: toxchat/toktok-stack:latest-asan - - steps: - - checkout - - run: .circleci/bazel-test - //c-toxcore/... - - bazel-dbg: - working_directory: /tmp/cirrus-ci-build - docker: - - image: toxchat/toktok-stack:latest-debug - - steps: - - checkout - - run: .circleci/bazel-test - //c-toxcore/... - - bazel-msan: - working_directory: /tmp/cirrus-ci-build - docker: - - image: toxchat/toktok-stack:latest-msan - - steps: - - checkout - - run: .circleci/bazel-test - //c-toxcore/auto_tests:lossless_packet_test - - bazel-opt: - working_directory: /tmp/cirrus-ci-build - docker: - - image: toxchat/toktok-stack:latest-release - - steps: - - checkout - - run: .circleci/bazel-test - //c-toxcore/... - - static-analysis: - working_directory: ~/work - docker: - - image: ubuntu - - steps: - - run: &apt_install - apt-get update && - DEBIAN_FRONTEND=noninteractive - apt-get install -y - ca-certificates - clang - cmake - git - libbenchmark-dev - libconfig-dev - libgmock-dev - libgtest-dev - libopus-dev - libsodium-dev - libvpx-dev - llvm-dev - ninja-build - pkg-config - - run: - apt-get install -y --no-install-recommends - ca-certificates - g++ - llvm-dev - - checkout - - run: git submodule update --init --recursive - - run: other/analysis/check_includes - - run: other/analysis/check_logger_levels - - run: other/analysis/run-clang - - run: other/analysis/run-gcc - - clang-analyze: - working_directory: ~/work - docker: - - image: ubuntu - - steps: - - run: *apt_install - - checkout - - run: git submodule update --init --recursive - - run: other/analysis/run-clang-analyze - - cpplint: - working_directory: ~/work - docker: - - image: ubuntu - - steps: - - run: *apt_install - - run: - apt-get install -y --no-install-recommends - cpplint - - checkout - - run: git submodule update --init --recursive - - run: other/analysis/run-cpplint - - cimple: - working_directory: /tmp/cirrus-ci-build - docker: - - image: toxchat/toktok-stack:latest-release - - steps: - - checkout - - run: git submodule update --init --recursive - - run: /src/workspace/tools/inject-repo c-toxcore - - run: cd /src/workspace && - bazel test - -k - --build_tag_filters=haskell - --test_tag_filters=haskell - -- - //c-toxcore/... - - cimplefmt: - working_directory: ~/work - machine: { image: ubuntu-2204:current } - - steps: - - checkout - - run: git submodule update --init --recursive - - run: other/docker/cimplefmt/run -u $(find tox* -name "*.[ch]") - - generate-events: - working_directory: ~/work - machine: { image: ubuntu-2204:current } - - steps: - - checkout - - run: git submodule update --init --recursive - - run: other/event_tooling/run - - run: git diff --exit-code +# --- +# version: 2 + +# workflows: +# version: 2 +# circleci: +# jobs: +# - bazel-asan +# - bazel-dbg +# - bazel-msan +# - bazel-opt +# - clang-analyze +# - cpplint +# - static-analysis +# - cimple +# - cimplefmt +# - generate-events + +# jobs: +# bazel-asan: +# working_directory: /tmp/cirrus-ci-build +# docker: +# - image: toxchat/toktok-stack:latest-asan + +# steps: +# - checkout +# - run: .circleci/bazel-test +# //c-toxcore/... + +# bazel-dbg: +# working_directory: /tmp/cirrus-ci-build +# docker: +# - image: toxchat/toktok-stack:latest-debug + +# steps: +# - checkout +# - run: .circleci/bazel-test +# //c-toxcore/... + +# bazel-msan: +# working_directory: /tmp/cirrus-ci-build +# docker: +# - image: toxchat/toktok-stack:latest-msan + +# steps: +# - checkout +# - run: .circleci/bazel-test +# //c-toxcore/auto_tests:lossless_packet_test + +# bazel-opt: +# working_directory: /tmp/cirrus-ci-build +# docker: +# - image: toxchat/toktok-stack:latest-release + +# steps: +# - checkout +# - run: .circleci/bazel-test +# //c-toxcore/... + +# static-analysis: +# working_directory: ~/work +# docker: +# - image: ubuntu + +# steps: +# - run: &apt_install +# apt-get update && +# DEBIAN_FRONTEND=noninteractive +# apt-get install -y +# ca-certificates +# clang +# cmake +# git +# libbenchmark-dev +# libconfig-dev +# libgmock-dev +# libgtest-dev +# libopus-dev +# libsodium-dev +# libvpx-dev +# llvm-dev +# ninja-build +# pkg-config +# - run: +# apt-get install -y --no-install-recommends +# ca-certificates +# g++ +# llvm-dev +# - checkout +# - run: git submodule update --init --recursive +# - run: other/analysis/check_includes +# - run: other/analysis/check_logger_levels +# - run: other/analysis/run-clang +# - run: other/analysis/run-gcc + +# clang-analyze: +# working_directory: ~/work +# docker: +# - image: ubuntu + +# steps: +# - run: *apt_install +# - checkout +# - run: git submodule update --init --recursive +# - run: other/analysis/run-clang-analyze + +# cpplint: +# working_directory: ~/work +# docker: +# - image: ubuntu + +# steps: +# - run: *apt_install +# - run: +# apt-get install -y --no-install-recommends +# cpplint +# - checkout +# - run: git submodule update --init --recursive +# - run: other/analysis/run-cpplint + +# cimple: +# working_directory: /tmp/cirrus-ci-build +# docker: +# - image: toxchat/toktok-stack:latest-release + +# steps: +# - checkout +# - run: git submodule update --init --recursive +# - run: /src/workspace/tools/inject-repo c-toxcore +# - run: cd /src/workspace && +# bazel test +# -k +# --build_tag_filters=haskell +# --test_tag_filters=haskell +# -- +# //c-toxcore/... + +# cimplefmt: +# working_directory: ~/work +# machine: { image: ubuntu-2204:current } + +# steps: +# - checkout +# - run: git submodule update --init --recursive +# - run: other/docker/cimplefmt/run -u $(find tox* -name "*.[ch]") + +# generate-events: +# working_directory: ~/work +# machine: { image: ubuntu-2204:current } + +# steps: +# - checkout +# - run: git submodule update --init --recursive +# - run: other/event_tooling/run +# - run: git diff --exit-code diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0b832d3778..ad76dd5422 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,201 +1,201 @@ -name: ci +# name: ci -on: - pull_request: - branches: [master] +# on: +# pull_request: +# branches: [master] -# Cancel old PR builds when pushing new commits. -concurrency: - group: build-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true +# # Cancel old PR builds when pushing new commits. +# concurrency: +# group: build-${{ github.event.pull_request.number || github.ref }} +# cancel-in-progress: true -jobs: - common: - uses: TokTok/ci-tools/.github/workflows/common-ci.yml@master +# jobs: +# common: +# uses: TokTok/ci-tools/.github/workflows/common-ci.yml@master - analysis: - strategy: - fail-fast: false - matrix: - tool: [autotools, clang-tidy, compcert, cppcheck, doxygen, goblint, infer, freebsd, misra, modules, pkgsrc, rpm, slimcc, sparse, tcc, tokstyle] - runs-on: ubuntu-22.04 - steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - driver: docker - - name: Build toxchat/c-toxcore:sources - uses: docker/build-push-action@v5 - with: - file: other/docker/sources/sources.Dockerfile - tags: toxchat/c-toxcore:sources - - name: Docker Build - uses: docker/build-push-action@v5 - with: - file: other/docker/${{ matrix.tool }}/${{ matrix.tool }}.Dockerfile +# analysis: +# strategy: +# fail-fast: false +# matrix: +# tool: [autotools, clang-tidy, compcert, cppcheck, doxygen, goblint, infer, freebsd, misra, modules, pkgsrc, rpm, slimcc, sparse, tcc, tokstyle] +# runs-on: ubuntu-22.04 +# steps: +# - name: Set up Docker Buildx +# uses: docker/setup-buildx-action@v3 +# with: +# driver: docker +# - name: Build toxchat/c-toxcore:sources +# uses: docker/build-push-action@v5 +# with: +# file: other/docker/sources/sources.Dockerfile +# tags: toxchat/c-toxcore:sources +# - name: Docker Build +# uses: docker/build-push-action@v5 +# with: +# file: other/docker/${{ matrix.tool }}/${{ matrix.tool }}.Dockerfile - sanitizer: - strategy: - fail-fast: false - matrix: - sanitizer: [asan, tsan, ubsan] - runs-on: ubuntu-22.04 - steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - driver: docker - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Run sanitizer - run: other/docker/circleci/run "${{ matrix.sanitizer }}" +# sanitizer: +# strategy: +# fail-fast: false +# matrix: +# sanitizer: [asan, tsan, ubsan] +# runs-on: ubuntu-22.04 +# steps: +# - name: Set up Docker Buildx +# uses: docker/setup-buildx-action@v3 +# with: +# driver: docker +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - name: Run sanitizer +# run: other/docker/circleci/run "${{ matrix.sanitizer }}" - coverage-linux: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Build, test, and upload coverage - run: other/docker/coverage/run +# coverage-linux: +# runs-on: ubuntu-22.04 +# steps: +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - name: Build, test, and upload coverage +# run: other/docker/coverage/run - build-android: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - run: .github/scripts/cmake-android armeabi-v7a - - run: .github/scripts/cmake-android arm64-v8a - - run: .github/scripts/cmake-android x86 - - run: .github/scripts/cmake-android x86_64 +# build-android: +# runs-on: ubuntu-22.04 +# steps: +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - run: .github/scripts/cmake-android armeabi-v7a +# - run: .github/scripts/cmake-android arm64-v8a +# - run: .github/scripts/cmake-android x86 +# - run: .github/scripts/cmake-android x86_64 - build-macos: - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Build and test - run: .github/scripts/cmake-osx +# build-macos: +# runs-on: macos-latest +# steps: +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - name: Build and test +# run: .github/scripts/cmake-osx - build-windows-msvc: - strategy: - matrix: - version: [2019, 2022] - runs-on: windows-${{ matrix.version }} - env: - VCPKG_ROOT: "C:/vcpkg" - VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Export GitHub Actions cache environment variables - uses: actions/github-script@v7 - with: - script: | - core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); - core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - - name: Configure CMake - run: cmake --preset windows-default - - name: Build - run: cmake --build _build -j $([int]$env:NUMBER_OF_PROCESSORS+2) - - name: Test - run: | - cd _build - ctest -j50 --output-on-failure --rerun-failed --repeat until-pass:6 --build-config Debug +# build-windows-msvc: +# strategy: +# matrix: +# version: [2019, 2022] +# runs-on: windows-${{ matrix.version }} +# env: +# VCPKG_ROOT: "C:/vcpkg" +# VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" +# steps: +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - name: Export GitHub Actions cache environment variables +# uses: actions/github-script@v7 +# with: +# script: | +# core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); +# core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); +# - name: Configure CMake +# run: cmake --preset windows-default +# - name: Build +# run: cmake --build _build -j $([int]$env:NUMBER_OF_PROCESSORS+2) +# - name: Test +# run: | +# cd _build +# ctest -j50 --output-on-failure --rerun-failed --repeat until-pass:6 --build-config Debug - build-netbsd: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Test in NetBSD - id: test - uses: vmactions/netbsd-vm@v1 - with: - usesh: true - copyback: false - prepare: - /usr/sbin/pkg_add - cmake - googletest - libconfig - libopus - libsodium - libvpx - ninja - pkg-config +# build-netbsd: +# runs-on: ubuntu-22.04 +# steps: +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - name: Test in NetBSD +# id: test +# uses: vmactions/netbsd-vm@v1 +# with: +# usesh: true +# copyback: false +# prepare: +# /usr/sbin/pkg_add +# cmake +# googletest +# libconfig +# libopus +# libsodium +# libvpx +# ninja +# pkg-config - run: | - # TODO(iphydf): Investigate NetBSD failures on these tests. - sed -Ei -e '/\((TCP|dht_getnodes_api)\)/s/^/#/' auto_tests/CMakeLists.txt - cmake . \ - -DMIN_LOGGER_LEVEL=TRACE \ - -DMUST_BUILD_TOXAV=ON \ - -DNON_HERMETIC_TESTS=ON \ - -DTEST_TIMEOUT_SECONDS=90 \ - -DUSE_IPV6=OFF \ - -DAUTOTEST=ON \ - -GNinja - cmake --build . --target install - ctest -j50 --output-on-failure --rerun-failed --repeat until-pass:6 +# run: | +# # TODO(iphydf): Investigate NetBSD failures on these tests. +# sed -Ei -e '/\((TCP|dht_getnodes_api)\)/s/^/#/' auto_tests/CMakeLists.txt +# cmake . \ +# -DMIN_LOGGER_LEVEL=TRACE \ +# -DMUST_BUILD_TOXAV=ON \ +# -DNON_HERMETIC_TESTS=ON \ +# -DTEST_TIMEOUT_SECONDS=90 \ +# -DUSE_IPV6=OFF \ +# -DAUTOTEST=ON \ +# -GNinja +# cmake --build . --target install +# ctest -j50 --output-on-failure --rerun-failed --repeat until-pass:6 - build-freebsd: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Test in FreeBSD - id: test - uses: vmactions/freebsd-vm@v1 - with: - usesh: true - copyback: false - prepare: - PAGER=cat ASSUME_ALWAYS_YES=YES pkg install - cmake - git - gmake - googletest - libconfig - libsodium - libvpx - ninja - opus - pkgconf +# build-freebsd: +# runs-on: ubuntu-22.04 +# steps: +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - name: Test in FreeBSD +# id: test +# uses: vmactions/freebsd-vm@v1 +# with: +# usesh: true +# copyback: false +# prepare: +# PAGER=cat ASSUME_ALWAYS_YES=YES pkg install +# cmake +# git +# gmake +# googletest +# libconfig +# libsodium +# libvpx +# ninja +# opus +# pkgconf - run: | - # TODO(iphydf): Investigate FreeBSD failures on these tests. - sed -Ei -e '/\(dht_getnodes_api\)/s/^/#/' auto_tests/CMakeLists.txt - cmake . \ - -DMIN_LOGGER_LEVEL=TRACE \ - -DMUST_BUILD_TOXAV=ON \ - -DNON_HERMETIC_TESTS=ON \ - -DTEST_TIMEOUT_SECONDS=50 \ - -DUSE_IPV6=OFF \ - -DAUTOTEST=ON \ - -GNinja - cmake --build . --target install - ctest -j50 --output-on-failure --rerun-failed --repeat until-pass:6 +# run: | +# # TODO(iphydf): Investigate FreeBSD failures on these tests. +# sed -Ei -e '/\(dht_getnodes_api\)/s/^/#/' auto_tests/CMakeLists.txt +# cmake . \ +# -DMIN_LOGGER_LEVEL=TRACE \ +# -DMUST_BUILD_TOXAV=ON \ +# -DNON_HERMETIC_TESTS=ON \ +# -DTEST_TIMEOUT_SECONDS=50 \ +# -DUSE_IPV6=OFF \ +# -DAUTOTEST=ON \ +# -GNinja +# cmake --build . --target install +# ctest -j50 --output-on-failure --rerun-failed --repeat until-pass:6 - mypy: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Set up Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: 3.9 - - name: Install mypy - run: pip install mypy - - name: Run mypy - run: | - (find . -name "*.py" -and -not -name "conanfile.py"; grep -lR '^#!.*python') \ - | xargs -n1 -P8 mypy --strict +# mypy: +# runs-on: ubuntu-22.04 +# steps: +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - name: Set up Python 3.9 +# uses: actions/setup-python@v5 +# with: +# python-version: 3.9 +# - name: Install mypy +# run: pip install mypy +# - name: Run mypy +# run: | +# (find . -name "*.py" -and -not -name "conanfile.py"; grep -lR '^#!.*python') \ +# | xargs -n1 -P8 mypy --strict diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000000..c5e6d4f25f --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,90 @@ +name: deploy + +on: + # Allow manual trigger. + workflow_dispatch: + pull_request: + branches: ["master"] + push: + branches: ["master"] + tags: ["v*"] + +# Cancel old PR builds when pushing new commits. +concurrency: + group: deploy-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + + ################################################################################################ + # Preparation jobs + ################################################################################################ + + update-nightly-tag: + name: Update nightly release tag + runs-on: ubuntu-24.04 + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - name: Move nightly tag to head for nightly release + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + run: git tag -f nightly && git push origin nightly -f + + ################################################################################################ + # Build and deploy jobs (PR and push) + ################################################################################################ + + build-linux: + name: Linux + runs-on: ubuntu-24.04 + needs: [update-nightly-tag] + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Install build tools + run: sudo apt-get install -y --no-install-recommends yasm + - name: Run build + run: other/deploy/linux.sh + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: toxcore-linux-x86_64 + path: toxcore-linux-x86_64 + - name: Get tag name for release file name + if: contains(github.ref, 'refs/tags/v') + id: get_version + run: | + VERSION="$(echo "$GITHUB_REF" | cut -d / -f 3)" + echo "release_tarball=toxcore-$VERSION-linux-x86_64.tar.gz" >>$GITHUB_OUTPUT + - name: Create tarball for release upload + if: contains(github.ref, 'refs/tags/v') + run: | + tar zcf "${{ steps.get_version.outputs.release_tarball }}" toxcore-linux-x86_64 + sha256sum "${{ steps.get_version.outputs.release_tarball }}" > "${{ steps.get_version.outputs.release_tarball }}.sha256" + - name: Upload to versioned release + if: contains(github.ref, 'refs/tags/v') + uses: ncipollo/release-action@v1 + with: + allowUpdates: true + draft: true + token: ${{ secrets.GITHUB_TOKEN }} + artifacts: "${{ steps.get_version.outputs.release_tarball }},${{ steps.get_version.outputs.release_tarball }}.sha256" + - name: Create tarball for nightly upload + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + run: | + tar zcf toxcore-nightly-linux-x86_64.tar.gz toxcore-linux-x86_64 + sha256sum toxcore-nightly-linux-x86_64.tar.gz > toxcore-nightly-linux-x86_64.tar.gz.sha256 + - name: Upload to nightly release + uses: ncipollo/release-action@v1 + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + with: + allowUpdates: true + tag: nightly + omitBodyDuringUpdate: true + omitNameDuringUpdate: true + prerelease: true + replacesArtifacts: true + token: ${{ secrets.GITHUB_TOKEN }} + artifacts: "toxcore-nightly-linux-x86_64.tar.gz,toxcore-nightly-linux-x86_64.tar.gz.sha256" diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 9b7092fc55..2b6d5a470f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,181 +1,181 @@ -name: docker +# name: docker -on: - push: - branches: [master] - pull_request: - branches: [master] +# on: +# push: +# branches: [master] +# pull_request: +# branches: [master] -# Cancel old PR builds when pushing new commits. -concurrency: - group: docker-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true +# # Cancel old PR builds when pushing new commits. +# concurrency: +# group: docker-${{ github.event.pull_request.number || github.ref }} +# cancel-in-progress: true -jobs: - docker-bootstrap-node: - runs-on: ubuntu-latest - steps: - - name: Login to DockerHub - if: ${{ github.event_name == 'push' }} - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Docker Build - run: .github/scripts/tox-bootstrapd-docker local "$CHECK" - env: - CHECK: "${{ contains(github.event.pull_request.title, 'chore: Release ') && 'sha256sum' || 'echo' }}" - - name: Push latest image to DockerHub - if: ${{ github.event_name == 'push' }} - run: docker push toxchat/bootstrap-node:latest - - name: Push versioned image to DockerHub - if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }} - run: docker push toxchat/bootstrap-node:"$(other/print-version)" +# jobs: +# docker-bootstrap-node: +# runs-on: ubuntu-latest +# steps: +# - name: Login to DockerHub +# if: ${{ github.event_name == 'push' }} +# uses: docker/login-action@v3 +# with: +# username: ${{ secrets.DOCKERHUB_USERNAME }} +# password: ${{ secrets.DOCKERHUB_TOKEN }} +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - name: Docker Build +# run: .github/scripts/tox-bootstrapd-docker local "$CHECK" +# env: +# CHECK: "${{ contains(github.event.pull_request.title, 'chore: Release ') && 'sha256sum' || 'echo' }}" +# - name: Push latest image to DockerHub +# if: ${{ github.event_name == 'push' }} +# run: docker push toxchat/bootstrap-node:latest +# - name: Push versioned image to DockerHub +# if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }} +# run: docker push toxchat/bootstrap-node:"$(other/print-version)" - docker-bootstrap-node-websocket: - runs-on: ubuntu-latest - needs: [docker-bootstrap-node] - steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to DockerHub - if: ${{ github.event_name == 'push' }} - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: "{{defaultContext}}:other/bootstrap_daemon/websocket" - push: ${{ github.event_name == 'push' }} - tags: toxchat/bootstrap-node:latest-websocket - cache-from: type=registry,ref=toxchat/bootstrap-node:latest-websocket - cache-to: type=inline +# docker-bootstrap-node-websocket: +# runs-on: ubuntu-latest +# needs: [docker-bootstrap-node] +# steps: +# - name: Set up Docker Buildx +# uses: docker/setup-buildx-action@v3 +# - name: Login to DockerHub +# if: ${{ github.event_name == 'push' }} +# uses: docker/login-action@v3 +# with: +# username: ${{ secrets.DOCKERHUB_USERNAME }} +# password: ${{ secrets.DOCKERHUB_TOKEN }} +# - name: Build and push +# uses: docker/build-push-action@v5 +# with: +# context: "{{defaultContext}}:other/bootstrap_daemon/websocket" +# push: ${{ github.event_name == 'push' }} +# tags: toxchat/bootstrap-node:latest-websocket +# cache-from: type=registry,ref=toxchat/bootstrap-node:latest-websocket +# cache-to: type=inline - docker-clusterfuzz: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to DockerHub - if: ${{ github.event_name == 'push' }} - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: "." - file: .clusterfuzzlite/Dockerfile - push: ${{ github.event_name == 'push' }} - tags: toxchat/c-toxcore:clusterfuzz - cache-from: type=registry,ref=toxchat/c-toxcore:clusterfuzz - cache-to: type=inline +# docker-clusterfuzz: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# - name: Set up Docker Buildx +# uses: docker/setup-buildx-action@v3 +# - name: Login to DockerHub +# if: ${{ github.event_name == 'push' }} +# uses: docker/login-action@v3 +# with: +# username: ${{ secrets.DOCKERHUB_USERNAME }} +# password: ${{ secrets.DOCKERHUB_TOKEN }} +# - name: Build and push +# uses: docker/build-push-action@v5 +# with: +# context: "." +# file: .clusterfuzzlite/Dockerfile +# push: ${{ github.event_name == 'push' }} +# tags: toxchat/c-toxcore:clusterfuzz +# cache-from: type=registry,ref=toxchat/c-toxcore:clusterfuzz +# cache-to: type=inline - docker-fuzzer: - runs-on: ubuntu-latest - steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to DockerHub - if: ${{ github.event_name == 'push' }} - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v5 - with: - file: testing/Dockerfile - push: ${{ github.event_name == 'push' }} - tags: toxchat/c-toxcore:fuzzer - cache-from: type=registry,ref=toxchat/c-toxcore:fuzzer - cache-to: type=inline +# docker-fuzzer: +# runs-on: ubuntu-latest +# steps: +# - name: Set up Docker Buildx +# uses: docker/setup-buildx-action@v3 +# - name: Login to DockerHub +# if: ${{ github.event_name == 'push' }} +# uses: docker/login-action@v3 +# with: +# username: ${{ secrets.DOCKERHUB_USERNAME }} +# password: ${{ secrets.DOCKERHUB_TOKEN }} +# - name: Build and push +# uses: docker/build-push-action@v5 +# with: +# file: testing/Dockerfile +# push: ${{ github.event_name == 'push' }} +# tags: toxchat/c-toxcore:fuzzer +# cache-from: type=registry,ref=toxchat/c-toxcore:fuzzer +# cache-to: type=inline - docker-toxcore-js: - runs-on: ubuntu-latest - steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to DockerHub - if: ${{ github.event_name == 'push' }} - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v5 - with: - file: other/emscripten/Dockerfile - push: ${{ github.event_name == 'push' }} - tags: toxchat/c-toxcore:wasm - cache-from: type=registry,ref=toxchat/c-toxcore:wasm - cache-to: type=inline +# docker-toxcore-js: +# runs-on: ubuntu-latest +# steps: +# - name: Set up Docker Buildx +# uses: docker/setup-buildx-action@v3 +# - name: Login to DockerHub +# if: ${{ github.event_name == 'push' }} +# uses: docker/login-action@v3 +# with: +# username: ${{ secrets.DOCKERHUB_USERNAME }} +# password: ${{ secrets.DOCKERHUB_TOKEN }} +# - name: Build and push +# uses: docker/build-push-action@v5 +# with: +# file: other/emscripten/Dockerfile +# push: ${{ github.event_name == 'push' }} +# tags: toxchat/c-toxcore:wasm +# cache-from: type=registry,ref=toxchat/c-toxcore:wasm +# cache-to: type=inline - docker-esp32: - runs-on: ubuntu-latest - steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to DockerHub - if: ${{ github.event_name == 'push' }} - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v5 - with: - file: other/docker/esp32/Dockerfile - push: ${{ github.event_name == 'push' }} - tags: toxchat/c-toxcore:esp32 - cache-from: type=registry,ref=toxchat/c-toxcore:esp32 - cache-to: type=inline +# docker-esp32: +# runs-on: ubuntu-latest +# steps: +# - name: Set up Docker Buildx +# uses: docker/setup-buildx-action@v3 +# - name: Login to DockerHub +# if: ${{ github.event_name == 'push' }} +# uses: docker/login-action@v3 +# with: +# username: ${{ secrets.DOCKERHUB_USERNAME }} +# password: ${{ secrets.DOCKERHUB_TOKEN }} +# - name: Build and push +# uses: docker/build-push-action@v5 +# with: +# file: other/docker/esp32/Dockerfile +# push: ${{ github.event_name == 'push' }} +# tags: toxchat/c-toxcore:esp32 +# cache-from: type=registry,ref=toxchat/c-toxcore:esp32 +# cache-to: type=inline - docker-windows-mingw: - strategy: - matrix: - bits: [32, 64] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to DockerHub - if: ${{ github.event_name == 'push' }} - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and store to local Docker daemon - uses: docker/build-push-action@v5 - with: - context: other/docker/windows - load: true - tags: toxchat/windows:win${{ matrix.bits }} - cache-from: type=registry,ref=toxchat/windows:win${{ matrix.bits }} - build-args: | - SUPPORT_ARCH_i686=${{ matrix.bits == '32' }} - SUPPORT_ARCH_x86_64=${{ matrix.bits == '64' }} - SUPPORT_TEST=true - - name: Push the stored image to Dockerhub - if: ${{ github.event_name == 'push' }} - uses: docker/build-push-action@v5 - with: - context: other/docker/windows - push: ${{ github.event_name == 'push' }} - tags: toxchat/windows:win${{ matrix.bits }} - build-args: | - SUPPORT_ARCH_i686=${{ matrix.bits == '32' }} - SUPPORT_ARCH_x86_64=${{ matrix.bits == '64' }} - SUPPORT_TEST=true - - name: Cross-compile - run: .github/scripts/cmake-win${{ matrix.bits }} script +# docker-windows-mingw: +# strategy: +# matrix: +# bits: [32, 64] +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - name: Set up Docker Buildx +# uses: docker/setup-buildx-action@v3 +# - name: Login to DockerHub +# if: ${{ github.event_name == 'push' }} +# uses: docker/login-action@v3 +# with: +# username: ${{ secrets.DOCKERHUB_USERNAME }} +# password: ${{ secrets.DOCKERHUB_TOKEN }} +# - name: Build and store to local Docker daemon +# uses: docker/build-push-action@v5 +# with: +# context: other/docker/windows +# load: true +# tags: toxchat/windows:win${{ matrix.bits }} +# cache-from: type=registry,ref=toxchat/windows:win${{ matrix.bits }} +# build-args: | +# SUPPORT_ARCH_i686=${{ matrix.bits == '32' }} +# SUPPORT_ARCH_x86_64=${{ matrix.bits == '64' }} +# SUPPORT_TEST=true +# - name: Push the stored image to Dockerhub +# if: ${{ github.event_name == 'push' }} +# uses: docker/build-push-action@v5 +# with: +# context: other/docker/windows +# push: ${{ github.event_name == 'push' }} +# tags: toxchat/windows:win${{ matrix.bits }} +# build-args: | +# SUPPORT_ARCH_i686=${{ matrix.bits == '32' }} +# SUPPORT_ARCH_x86_64=${{ matrix.bits == '64' }} +# SUPPORT_TEST=true +# - name: Cross-compile +# run: .github/scripts/cmake-win${{ matrix.bits }} script diff --git a/.github/workflows/sonar-scan.yml b/.github/workflows/sonar-scan.yml index e25ac3750d..4caf5b54c7 100644 --- a/.github/workflows/sonar-scan.yml +++ b/.github/workflows/sonar-scan.yml @@ -1,57 +1,57 @@ -name: sonar-scan +# name: sonar-scan -on: - push: - branches: [master] - pull_request: - branches: [master] +# on: +# push: +# branches: [master] +# pull_request: +# branches: [master] -# Cancel old PR builds when pushing new commits. -concurrency: - group: scan-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true +# # Cancel old PR builds when pushing new commits. +# concurrency: +# group: scan-${{ github.event.pull_request.number || github.ref }} +# cancel-in-progress: true -jobs: - sonar-scan: - runs-on: ubuntu-latest - env: - SONAR_SCANNER_VERSION: 5.0.1.3006 - SONAR_SERVER_URL: "https://sonarcloud.io" - BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - submodules: recursive - - name: Set up JDK 17 - uses: actions/setup-java@v2 - with: - distribution: "zulu" - java-version: 17 - - name: Download and set up sonar-scanner - env: - SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip - run: | - mkdir -p $HOME/.sonar - curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }} - unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ - echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH - - name: Download and set up build-wrapper - env: - BUILD_WRAPPER_DOWNLOAD_URL: ${{ env.SONAR_SERVER_URL }}/static/cpp/build-wrapper-linux-x86.zip - run: | - curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }} - unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/ - echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH - - name: Install dependencies and prepare build - run: | - .github/scripts/sonar-prepare - - name: Run build-wrapper - run: | - build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} .github/scripts/sonar-build - - name: Run sonar-scanner - if: github.event_name == 'push' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: 'sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"' +# jobs: +# sonar-scan: +# runs-on: ubuntu-latest +# env: +# SONAR_SCANNER_VERSION: 5.0.1.3006 +# SONAR_SERVER_URL: "https://sonarcloud.io" +# BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed +# steps: +# - uses: actions/checkout@v4 +# with: +# fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis +# submodules: recursive +# - name: Set up JDK 17 +# uses: actions/setup-java@v2 +# with: +# distribution: "zulu" +# java-version: 17 +# - name: Download and set up sonar-scanner +# env: +# SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip +# run: | +# mkdir -p $HOME/.sonar +# curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }} +# unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ +# echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH +# - name: Download and set up build-wrapper +# env: +# BUILD_WRAPPER_DOWNLOAD_URL: ${{ env.SONAR_SERVER_URL }}/static/cpp/build-wrapper-linux-x86.zip +# run: | +# curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }} +# unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/ +# echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH +# - name: Install dependencies and prepare build +# run: | +# .github/scripts/sonar-prepare +# - name: Run build-wrapper +# run: | +# build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} .github/scripts/sonar-build +# - name: Run sonar-scanner +# if: github.event_name == 'push' +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} +# run: 'sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"' diff --git a/other/deploy/deps.sh b/other/deploy/deps.sh new file mode 100755 index 0000000000..69c4717143 --- /dev/null +++ b/other/deploy/deps.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -eux -o pipefail + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" + +git clone --depth=1 https://github.com/TokTok/dockerfiles "$SCRIPT_DIR/dockerfiles" + +SYSTEM="$1" +ARCH="$(uname -m)" + +DEP_PREFIX="$PWD/prefix" + +for dep in sodium opus vpx; do + mkdir -p "external/$dep" + pushd "external/$dep" + if [ -f "$SCRIPT_DIR/dockerfiles/qtox/build_${dep}_$SYSTEM.sh" ]; then + SCRIPT="$SCRIPT_DIR/dockerfiles/qtox/build_${dep}_$SYSTEM.sh" + else + SCRIPT="$SCRIPT_DIR/dockerfiles/qtox/build_$dep.sh" + fi + "$SCRIPT" --arch "$SYSTEM-$ARCH" --libtype "static" --buildtype "release" --prefix "$DEP_PREFIX" --macos "10.15" + popd + rm -rf "external/$dep" +done diff --git a/other/deploy/linux.sh b/other/deploy/linux.sh new file mode 100755 index 0000000000..f355b3d3ee --- /dev/null +++ b/other/deploy/linux.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +set -eux -o pipefail + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" + +"$SCRIPT_DIR/deps.sh" linux + +export PKG_CONFIG_PATH="$PWD/prefix/lib/pkgconfig" + +# Build +cmake \ + -B _build \ + -G Ninja \ + -DCMAKE_INSTALL_PREFIX="$PWD/toxcore-linux-$(uname -m)" \ + -DCMAKE_BUILD_TYPE=Release \ + -DENABLE_STATIC=OFF \ + -DENABLE_SHARED=ON \ + -DMUST_BUILD_TOXAV=ON \ + -DDHT_BOOTSTRAP=OFF \ + -DBOOTSTRAP_DAEMON=OFF \ + -DUNITTEST=OFF \ + -DMIN_LOGGER_LEVEL=TRACE + +cmake --build _build +cmake --install _build