diff --git a/.circleci/config.yml b/.circleci/config.yml index 69811f4d7f..32d5bda085 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,147 +1,147 @@ ---- -version: 2 - -workflows: - version: 2 - program-analysis: - jobs: - # Dynamic analysis in the Bazel build - - bazel-asan - - bazel-msan - - bazel-tsan - # Dynamic analysis with CMake - - asan - - tsan - - ubsan - # Static analysis - - clang-analyze - - cpplint - - static-analysis - -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-tsan: - working_directory: /tmp/cirrus-ci-build - docker: - - image: toxchat/toktok-stack:latest-tsan - - steps: - - checkout - - run: .circleci/bazel-test - //c-toxcore/... - -//c-toxcore/auto_tests:conference_av_test - -//c-toxcore/auto_tests:conference_test - -//c-toxcore/auto_tests:onion_test - -//c-toxcore/auto_tests:tox_many_test - - 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 - - asan: - 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 - libconfig-dev - libgmock-dev - libgtest-dev - libopus-dev - libsodium-dev - libvpx-dev - llvm-dev - ninja-build - pkg-config - - checkout - - run: git submodule update --init --recursive - - run: CC=clang .circleci/cmake-asan - - tsan: - working_directory: ~/work - docker: - - image: ubuntu - - steps: - - run: *apt_install - - checkout - - run: git submodule update --init --recursive - - run: CC=clang .circleci/cmake-tsan - - ubsan: - working_directory: ~/work - docker: - - image: ubuntu - - steps: - - run: *apt_install - - checkout - - run: git submodule update --init --recursive - - run: CC=clang .circleci/cmake-ubsan - - static-analysis: - working_directory: ~/work - docker: - - image: ubuntu - - steps: - - run: *apt_install - - 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 +# --- +# version: 2 + +# workflows: +# version: 2 +# program-analysis: +# jobs: +# # Dynamic analysis in the Bazel build +# - bazel-asan +# - bazel-msan +# - bazel-tsan +# # Dynamic analysis with CMake +# - asan +# - tsan +# - ubsan +# # Static analysis +# - clang-analyze +# - cpplint +# - static-analysis + +# 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-tsan: +# working_directory: /tmp/cirrus-ci-build +# docker: +# - image: toxchat/toktok-stack:latest-tsan + +# steps: +# - checkout +# - run: .circleci/bazel-test +# //c-toxcore/... +# -//c-toxcore/auto_tests:conference_av_test +# -//c-toxcore/auto_tests:conference_test +# -//c-toxcore/auto_tests:onion_test +# -//c-toxcore/auto_tests:tox_many_test + +# 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 + +# asan: +# 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 +# libconfig-dev +# libgmock-dev +# libgtest-dev +# libopus-dev +# libsodium-dev +# libvpx-dev +# llvm-dev +# ninja-build +# pkg-config +# - checkout +# - run: git submodule update --init --recursive +# - run: CC=clang .circleci/cmake-asan + +# tsan: +# working_directory: ~/work +# docker: +# - image: ubuntu + +# steps: +# - run: *apt_install +# - checkout +# - run: git submodule update --init --recursive +# - run: CC=clang .circleci/cmake-tsan + +# ubsan: +# working_directory: ~/work +# docker: +# - image: ubuntu + +# steps: +# - run: *apt_install +# - checkout +# - run: git submodule update --init --recursive +# - run: CC=clang .circleci/cmake-ubsan + +# static-analysis: +# working_directory: ~/work +# docker: +# - image: ubuntu + +# steps: +# - run: *apt_install +# - 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 diff --git a/.cirrus.yml b/.cirrus.yml index 5f7bf44342..6a502c8dc8 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,83 +1,83 @@ ---- -bazel-opt_task: - timeout_in: 5m - container: - image: toxchat/toktok-stack:latest-release - cpu: 2 - memory: 2G - configure_script: - - git submodule update --init --recursive - - /src/workspace/tools/inject-repo c-toxcore - test_all_script: - - cd /src/workspace && bazel test -k - --remote_cache=http://$CIRRUS_HTTP_CACHE_HOST - --build_tag_filters=-haskell - --test_tag_filters=-haskell - -- - //c-toxcore/... - -//c-toxcore/auto_tests:tcp_relay_test # Cirrus doesn't allow external network connections. +# --- +# bazel-opt_task: +# timeout_in: 5m +# container: +# image: toxchat/toktok-stack:latest-release +# cpu: 2 +# memory: 2G +# configure_script: +# - git submodule update --init --recursive +# - /src/workspace/tools/inject-repo c-toxcore +# test_all_script: +# - cd /src/workspace && bazel test -k +# --remote_cache=http://$CIRRUS_HTTP_CACHE_HOST +# --build_tag_filters=-haskell +# --test_tag_filters=-haskell +# -- +# //c-toxcore/... +# -//c-toxcore/auto_tests:tcp_relay_test # Cirrus doesn't allow external network connections. -bazel-dbg_task: - timeout_in: 5m - container: - image: toxchat/toktok-stack:latest-debug - cpu: 2 - memory: 2G - configure_script: - - git submodule update --init --recursive - - /src/workspace/tools/inject-repo c-toxcore - test_all_script: - - cd /src/workspace && bazel test -k - --remote_cache=http://$CIRRUS_HTTP_CACHE_HOST - --build_tag_filters=-haskell - --test_tag_filters=-haskell - -- - //c-toxcore/... - -//c-toxcore/auto_tests:tcp_relay_test # Cirrus doesn't allow external network connections. +# bazel-dbg_task: +# timeout_in: 5m +# container: +# image: toxchat/toktok-stack:latest-debug +# cpu: 2 +# memory: 2G +# configure_script: +# - git submodule update --init --recursive +# - /src/workspace/tools/inject-repo c-toxcore +# test_all_script: +# - cd /src/workspace && bazel test -k +# --remote_cache=http://$CIRRUS_HTTP_CACHE_HOST +# --build_tag_filters=-haskell +# --test_tag_filters=-haskell +# -- +# //c-toxcore/... +# -//c-toxcore/auto_tests:tcp_relay_test # Cirrus doesn't allow external network connections. -cimple_task: - timeout_in: 5m - container: - image: toxchat/toktok-stack:latest-release - cpu: 2 - memory: 4G - configure_script: - - git submodule update --init --recursive - - /src/workspace/tools/inject-repo c-toxcore - test_all_script: - - cd /src/workspace && bazel test -k - --remote_cache=http://$CIRRUS_HTTP_CACHE_HOST - --build_tag_filters=haskell - --test_tag_filters=haskell - -- - //c-toxcore/... +# cimple_task: +# timeout_in: 5m +# container: +# image: toxchat/toktok-stack:latest-release +# cpu: 2 +# memory: 4G +# configure_script: +# - git submodule update --init --recursive +# - /src/workspace/tools/inject-repo c-toxcore +# test_all_script: +# - cd /src/workspace && bazel test -k +# --remote_cache=http://$CIRRUS_HTTP_CACHE_HOST +# --build_tag_filters=haskell +# --test_tag_filters=haskell +# -- +# //c-toxcore/... -freebsd_task: - timeout_in: 5m - freebsd_instance: - image_family: freebsd-14-1 - configure_script: - - PAGER=cat ASSUME_ALWAYS_YES=YES pkg install - cmake - git - gmake - googletest - libconfig - libsodium - libvpx - opus - pkgconf - - git submodule update --init --recursive - test_all_script: - - | - # 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=OFF \ - -DTEST_TIMEOUT_SECONDS=50 \ - -DUSE_IPV6=OFF \ - -DAUTOTEST=ON - cmake --build . --target install - ctest -j50 --output-on-failure --rerun-failed --repeat until-pass:6 +# freebsd_task: +# timeout_in: 5m +# freebsd_instance: +# image_family: freebsd-14-1 +# configure_script: +# - PAGER=cat ASSUME_ALWAYS_YES=YES pkg install +# cmake +# git +# gmake +# googletest +# libconfig +# libsodium +# libvpx +# opus +# pkgconf +# - git submodule update --init --recursive +# test_all_script: +# - | +# # 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=OFF \ +# -DTEST_TIMEOUT_SECONDS=50 \ +# -DUSE_IPV6=OFF \ +# -DAUTOTEST=ON +# cmake --build . --target install +# ctest -j50 --output-on-failure --rerun-failed --repeat until-pass:6 diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index f618b9ecbf..6be9b157c3 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -1,12 +1,12 @@ -name: checks +# name: checks -on: - pull_request: - branches: [master] - types: [opened, reopened, synchronize, milestoned] - pull_request_target: - branches: [master] +# on: +# pull_request: +# branches: [master] +# types: [opened, reopened, synchronize, milestoned] +# pull_request_target: +# branches: [master] -jobs: - checks: - uses: TokTok/ci-tools/.github/workflows/check-release.yml@master +# jobs: +# checks: +# uses: TokTok/ci-tools/.github/workflows/check-release.yml@master diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 46aa57f315..435ed299af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,200 +1,200 @@ -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-latest - 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-latest +# 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 - coverage-linux: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Build, test, and upload coverage - run: other/docker/coverage/run +# coverage-linux: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - name: Build, test, and upload coverage +# run: other/docker/coverage/run - generate-events: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Run generate_event_c - run: | - other/event_tooling/run - git diff --exit-code +# generate-events: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - name: Run generate_event_c +# run: | +# other/event_tooling/run +# git diff --exit-code - cimplefmt: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - name: Run cimplefmt - run: other/docker/cimplefmt/run -u $(find tox* -name "*.[ch]") +# cimplefmt: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# with: +# submodules: recursive +# - name: Run cimplefmt +# run: other/docker/cimplefmt/run -u $(find tox* -name "*.[ch]") - build-android: - runs-on: ubuntu-latest - 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-latest +# 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-latest - 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 - pkg-config +# build-netbsd: +# runs-on: ubuntu-latest +# 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 +# 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 - 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 +# cmake --build . --target install +# ctest -j50 --output-on-failure --rerun-failed --repeat until-pass:6 - build-freebsd: - runs-on: ubuntu-latest - 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 - opus - pkgconf +# build-freebsd: +# runs-on: ubuntu-latest +# 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 +# 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 - 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 +# cmake --build . --target install +# ctest -j50 --output-on-failure --rerun-failed --repeat until-pass:6 - mypy: - runs-on: ubuntu-latest - 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-latest +# 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/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/CMakePresets.json b/CMakePresets.json index 45caa10d58..bfd9b017c7 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -17,5 +17,19 @@ "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" } } + ], + "buildPresets": [ + { + "name": "windows-default", + "configurePreset": "windows-default", + "description": "Build for Windows using default settings" + } + ], + "testPresets": [ + { + "name": "windows-default", + "configurePreset": "windows-default", + "description": "Run tests for Windows using default settings" + } ] } diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 941bc33158..c598d0b5f6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,15 +1,20 @@ pool: vmImage: "windows-2019" jobs: - - job: "windows_msvc_conan" + - job: "windows_msvc_vcpkg" strategy: matrix: static: - conan.shared: "False" + ENABLE_STATIC: "ON" + ENABLE_SHARED: "OFF" shared: - conan.shared: "True" + ENABLE_STATIC: "OFF" + ENABLE_SHARED: "ON" steps: - - bash: python -m pip install conan==1.59.0 - bash: git submodule update --init --recursive - - bash: conan install -if _build -o with_tests=True -o shared=$(conan.shared) . - - bash: CONAN_CPU_COUNT=50 CTEST_OUTPUT_ON_FAILURE=1 conan build -bf _build -if _build . || true + - bash: cmake --preset windows-default -DENABLE_STATIC=$(ENABLE_STATIC) -DENABLE_SHARED=$(ENABLE_SHARED) + env: + VCPKG_ROOT: "C:/vcpkg" + VCPKG_DEFAULT_TRIPLET: "x64-windows" + - bash: cmake --build _build --config Release + - bash: ctest --preset windows-default -C Release diff --git a/conanfile.py b/conanfile.py deleted file mode 100644 index e9af70b5c9..0000000000 --- a/conanfile.py +++ /dev/null @@ -1,87 +0,0 @@ -# pylint: disable=not-callable -import os -import re - -from conans import CMake -from conans import ConanFile -from conans.tools import collect_libs -from conans.tools import load - - -class ToxConan(ConanFile): - name = "c-toxcore" - url = "https://tox.chat" - description = "The future of online communications." - license = "GPL-3.0-only" - settings = "os", "compiler", "build_type", "arch" - requires = "libsodium/1.0.18", "opus/1.3.1", "libvpx/1.9.0" - generators = "cmake_find_package" - scm = {"type": "git", "url": "auto", "revision": "auto"} - - options = { - "shared": [True, False], - "with_tests": [True, False], - } - default_options = { - "shared": False, - "with_tests": False, - } - - _cmake = None - - def _create_cmake(self): - if self._cmake is not None: - return self._cmake - - self._cmake = CMake(self) - self._cmake.definitions["AUTOTEST"] = self.options.with_tests - self._cmake.definitions["BUILD_MISC_TESTS"] = self.options.with_tests - self._cmake.definitions["TEST_TIMEOUT_SECONDS"] = "300" - - self._cmake.definitions[ - "CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = self.options.shared - self._cmake.definitions["ENABLE_SHARED"] = self.options.shared - self._cmake.definitions["ENABLE_STATIC"] = not self.options.shared - self._cmake.definitions["MUST_BUILD_TOXAV"] = True - if self.settings.compiler == "Visual Studio": - self._cmake.definitions["MSVC_STATIC_SODIUM"] = True - self._cmake.definitions[ - "FLAT_OUTPUT_STRUCTURE"] = self.options.shared - - self._cmake.configure() - return self._cmake - - def set_version(self): - content = load(os.path.join(self.recipe_folder, "CMakeLists.txt")) - version_major = re.search(r"set\(PROJECT_VERSION_MAJOR \"(.*)\"\)", - content).group(1) - version_minor = re.search(r"set\(PROJECT_VERSION_MINOR \"(.*)\"\)", - content).group(1) - version_patch = re.search(r"set\(PROJECT_VERSION_PATCH \"(.*)\"\)", - content).group(1) - self.version = "%s.%s.%s" % ( - version_major.strip(), - version_minor.strip(), - version_patch.strip(), - ) - - def requirements(self): - if self.settings.os == "Windows": - self.requires("pthreads4w/3.0.0") - - def build(self): - cmake = self._create_cmake() - cmake.build() - - if self.options.with_tests: - cmake.test(output_on_failure=True) - - def package(self): - cmake = self._create_cmake() - cmake.install() - - def package_info(self): - self.cpp_info.libs = collect_libs(self) - - if self.settings.os == "Windows": - self.cpp_info.system_libs = ["Ws2_32", "Iphlpapi"]