mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-08-21 06:36:54 +00:00
Every workflow that builds the Rust volume server first installed protoc from a package manager - twelve steps across apt, brew and choco. That is 37s per job on a good day, and this week archive.ubuntu.com stalled long enough for four jobs to burn their whole timeout without reaching a build. protoc-bin-vendored ships the compiler as a build-dependency, so it now arrives through the cargo registry the workflows already cache and there is nothing left to install. cargo build works on a machine with no protoc at all, which is worth as much locally as it is in CI. It also pins the version. The apt protoc on ubuntu-22.04 is 3.12, old enough to reject proto3 optional, which is why build.rs passes --experimental_allow_proto3_optional; the vendored one is 31.1. The flag stays, since it costs nothing and keeps a build against an older PROTOC working, and an explicit PROTOC still overrides the vendored binary for packagers who supply their own.
276 lines
9.6 KiB
YAML
276 lines
9.6 KiB
YAML
name: "rust: build versioned volume server binaries"
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '*'
|
|
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
|
|
build-rust-volume-linux:
|
|
permissions:
|
|
contents: write
|
|
runs-on: ubuntu-22.04
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- target: x86_64-unknown-linux-gnu
|
|
asset_suffix: linux_amd64
|
|
- target: aarch64-unknown-linux-gnu
|
|
asset_suffix: linux_arm64
|
|
cross: true
|
|
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.target }}
|
|
|
|
- name: Install cross-compilation tools
|
|
if: matrix.cross
|
|
run: |
|
|
sudo dpkg --add-architecture arm64
|
|
sudo sed -i 's/^deb /deb [arch=amd64] /' /etc/apt/sources.list
|
|
echo "deb [arch=arm64] http://ports.ubuntu.com/ jammy main restricted universe multiverse" | sudo tee /etc/apt/sources.list.d/arm64.list
|
|
echo "deb [arch=arm64] http://ports.ubuntu.com/ jammy-updates main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/arm64.list
|
|
sudo apt-get update
|
|
sudo apt-get install -y gcc-aarch64-linux-gnu libssl-dev:arm64
|
|
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"
|
|
echo "OPENSSL_DIR=/usr" >> "$GITHUB_ENV"
|
|
echo "OPENSSL_INCLUDE_DIR=/usr/include" >> "$GITHUB_ENV"
|
|
echo "OPENSSL_LIB_DIR=/usr/lib/aarch64-linux-gnu" >> "$GITHUB_ENV"
|
|
|
|
- name: Cache cargo registry and target
|
|
uses: actions/cache@v6
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
seaweed-volume/target
|
|
key: rust-release-${{ matrix.target }}-${{ hashFiles('seaweed-volume/Cargo.lock') }}
|
|
restore-keys: |
|
|
rust-release-${{ matrix.target }}-
|
|
|
|
- name: Build Rust volume server (large disk)
|
|
env:
|
|
SEAWEEDFS_COMMIT: ${{ github.sha }}
|
|
run: |
|
|
cd seaweed-volume
|
|
cargo build --release --target ${{ matrix.target }} --target-dir target/large-disk
|
|
|
|
- name: Build Rust volume server (normal)
|
|
env:
|
|
SEAWEEDFS_COMMIT: ${{ github.sha }}
|
|
run: |
|
|
cd seaweed-volume
|
|
cargo build --release --target ${{ matrix.target }} --no-default-features --target-dir target/normal
|
|
|
|
- name: Package binaries
|
|
run: |
|
|
# Large disk (default, 5bytes feature)
|
|
cp seaweed-volume/target/large-disk/${{ matrix.target }}/release/weed-volume weed-volume-large-disk
|
|
tar czf weed-volume_large_disk_${{ matrix.asset_suffix }}.tar.gz weed-volume-large-disk
|
|
rm weed-volume-large-disk
|
|
|
|
# Normal volume size
|
|
cp seaweed-volume/target/normal/${{ matrix.target }}/release/weed-volume weed-volume-normal
|
|
tar czf weed-volume_${{ matrix.asset_suffix }}.tar.gz weed-volume-normal
|
|
rm weed-volume-normal
|
|
|
|
- name: Generate md5 checksums
|
|
run: |
|
|
for f in weed-volume_large_disk_${{ matrix.asset_suffix }}.tar.gz weed-volume_${{ matrix.asset_suffix }}.tar.gz; do
|
|
md5sum "$f" > "$f.md5"
|
|
done
|
|
|
|
- name: Upload release assets
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
uses: softprops/action-gh-release@v3
|
|
with:
|
|
files: |
|
|
weed-volume_large_disk_${{ matrix.asset_suffix }}.tar.gz
|
|
weed-volume_large_disk_${{ matrix.asset_suffix }}.tar.gz.md5
|
|
weed-volume_${{ matrix.asset_suffix }}.tar.gz
|
|
weed-volume_${{ matrix.asset_suffix }}.tar.gz.md5
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Upload artifacts
|
|
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: rust-volume-${{ matrix.asset_suffix }}
|
|
path: |
|
|
weed-volume_large_disk_${{ matrix.asset_suffix }}.tar.gz
|
|
weed-volume_large_disk_${{ matrix.asset_suffix }}.tar.gz.md5
|
|
weed-volume_${{ matrix.asset_suffix }}.tar.gz
|
|
weed-volume_${{ matrix.asset_suffix }}.tar.gz.md5
|
|
|
|
build-rust-volume-darwin:
|
|
permissions:
|
|
contents: write
|
|
runs-on: macos-latest
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- target: x86_64-apple-darwin
|
|
asset_suffix: darwin_amd64
|
|
- target: aarch64-apple-darwin
|
|
asset_suffix: darwin_arm64
|
|
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.target }}
|
|
|
|
- name: Cache cargo registry and target
|
|
uses: actions/cache@v6
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
seaweed-volume/target
|
|
key: rust-release-${{ matrix.target }}-${{ hashFiles('seaweed-volume/Cargo.lock') }}
|
|
restore-keys: |
|
|
rust-release-${{ matrix.target }}-
|
|
|
|
- name: Build Rust volume server (large disk)
|
|
env:
|
|
SEAWEEDFS_COMMIT: ${{ github.sha }}
|
|
run: |
|
|
cd seaweed-volume
|
|
cargo build --release --target ${{ matrix.target }} --target-dir target/large-disk
|
|
|
|
- name: Build Rust volume server (normal)
|
|
env:
|
|
SEAWEEDFS_COMMIT: ${{ github.sha }}
|
|
run: |
|
|
cd seaweed-volume
|
|
cargo build --release --target ${{ matrix.target }} --no-default-features --target-dir target/normal
|
|
|
|
- name: Package binaries
|
|
run: |
|
|
cp seaweed-volume/target/large-disk/${{ matrix.target }}/release/weed-volume weed-volume-large-disk
|
|
tar czf weed-volume_large_disk_${{ matrix.asset_suffix }}.tar.gz weed-volume-large-disk
|
|
rm weed-volume-large-disk
|
|
|
|
cp seaweed-volume/target/normal/${{ matrix.target }}/release/weed-volume weed-volume-normal
|
|
tar czf weed-volume_${{ matrix.asset_suffix }}.tar.gz weed-volume-normal
|
|
rm weed-volume-normal
|
|
|
|
- name: Generate md5 checksums
|
|
run: |
|
|
for f in weed-volume_large_disk_${{ matrix.asset_suffix }}.tar.gz weed-volume_${{ matrix.asset_suffix }}.tar.gz; do
|
|
md5 -r "$f" > "$f.md5"
|
|
done
|
|
|
|
- name: Upload release assets
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
uses: softprops/action-gh-release@v3
|
|
with:
|
|
files: |
|
|
weed-volume_large_disk_${{ matrix.asset_suffix }}.tar.gz
|
|
weed-volume_large_disk_${{ matrix.asset_suffix }}.tar.gz.md5
|
|
weed-volume_${{ matrix.asset_suffix }}.tar.gz
|
|
weed-volume_${{ matrix.asset_suffix }}.tar.gz.md5
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Upload artifacts
|
|
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: rust-volume-${{ matrix.asset_suffix }}
|
|
path: |
|
|
weed-volume_large_disk_${{ matrix.asset_suffix }}.tar.gz
|
|
weed-volume_large_disk_${{ matrix.asset_suffix }}.tar.gz.md5
|
|
weed-volume_${{ matrix.asset_suffix }}.tar.gz
|
|
weed-volume_${{ matrix.asset_suffix }}.tar.gz.md5
|
|
|
|
build-rust-volume-windows:
|
|
permissions:
|
|
contents: write
|
|
runs-on: windows-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
|
|
- name: Install Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Cache cargo registry and target
|
|
uses: actions/cache@v6
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
seaweed-volume/target
|
|
key: rust-release-windows-${{ hashFiles('seaweed-volume/Cargo.lock') }}
|
|
restore-keys: |
|
|
rust-release-windows-
|
|
|
|
- name: Build Rust volume server (large disk)
|
|
env:
|
|
SEAWEEDFS_COMMIT: ${{ github.sha }}
|
|
run: |
|
|
cd seaweed-volume
|
|
cargo build --release --target-dir target/large-disk
|
|
|
|
- name: Build Rust volume server (normal)
|
|
env:
|
|
SEAWEEDFS_COMMIT: ${{ github.sha }}
|
|
run: |
|
|
cd seaweed-volume
|
|
cargo build --release --no-default-features --target-dir target/normal
|
|
|
|
- name: Package binaries
|
|
shell: bash
|
|
run: |
|
|
cp seaweed-volume/target/large-disk/release/weed-volume.exe weed-volume-large-disk.exe
|
|
7z a weed-volume_large_disk_windows_amd64.zip weed-volume-large-disk.exe
|
|
rm weed-volume-large-disk.exe
|
|
|
|
cp seaweed-volume/target/normal/release/weed-volume.exe weed-volume-normal.exe
|
|
7z a weed-volume_windows_amd64.zip weed-volume-normal.exe
|
|
rm weed-volume-normal.exe
|
|
|
|
- name: Generate md5 checksums
|
|
shell: bash
|
|
run: |
|
|
for f in weed-volume_large_disk_windows_amd64.zip weed-volume_windows_amd64.zip; do
|
|
md5sum "$f" > "$f.md5"
|
|
done
|
|
|
|
- name: Upload release assets
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
uses: softprops/action-gh-release@v3
|
|
with:
|
|
files: |
|
|
weed-volume_large_disk_windows_amd64.zip
|
|
weed-volume_large_disk_windows_amd64.zip.md5
|
|
weed-volume_windows_amd64.zip
|
|
weed-volume_windows_amd64.zip.md5
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Upload artifacts
|
|
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: rust-volume-windows_amd64
|
|
path: |
|
|
weed-volume_large_disk_windows_amd64.zip
|
|
weed-volume_large_disk_windows_amd64.zip.md5
|
|
weed-volume_windows_amd64.zip
|
|
weed-volume_windows_amd64.zip.md5
|