forked from irungentoo/toxcore
-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
399 additions
and
76 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,222 @@ | ||
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 | ||
needs: [update-nightly-tag] | ||
strategy: | ||
matrix: | ||
arch: [aarch64, x86_64] | ||
runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }} | ||
steps: | ||
- 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: | ||
path: prefix | ||
key: ${{ github.job }}-${{ matrix.arch }}-deps | ||
- name: Run build | ||
run: other/deploy/linux.sh | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: toxcore-linux-${{ matrix.arch }} | ||
path: toxcore-linux-${{ matrix.arch }} | ||
- 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-${{ matrix.arch }}.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-${{ matrix.arch }} | ||
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-${{ matrix.arch }}.tar.gz toxcore-linux-${{ matrix.arch }} | ||
sha256sum toxcore-nightly-linux-${{ matrix.arch }}.tar.gz > toxcore-nightly-linux-${{ matrix.arch }}.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-${{ matrix.arch }}.tar.gz,toxcore-nightly-linux-${{ matrix.arch }}.tar.gz.sha256" | ||
|
||
build-macos: | ||
name: macOS | ||
needs: [update-nightly-tag] | ||
strategy: | ||
matrix: | ||
arch: [arm64, x86_64] | ||
runs-on: ${{ matrix.arch == 'arm64' && 'macos-14' || 'macos-13' }} | ||
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 | ||
- name: Run build | ||
run: other/deploy/macos.sh | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: toxcore-macos-${{ matrix.arch }} | ||
path: toxcore-macos-${{ matrix.arch }} | ||
- 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-macos-${{ matrix.arch }}.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-macos-${{ matrix.arch }} | ||
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-macos-${{ matrix.arch }}.tar.gz toxcore-macos-${{ matrix.arch }} | ||
sha256sum toxcore-nightly-macos-${{ matrix.arch }}.tar.gz > toxcore-nightly-macos-${{ matrix.arch }}.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-macos-${{ matrix.arch }}.tar.gz,toxcore-nightly-macos-${{ matrix.arch }}.tar.gz.sha256" | ||
|
||
build-android: | ||
name: Android | ||
needs: [update-nightly-tag] | ||
strategy: | ||
matrix: | ||
arch: [armeabi-v7a, arm64-v8a, x86, x86_64] | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- 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: | ||
path: prefix | ||
key: ${{ github.job }}-${{ matrix.arch }}-deps | ||
- name: Run build | ||
run: other/deploy/android.sh "${{ matrix.arch }}" | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: toxcore-android-${{ matrix.arch }} | ||
path: toxcore-android-${{ matrix.arch }} | ||
- 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-android-${{ matrix.arch }}.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-android-${{ matrix.arch }} | ||
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-android-${{ matrix.arch }}.tar.gz toxcore-android-${{ matrix.arch }} | ||
sha256sum toxcore-nightly-android-${{ matrix.arch }}.tar.gz > toxcore-nightly-android-${{ matrix.arch }}.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-android-${{ matrix.arch }}.tar.gz,toxcore-nightly-android-${{ matrix.arch }}.tar.gz.sha256" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#!/bin/bash | ||
|
||
set -eu | ||
|
||
# Set up environment | ||
NDK=$ANDROID_NDK_HOME | ||
|
||
ABI=${1:-"armeabi-v7a"} | ||
|
||
case $ABI in | ||
armeabi-v7a) | ||
TARGET=armv7a-linux-androideabi | ||
NDK_API=21 | ||
ANDROID_VPX_ABI=armv7-android-gcc | ||
;; | ||
arm64-v8a) | ||
TARGET=aarch64-linux-android | ||
NDK_API=21 | ||
ANDROID_VPX_ABI=arm64-android-gcc | ||
;; | ||
x86) | ||
TARGET=i686-linux-android | ||
NDK_API=21 | ||
ANDROID_VPX_ABI=x86-android-gcc | ||
;; | ||
x86_64) | ||
TARGET=x86_64-linux-android | ||
NDK_API=21 | ||
ANDROID_VPX_ABI=x86_64-android-gcc | ||
;; | ||
*) | ||
exit 1 | ||
;; | ||
esac | ||
|
||
PREFIX="$PWD/prefix" | ||
|
||
TOOLCHAIN="$NDK/toolchains/llvm/prebuilt/linux-x86_64" | ||
SYSROOT="$TOOLCHAIN/sysroot" | ||
|
||
export CC="$TOOLCHAIN/bin/$TARGET$NDK_API-clang" | ||
export CXX="$TOOLCHAIN/bin/$TARGET$NDK_API-clang++" | ||
export LDFLAGS=-static-libstdc++ | ||
export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig" | ||
|
||
# Build libsodium | ||
if [ ! -f "$PREFIX/lib/libsodium.a" ]; then | ||
tar zxf <(wget -O- https://github.com/jedisct1/libsodium/releases/download/1.0.20-RELEASE/libsodium-1.0.20.tar.gz) | ||
pushd libsodium-1.0.20 | ||
./configure --prefix="$PREFIX" --host="$TARGET" --with-sysroot="$SYSROOT" --disable-shared --disable-pie | ||
make -j"$(nproc)" install | ||
popd | ||
rm -rf libsodium-1.0.20 | ||
fi | ||
|
||
# Build opus | ||
if [ ! -f "$PREFIX/lib/libopus.a" ]; then | ||
tar zxf <(wget -O- https://github.com/xiph/opus/releases/download/v1.5.2/opus-1.5.2.tar.gz) | ||
pushd opus-1.5.2 | ||
CFLAGS="-fPIC" ./configure --prefix="$PREFIX" --host="$TARGET" --with-sysroot="$SYSROOT" --disable-shared | ||
make "-j$(nproc)" | ||
make install | ||
popd | ||
rm -rf opus-1.5.2 | ||
fi | ||
|
||
# Build libvpx | ||
if [ ! -f "$PREFIX/lib/libvpx.a" ]; then | ||
tar zxf <(wget -O- https://github.com/webmproject/libvpx/archive/refs/tags/v1.15.0.tar.gz) | ||
pushd libvpx-1.15.0 | ||
./configure --prefix="$PREFIX" --libc="$SYSROOT" --target="$ANDROID_VPX_ABI" --disable-examples --disable-unit-tests --enable-pic \ | ||
|| (cat config.log && exit 1) | ||
sed -i -e "s!^AS=as!AS=$CC -c!" ./*.mk | ||
sed -i -e "s!^STRIP=strip!STRIP=$TOOLCHAIN/bin/llvm-strip!" ./*.mk | ||
make "-j$(nproc)" | ||
make install | ||
popd | ||
rm -rf libvpx-1.15.0 | ||
fi | ||
|
||
# Build c-toxcore | ||
rm -rf _build | ||
cmake -B _build -G Ninja \ | ||
-DANDROID_ABI="$ABI" \ | ||
-DCMAKE_TOOLCHAIN_FILE="$NDK/build/cmake/android.toolchain.cmake" \ | ||
-DCMAKE_INSTALL_PREFIX="$PWD/toxcore-android-$ABI" \ | ||
-DCMAKE_PREFIX_PATH="$PREFIX" \ | ||
-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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eux -o pipefail | ||
|
||
if [ -d "prefix" ]; then | ||
exit 0 | ||
fi | ||
|
||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
|
||
git clone --branch=pic --depth=1 https://github.com/iphydf/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eux -o pipefail | ||
|
||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
|
||
"$SCRIPT_DIR/deps.sh" macos | ||
|
||
export PKG_CONFIG_PATH="$PWD/prefix/lib/pkgconfig" | ||
|
||
# Build | ||
cmake \ | ||
-B _build \ | ||
-G Ninja \ | ||
-DCMAKE_INSTALL_PREFIX="$PWD/toxcore-macos-$(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 |