|
|
|
@@ -4,10 +4,12 @@ on:
|
|
|
|
push:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
tags:
|
|
|
|
- 'v*'
|
|
|
|
- 'v*'
|
|
|
|
|
|
|
|
paths-ignore:
|
|
|
|
|
|
|
|
- '.gitea/**'
|
|
|
|
workflow_dispatch:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
inputs:
|
|
|
|
targets:
|
|
|
|
targets:
|
|
|
|
description: 'Targets to build (comma-separated: amd64,arm64,armv7,mac-arm64)'
|
|
|
|
description: 'Targets to build (comma-separated: amd64,arm64,armv7)'
|
|
|
|
required: false
|
|
|
|
required: false
|
|
|
|
default: 'amd64'
|
|
|
|
default: 'amd64'
|
|
|
|
|
|
|
|
|
|
|
|
@@ -15,41 +17,43 @@ env:
|
|
|
|
CARGO_TERM_COLOR: always
|
|
|
|
CARGO_TERM_COLOR: always
|
|
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
jobs:
|
|
|
|
# Always builds on push tags. On manual dispatch, reads inputs.
|
|
|
|
|
|
|
|
build-amd64:
|
|
|
|
build-amd64:
|
|
|
|
if: >-
|
|
|
|
if: >-
|
|
|
|
github.event_name == 'push' ||
|
|
|
|
github.event_name == 'push' ||
|
|
|
|
contains(github.event.inputs.targets, 'amd64')
|
|
|
|
contains(github.event.inputs.targets, 'amd64')
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
|
|
|
|
|
|
|
image: rust:1-bookworm
|
|
|
|
|
|
|
|
steps:
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Checkout
|
|
|
|
|
|
|
|
run: |
|
|
|
|
|
|
|
|
apt-get update && apt-get install -y git curl jq
|
|
|
|
|
|
|
|
AUTH_URL="${{ github.server_url }}/${{ github.repository }}.git"
|
|
|
|
|
|
|
|
AUTH_URL=$(echo "$AUTH_URL" | sed "s|://|://${{ github.token }}@|")
|
|
|
|
|
|
|
|
git clone --depth 1 --branch ${{ github.ref_name }} "$AUTH_URL" .
|
|
|
|
|
|
|
|
git config --global url."https://git.tbs.amn.gg/manawenuz/featherChat.git".insteadOf "ssh://git@git.manko.yoga:222/manawenuz/featherChat.git"
|
|
|
|
|
|
|
|
git submodule update --init --depth 1
|
|
|
|
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
- name: Install Rust and dependencies
|
|
|
|
run: apt-get update && apt-get install -y cmake pkg-config libasound2-dev
|
|
|
|
run: |
|
|
|
|
|
|
|
|
apt-get install -y cmake pkg-config libasound2-dev libssl-dev build-essential
|
|
|
|
- name: Cache cargo
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
|
|
|
|
uses: actions/cache@v4
|
|
|
|
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
|
|
|
with:
|
|
|
|
|
|
|
|
path: |
|
|
|
|
|
|
|
|
~/.cargo/registry
|
|
|
|
|
|
|
|
~/.cargo/git
|
|
|
|
|
|
|
|
target
|
|
|
|
|
|
|
|
key: cargo-amd64-${{ hashFiles('Cargo.lock') }}
|
|
|
|
|
|
|
|
restore-keys: cargo-amd64-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Build headless binaries
|
|
|
|
- name: Build headless binaries
|
|
|
|
run: cargo build --release --bin wzp-relay --bin wzp-client --bin wzp-bench --bin wzp-web
|
|
|
|
run: |
|
|
|
|
|
|
|
|
export PATH="$HOME/.cargo/bin:$PATH"
|
|
|
|
|
|
|
|
cargo build --release --bin wzp-relay --bin wzp-client --bin wzp-bench --bin wzp-web
|
|
|
|
|
|
|
|
|
|
|
|
- name: Build audio client
|
|
|
|
- name: Build audio client
|
|
|
|
run: |
|
|
|
|
run: |
|
|
|
|
|
|
|
|
export PATH="$HOME/.cargo/bin:$PATH"
|
|
|
|
cargo build --release --bin wzp-client --features audio
|
|
|
|
cargo build --release --bin wzp-client --features audio
|
|
|
|
cp target/release/wzp-client target/release/wzp-client-audio
|
|
|
|
cp target/release/wzp-client target/release/wzp-client-audio
|
|
|
|
cargo build --release --bin wzp-client
|
|
|
|
cargo build --release --bin wzp-client
|
|
|
|
|
|
|
|
|
|
|
|
- name: Run tests
|
|
|
|
- name: Run tests
|
|
|
|
run: cargo test --workspace --lib
|
|
|
|
run: |
|
|
|
|
|
|
|
|
export PATH="$HOME/.cargo/bin:$PATH"
|
|
|
|
|
|
|
|
cargo test --workspace --lib
|
|
|
|
|
|
|
|
|
|
|
|
- name: Package
|
|
|
|
- name: Package
|
|
|
|
run: |
|
|
|
|
run: |
|
|
|
|
@@ -62,44 +66,56 @@ jobs:
|
|
|
|
cp -r crates/wzp-web/static dist/wzp-linux-amd64/
|
|
|
|
cp -r crates/wzp-web/static dist/wzp-linux-amd64/
|
|
|
|
cd dist && tar czf wzp-linux-amd64.tar.gz wzp-linux-amd64/
|
|
|
|
cd dist && tar czf wzp-linux-amd64.tar.gz wzp-linux-amd64/
|
|
|
|
|
|
|
|
|
|
|
|
- name: Upload artifact
|
|
|
|
- name: Upload to release
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
run: |
|
|
|
|
with:
|
|
|
|
API="${{ github.server_url }}/api/v1/repos/${{ github.repository }}"
|
|
|
|
name: wzp-linux-amd64
|
|
|
|
TOKEN="${{ github.token }}"
|
|
|
|
path: dist/wzp-linux-amd64.tar.gz
|
|
|
|
TAG="build-$(date +%Y%m%d-%H%M%S)"
|
|
|
|
|
|
|
|
SHA=$(git rev-parse --short HEAD)
|
|
|
|
|
|
|
|
# Create release
|
|
|
|
|
|
|
|
RELEASE=$(curl -sS -X POST "$API/releases" \
|
|
|
|
|
|
|
|
-H "Authorization: token $TOKEN" \
|
|
|
|
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
|
|
|
|
-d "{\"tag_name\":\"$TAG\",\"name\":\"Build $SHA (amd64)\",\"body\":\"Automated build from ${{ github.ref_name }} at $SHA\",\"draft\":false,\"prerelease\":true}")
|
|
|
|
|
|
|
|
RELEASE_ID=$(echo "$RELEASE" | jq -r '.id')
|
|
|
|
|
|
|
|
# Upload artifact
|
|
|
|
|
|
|
|
curl -sS -X POST "$API/releases/$RELEASE_ID/assets?name=wzp-linux-amd64.tar.gz" \
|
|
|
|
|
|
|
|
-H "Authorization: token $TOKEN" \
|
|
|
|
|
|
|
|
-H "Content-Type: application/octet-stream" \
|
|
|
|
|
|
|
|
--data-binary @dist/wzp-linux-amd64.tar.gz
|
|
|
|
|
|
|
|
echo "Release created: ${{ github.server_url }}/${{ github.repository }}/releases/tag/$TAG"
|
|
|
|
|
|
|
|
|
|
|
|
build-arm64:
|
|
|
|
build-arm64:
|
|
|
|
if: >-
|
|
|
|
if: >-
|
|
|
|
github.event_name == 'push' ||
|
|
|
|
github.event_name == 'push' ||
|
|
|
|
contains(github.event.inputs.targets, 'arm64')
|
|
|
|
contains(github.event.inputs.targets, 'arm64')
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
|
|
|
|
|
|
|
image: rust:1-bookworm
|
|
|
|
|
|
|
|
steps:
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Checkout
|
|
|
|
|
|
|
|
run: |
|
|
|
|
|
|
|
|
apt-get update && apt-get install -y git curl jq
|
|
|
|
|
|
|
|
AUTH_URL="${{ github.server_url }}/${{ github.repository }}.git"
|
|
|
|
|
|
|
|
AUTH_URL=$(echo "$AUTH_URL" | sed "s|://|://${{ github.token }}@|")
|
|
|
|
|
|
|
|
git clone --depth 1 --branch ${{ github.ref_name }} "$AUTH_URL" .
|
|
|
|
|
|
|
|
git config --global url."https://git.tbs.amn.gg/manawenuz/featherChat.git".insteadOf "ssh://git@git.manko.yoga:222/manawenuz/featherChat.git"
|
|
|
|
|
|
|
|
git submodule update --init --depth 1
|
|
|
|
|
|
|
|
|
|
|
|
- name: Install cross-compilation tools
|
|
|
|
- name: Install Rust and cross-compilation tools
|
|
|
|
run: |
|
|
|
|
run: |
|
|
|
|
dpkg --add-architecture arm64
|
|
|
|
dpkg --add-architecture arm64
|
|
|
|
apt-get update
|
|
|
|
apt-get update
|
|
|
|
apt-get install -y cmake pkg-config gcc-aarch64-linux-gnu libc6-dev-arm64-cross
|
|
|
|
apt-get install -y cmake pkg-config gcc-aarch64-linux-gnu libc6-dev-arm64-cross libssl-dev build-essential
|
|
|
|
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
|
|
|
|
|
|
|
|
export PATH="$HOME/.cargo/bin:$PATH"
|
|
|
|
rustup target add aarch64-unknown-linux-gnu
|
|
|
|
rustup target add aarch64-unknown-linux-gnu
|
|
|
|
|
|
|
|
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
|
|
|
- name: Cache cargo
|
|
|
|
|
|
|
|
uses: actions/cache@v4
|
|
|
|
|
|
|
|
with:
|
|
|
|
|
|
|
|
path: |
|
|
|
|
|
|
|
|
~/.cargo/registry
|
|
|
|
|
|
|
|
~/.cargo/git
|
|
|
|
|
|
|
|
target
|
|
|
|
|
|
|
|
key: cargo-arm64-${{ hashFiles('Cargo.lock') }}
|
|
|
|
|
|
|
|
restore-keys: cargo-arm64-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Build
|
|
|
|
- name: Build
|
|
|
|
env:
|
|
|
|
env:
|
|
|
|
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
|
|
|
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
|
|
|
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
|
|
|
|
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
|
|
|
|
run: |
|
|
|
|
run: |
|
|
|
|
|
|
|
|
export PATH="$HOME/.cargo/bin:$PATH"
|
|
|
|
cargo build --release --target aarch64-unknown-linux-gnu \
|
|
|
|
cargo build --release --target aarch64-unknown-linux-gnu \
|
|
|
|
--bin wzp-relay --bin wzp-client --bin wzp-bench --bin wzp-web
|
|
|
|
--bin wzp-relay --bin wzp-client --bin wzp-bench --bin wzp-web
|
|
|
|
|
|
|
|
|
|
|
|
@@ -113,44 +129,54 @@ jobs:
|
|
|
|
cp -r crates/wzp-web/static dist/wzp-linux-arm64/
|
|
|
|
cp -r crates/wzp-web/static dist/wzp-linux-arm64/
|
|
|
|
cd dist && tar czf wzp-linux-arm64.tar.gz wzp-linux-arm64/
|
|
|
|
cd dist && tar czf wzp-linux-arm64.tar.gz wzp-linux-arm64/
|
|
|
|
|
|
|
|
|
|
|
|
- name: Upload artifact
|
|
|
|
- name: Upload to release
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
run: |
|
|
|
|
with:
|
|
|
|
API="${{ github.server_url }}/api/v1/repos/${{ github.repository }}"
|
|
|
|
name: wzp-linux-arm64
|
|
|
|
TOKEN="${{ github.token }}"
|
|
|
|
path: dist/wzp-linux-arm64.tar.gz
|
|
|
|
TAG="build-arm64-$(date +%Y%m%d-%H%M%S)"
|
|
|
|
|
|
|
|
SHA=$(git rev-parse --short HEAD)
|
|
|
|
|
|
|
|
RELEASE=$(curl -sS -X POST "$API/releases" \
|
|
|
|
|
|
|
|
-H "Authorization: token $TOKEN" \
|
|
|
|
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
|
|
|
|
-d "{\"tag_name\":\"$TAG\",\"name\":\"Build $SHA (arm64)\",\"body\":\"Automated build from ${{ github.ref_name }} at $SHA\",\"draft\":false,\"prerelease\":true}")
|
|
|
|
|
|
|
|
RELEASE_ID=$(echo "$RELEASE" | jq -r '.id')
|
|
|
|
|
|
|
|
curl -sS -X POST "$API/releases/$RELEASE_ID/assets?name=wzp-linux-arm64.tar.gz" \
|
|
|
|
|
|
|
|
-H "Authorization: token $TOKEN" \
|
|
|
|
|
|
|
|
-H "Content-Type: application/octet-stream" \
|
|
|
|
|
|
|
|
--data-binary @dist/wzp-linux-arm64.tar.gz
|
|
|
|
|
|
|
|
echo "Release created: ${{ github.server_url }}/${{ github.repository }}/releases/tag/$TAG"
|
|
|
|
|
|
|
|
|
|
|
|
build-armv7:
|
|
|
|
build-armv7:
|
|
|
|
if: >-
|
|
|
|
if: >-
|
|
|
|
github.event_name == 'push' ||
|
|
|
|
github.event_name == 'push' ||
|
|
|
|
contains(github.event.inputs.targets, 'armv7')
|
|
|
|
contains(github.event.inputs.targets, 'armv7')
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
|
|
|
|
|
|
|
image: rust:1-bookworm
|
|
|
|
|
|
|
|
steps:
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Checkout
|
|
|
|
|
|
|
|
run: |
|
|
|
|
|
|
|
|
apt-get update && apt-get install -y git curl jq
|
|
|
|
|
|
|
|
AUTH_URL="${{ github.server_url }}/${{ github.repository }}.git"
|
|
|
|
|
|
|
|
AUTH_URL=$(echo "$AUTH_URL" | sed "s|://|://${{ github.token }}@|")
|
|
|
|
|
|
|
|
git clone --depth 1 --branch ${{ github.ref_name }} "$AUTH_URL" .
|
|
|
|
|
|
|
|
git config --global url."https://git.tbs.amn.gg/manawenuz/featherChat.git".insteadOf "ssh://git@git.manko.yoga:222/manawenuz/featherChat.git"
|
|
|
|
|
|
|
|
git submodule update --init --depth 1
|
|
|
|
|
|
|
|
|
|
|
|
- name: Install cross-compilation tools
|
|
|
|
- name: Install Rust and cross-compilation tools
|
|
|
|
run: |
|
|
|
|
run: |
|
|
|
|
dpkg --add-architecture armhf
|
|
|
|
dpkg --add-architecture armhf
|
|
|
|
apt-get update
|
|
|
|
apt-get update
|
|
|
|
apt-get install -y cmake pkg-config gcc-arm-linux-gnueabihf libc6-dev-armhf-cross
|
|
|
|
apt-get install -y cmake pkg-config gcc-arm-linux-gnueabihf libc6-dev-armhf-cross libssl-dev build-essential
|
|
|
|
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
|
|
|
|
|
|
|
|
export PATH="$HOME/.cargo/bin:$PATH"
|
|
|
|
rustup target add armv7-unknown-linux-gnueabihf
|
|
|
|
rustup target add armv7-unknown-linux-gnueabihf
|
|
|
|
|
|
|
|
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
|
|
|
- name: Cache cargo
|
|
|
|
|
|
|
|
uses: actions/cache@v4
|
|
|
|
|
|
|
|
with:
|
|
|
|
|
|
|
|
path: |
|
|
|
|
|
|
|
|
~/.cargo/registry
|
|
|
|
|
|
|
|
~/.cargo/git
|
|
|
|
|
|
|
|
target
|
|
|
|
|
|
|
|
key: cargo-armv7-${{ hashFiles('Cargo.lock') }}
|
|
|
|
|
|
|
|
restore-keys: cargo-armv7-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- name: Build
|
|
|
|
- name: Build
|
|
|
|
env:
|
|
|
|
env:
|
|
|
|
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
|
|
|
|
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
|
|
|
|
CC_armv7_unknown_linux_gnueabihf: arm-linux-gnueabihf-gcc
|
|
|
|
CC_armv7_unknown_linux_gnueabihf: arm-linux-gnueabihf-gcc
|
|
|
|
run: |
|
|
|
|
run: |
|
|
|
|
|
|
|
|
export PATH="$HOME/.cargo/bin:$PATH"
|
|
|
|
cargo build --release --target armv7-unknown-linux-gnueabihf \
|
|
|
|
cargo build --release --target armv7-unknown-linux-gnueabihf \
|
|
|
|
--bin wzp-relay --bin wzp-client --bin wzp-bench --bin wzp-web
|
|
|
|
--bin wzp-relay --bin wzp-client --bin wzp-bench --bin wzp-web
|
|
|
|
|
|
|
|
|
|
|
|
@@ -164,25 +190,19 @@ jobs:
|
|
|
|
cp -r crates/wzp-web/static dist/wzp-linux-armv7/
|
|
|
|
cp -r crates/wzp-web/static dist/wzp-linux-armv7/
|
|
|
|
cd dist && tar czf wzp-linux-armv7.tar.gz wzp-linux-armv7/
|
|
|
|
cd dist && tar czf wzp-linux-armv7.tar.gz wzp-linux-armv7/
|
|
|
|
|
|
|
|
|
|
|
|
- name: Upload artifact
|
|
|
|
- name: Upload to release
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
run: |
|
|
|
|
with:
|
|
|
|
API="${{ github.server_url }}/api/v1/repos/${{ github.repository }}"
|
|
|
|
name: wzp-linux-armv7
|
|
|
|
TOKEN="${{ github.token }}"
|
|
|
|
path: dist/wzp-linux-armv7.tar.gz
|
|
|
|
TAG="build-armv7-$(date +%Y%m%d-%H%M%S)"
|
|
|
|
|
|
|
|
SHA=$(git rev-parse --short HEAD)
|
|
|
|
# Release job — creates a release with all artifacts when a tag is pushed
|
|
|
|
RELEASE=$(curl -sS -X POST "$API/releases" \
|
|
|
|
release:
|
|
|
|
-H "Authorization: token $TOKEN" \
|
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
needs: [build-amd64]
|
|
|
|
-d "{\"tag_name\":\"$TAG\",\"name\":\"Build $SHA (armv7)\",\"body\":\"Automated build from ${{ github.ref_name }} at $SHA\",\"draft\":false,\"prerelease\":true}")
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
RELEASE_ID=$(echo "$RELEASE" | jq -r '.id')
|
|
|
|
steps:
|
|
|
|
curl -sS -X POST "$API/releases/$RELEASE_ID/assets?name=wzp-linux-armv7.tar.gz" \
|
|
|
|
- name: Download all artifacts
|
|
|
|
-H "Authorization: token $TOKEN" \
|
|
|
|
uses: actions/download-artifact@v4
|
|
|
|
-H "Content-Type: application/octet-stream" \
|
|
|
|
with:
|
|
|
|
--data-binary @dist/wzp-linux-armv7.tar.gz
|
|
|
|
path: artifacts
|
|
|
|
echo "Release created: ${{ github.server_url }}/${{ github.repository }}/releases/tag/$TAG"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Create release
|
|
|
|
|
|
|
|
uses: softprops/action-gh-release@v2
|
|
|
|
|
|
|
|
with:
|
|
|
|
|
|
|
|
files: artifacts/**/*.tar.gz
|
|
|
|
|
|
|
|
generate_release_notes: true
|
|
|
|
|
|
|
|
|