diff --git a/.circleci/config.yml b/.circleci/config.yml index 1dde721b720..c8bd490cc1a 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/checks.yml b/.github/workflows/checks.yml index f618b9ecbfa..6be9b157c37 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 4a71bf5230c..0c3b600b381 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,190 +1,190 @@ -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-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 index facc3879261..6633c1fe421 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -108,8 +108,6 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive - - name: Install build tools - run: brew install coreutils ninja yasm - name: Cache dependencies uses: actions/cache@v4 with: @@ -164,36 +162,34 @@ jobs: needs: [update-nightly-tag] strategy: matrix: - arch: [arm64, armv7, armv7s, i386, x86_64] + target: [ios-arm64, ios-armv7, ios-armv7s, iphonesimulator-arm64, iphonesimulator-x86_64] runs-on: 'macos-14' steps: - uses: actions/checkout@v4 with: submodules: recursive - - name: Install build tools - run: brew install coreutils ninja yasm - name: Cache dependencies uses: actions/cache@v4 with: - path: prefix - key: ${{ github.job }}-${{ matrix.arch }}-deps + path: prefix-${{ matrix.target }} + key: ${{ github.job }}-${{ matrix.target }}-deps - name: Run build - run: other/deploy/ios.sh "${{ matrix.arch }}" + run: other/deploy/ios.sh "${{ matrix.target }}" - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: toxcore-ios-${{ matrix.arch }} - path: toxcore-ios-${{ matrix.arch }} + name: toxcore-${{ matrix.target }} + path: toxcore-${{ matrix.target }} - 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-ios-${{ matrix.arch }}.tar.gz" >>$GITHUB_OUTPUT + echo "release_tarball=toxcore-$VERSION-${{ matrix.target }}.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-ios-${{ matrix.arch }} + tar zcf "${{ steps.get_version.outputs.release_tarball }}" toxcore-${{ matrix.target }} 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') @@ -206,8 +202,8 @@ jobs: - name: Create tarball for nightly upload if: github.event_name == 'push' && github.ref == 'refs/heads/master' run: | - tar zcf toxcore-nightly-ios-${{ matrix.arch }}.tar.gz toxcore-ios-${{ matrix.arch }} - sha256sum toxcore-nightly-ios-${{ matrix.arch }}.tar.gz > toxcore-nightly-ios-${{ matrix.arch }}.tar.gz.sha256 + tar zcf toxcore-nightly-${{ matrix.target }}.tar.gz toxcore-${{ matrix.target }} + sha256sum toxcore-nightly-${{ matrix.target }}.tar.gz > toxcore-nightly-${{ matrix.target }}.tar.gz.sha256 - name: Upload to nightly release uses: ncipollo/release-action@v1 if: github.event_name == 'push' && github.ref == 'refs/heads/master' @@ -219,7 +215,7 @@ jobs: prerelease: true replacesArtifacts: true token: ${{ secrets.GITHUB_TOKEN }} - artifacts: "toxcore-nightly-ios-${{ matrix.arch }}.tar.gz,toxcore-nightly-ios-${{ matrix.arch }}.tar.gz.sha256" + artifacts: "toxcore-nightly-${{ matrix.target }}.tar.gz,toxcore-nightly-${{ matrix.target }}.tar.gz.sha256" build-android: name: Android @@ -232,8 +228,6 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive - - name: Install build tools - run: sudo apt-get install -y --no-install-recommends ninja-build yasm - name: Cache dependencies uses: actions/cache@v4 with: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 9b7092fc55c..2b6d5a470f4 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/release.yml b/.github/workflows/release.yml index 9f4ee30be30..0b86a70eb2f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,12 +1,12 @@ -name: release +# name: release -on: - push: - branches: [master] - pull_request_target: - branches: [master] - types: [opened, reopened, synchronize] +# on: +# push: +# branches: [master] +# pull_request_target: +# branches: [master] +# types: [opened, reopened, synchronize] -jobs: - release: - uses: TokTok/ci-tools/.github/workflows/release-drafter.yml@master +# jobs: +# release: +# uses: TokTok/ci-tools/.github/workflows/release-drafter.yml@master diff --git a/.github/workflows/sonar-scan.yml b/.github/workflows/sonar-scan.yml index e25ac3750d7..4caf5b54c7d 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/android.sh b/other/deploy/android.sh index bffb5f80bbd..31361118cbe 100755 --- a/other/deploy/android.sh +++ b/other/deploy/android.sh @@ -2,6 +2,10 @@ set -eu +if [ -n "${CI-}" ]; then + sudo apt-get install -y --no-install-recommends ninja-build yasm +fi + # Set up environment NDK=$ANDROID_NDK_HOME diff --git a/other/deploy/deps.sh b/other/deploy/deps.sh index 4dbb8e90d91..be6cf9653c3 100755 --- a/other/deploy/deps.sh +++ b/other/deploy/deps.sh @@ -2,27 +2,28 @@ set -eux -o pipefail -if [ -d "prefix" ]; then - exit 0 -fi +SYSTEM="$1" +ARCH="$2" SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" -git clone --depth=1 https://github.com/TokTok/dockerfiles "$SCRIPT_DIR/dockerfiles" +if [ -d ../dockerfiles ]; then + DOCKERFILES="$(realpath ../dockerfiles)" +else + git clone --branch=simulator --depth=1 https://github.com/iphydf/dockerfiles "$SCRIPT_DIR/dockerfiles" + DOCKERFILES="$SCRIPT_DIR/dockerfiles" +fi -SYSTEM="$1" -ARCH="$2" +DEP_PREFIX="$PWD/deps-prefix-$SYSTEM-$ARCH" -DEP_PREFIX="$PWD/prefix" +if [ -d "$DEP_PREFIX" ]; then + exit 0 +fi 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="$DOCKERFILES/qtox/build_$dep.sh" "$SCRIPT" --arch "$SYSTEM-$ARCH" --libtype "static" --buildtype "release" --prefix "$DEP_PREFIX" --macos "10.15" popd rm -rf "external/$dep" diff --git a/other/deploy/ios.sh b/other/deploy/ios.sh index 40fdefbd212..6ff826afc4d 100755 --- a/other/deploy/ios.sh +++ b/other/deploy/ios.sh @@ -4,24 +4,39 @@ set -eux -o pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" -ARCH="$1" -"$SCRIPT_DIR/deps.sh" ios "$ARCH" +TARGET="$1" -export PKG_CONFIG_PATH="$PWD/prefix/lib/pkgconfig" +SYSTEM="${TARGET%%-*}" +ARCH="${TARGET#*-}" -IOS_FLAGS="-miphoneos-version-min=10.0 -arch $ARCH" +if [ -n "${CI-}" ]; then + brew install coreutils ninja yasm +fi + +"$SCRIPT_DIR/deps.sh" "$SYSTEM" "$ARCH" + +export PKG_CONFIG_PATH="$PWD/deps-prefix-$SYSTEM-$ARCH/lib/pkgconfig" -if [ "$ARCH" = "i386" ] || [ "$ARCH" = "x86_64" ]; then +if [ "$SYSTEM" = "ios" ]; then + XC_SDK="iphoneos" + TARGET_IPHONE_SIMULATOR=OFF + IOS_FLAGS="-miphoneos-version-min=10.0 -arch $ARCH" +elif [ "$SYSTEM" = "iphonesimulator" ]; then XC_SDK="iphonesimulator" + TARGET_IPHONE_SIMULATOR=ON + IOS_FLAGS="-arch $ARCH" else - XC_SDK="iphoneos" + echo "Unexpected system $SYSTEM" + exit 1 fi +BUILD_DIR="_build-$SYSTEM-$ARCH" + # Build for iOS 10 cmake \ - -B _build \ + -B "$BUILD_DIR" \ -G Ninja \ - -DCMAKE_INSTALL_PREFIX="$PWD/toxcore-ios-$ARCH" \ + -DCMAKE_INSTALL_PREFIX="$PWD/toxcore-$SYSTEM-$ARCH" \ -DCMAKE_BUILD_TYPE=Release \ -DENABLE_STATIC=OFF \ -DENABLE_SHARED=ON \ @@ -38,5 +53,5 @@ cmake \ -DCMAKE_OSX_SYSROOT="$(xcrun --sdk "$XC_SDK" --show-sdk-path)" \ -DCMAKE_OSX_ARCHITECTURES="$ARCH" -cmake --build _build -cmake --install _build +cmake --build "$BUILD_DIR" +cmake --install "$BUILD_DIR" diff --git a/other/deploy/ios/LICENSE b/other/deploy/ios/LICENSE new file mode 120000 index 00000000000..5853aaea53b --- /dev/null +++ b/other/deploy/ios/LICENSE @@ -0,0 +1 @@ +../../../LICENSE \ No newline at end of file diff --git a/other/deploy/ios/make_framework b/other/deploy/ios/make_framework new file mode 100755 index 00000000000..ae959f10777 --- /dev/null +++ b/other/deploy/ios/make_framework @@ -0,0 +1,71 @@ +#!/bin/bash + +set -eux -o pipefail + +# Make a Tox.xcframework for iOS, iPhone simulator, and macOS from the nightly builds. +for arch in arm64 armv7 armv7s; do + rm -rf "ios/$arch" + mkdir -p "ios/$arch" + tar -C "ios/$arch" --strip-components=1 -zxf \ + <(curl -L "https://github.com/TokTok/c-toxcore/releases/download/nightly/toxcore-nightly-ios-$arch.tar.gz") +done + +for arch in arm64 x86_64; do + rm -rf "iphonesimulator/$arch" + mkdir -p "iphonesimulator/$arch" + tar -C "iphonesimulator/$arch" --strip-components=1 -zxf \ + <(curl -L "https://github.com/TokTok/c-toxcore/releases/download/nightly/toxcore-nightly-iphonesimulator-$arch.tar.gz") +done + +for arch in arm64 x86_64; do + rm -rf "macos/$arch" + mkdir -p "macos/$arch" + tar -C "macos/$arch" --strip-components=1 -zxf \ + <(curl -L "https://github.com/TokTok/c-toxcore/releases/download/nightly/toxcore-nightly-macos-$arch.tar.gz") +done + +# Make a Tox.framework for iOS. +rm -rf ios/Tox.framework +mkdir -p ios/Tox.framework +cp -r ios/arm64/include/tox ios/Tox.framework/Headers +lipo -create -output ios/Tox.framework/Tox ios/arm64/lib/libtoxcore.dylib ios/armv7/lib/libtoxcore.dylib ios/armv7s/lib/libtoxcore.dylib +install_name_tool -id @rpath/Tox.framework/Tox ios/Tox.framework/Tox + +# Make a Tox.framework for iPhone simulator. +rm -rf iphonesimulator/Tox.framework +mkdir -p iphonesimulator/Tox.framework +cp -r iphonesimulator/arm64/include/tox iphonesimulator/Tox.framework/Headers +lipo -create -output iphonesimulator/Tox.framework/Tox iphonesimulator/arm64/lib/libtoxcore.dylib iphonesimulator/x86_64/lib/libtoxcore.dylib +install_name_tool -id @rpath/Tox.framework/Tox iphonesimulator/Tox.framework/Tox + +# Make a Tox.framework for macOS. +rm -rf macos/Tox.framework +mkdir -p macos/Tox.framework +cp -r macos/arm64/include/tox macos/Tox.framework/Headers +lipo -create -output macos/Tox.framework/Tox macos/arm64/lib/libtoxcore.dylib macos/x86_64/lib/libtoxcore.dylib +install_name_tool -id @rpath/Tox.framework/Tox macos/Tox.framework/Tox + +# Make a Tox.xcframework for iOS, iPhone simulator, and macOS. +rm -rf Tox.xcframework +xcodebuild -create-xcframework -framework ios/Tox.framework -framework iphonesimulator/Tox.framework -framework macos/Tox.framework -output Tox.xcframework + +# Test the Tox.xcframework. +cat >smoke-test.c <<'EOF' +#include + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdocumentation-deprecated-sync" +#include +#pragma GCC diagnostic pop + +int main(void) { + Tox *tox = tox_new(NULL, NULL); + if (tox == NULL) { + fprintf(stderr, "tox_new failed\n"); + return 1; + } + tox_kill(tox); + return 0; +} +EOF +pod lib lint toxcore.podspec diff --git a/other/deploy/ios/toxcore.podspec b/other/deploy/ios/toxcore.podspec new file mode 100644 index 00000000000..c46735056ae --- /dev/null +++ b/other/deploy/ios/toxcore.podspec @@ -0,0 +1,24 @@ +Pod::Spec.new do |s| + s.name = "toxcore" + s.version = "0.2.20" + s.summary = "Cocoapods wrapper for toxcore" + s.homepage = "https://github.com/TokTok/c-toxcore" + s.license = 'GPLv3' + s.author = { "Iphigenia Df" => "iphydf@gmail.com" } + s.source = { + :git => "https://github.com/TokTok/c-toxcore.git", + :tag => s.version.to_s, + :submodules => true + } + + s.requires_arc = false + + s.ios.deployment_target = '12.0' + s.osx.deployment_target = '10.15' + + s.vendored_frameworks = 'Tox.xcframework' + s.xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '"${PODS_ROOT}"' } + s.test_spec 'Tests' do |test_spec| + test_spec.source_files = 'smoketest.c' + end +end diff --git a/other/deploy/linux.sh b/other/deploy/linux.sh index 13ea78e24fd..16b537e0e6c 100755 --- a/other/deploy/linux.sh +++ b/other/deploy/linux.sh @@ -7,7 +7,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" ARCH="$1" "$SCRIPT_DIR/deps.sh" linux "$ARCH" -export PKG_CONFIG_PATH="$PWD/prefix/lib/pkgconfig" +export PKG_CONFIG_PATH="$PWD/deps-prefix-linux-$ARCH/lib/pkgconfig" # Build cmake \ diff --git a/other/deploy/macos.sh b/other/deploy/macos.sh index 859866d60d9..c00a70707db 100755 --- a/other/deploy/macos.sh +++ b/other/deploy/macos.sh @@ -4,10 +4,14 @@ set -eux -o pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +if [ -n "${CI-}" ]; then + brew install coreutils ninja yasm +fi + ARCH="$1" "$SCRIPT_DIR/deps.sh" macos "$ARCH" -export PKG_CONFIG_PATH="$PWD/prefix/lib/pkgconfig" +export PKG_CONFIG_PATH="$PWD/deps-prefix-macos-$ARCH/lib/pkgconfig" # Build for macOS cmake \