mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-08-20 22:27:04 +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.
161 lines
5.0 KiB
YAML
161 lines
5.0 KiB
YAML
name: "rust: build dev volume server binaries"
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
paths:
|
|
- 'seaweed-volume/**'
|
|
- '.github/workflows/rust_binaries_dev.yml'
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
|
|
cleanup:
|
|
permissions:
|
|
contents: write
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Delete old Rust volume dev assets
|
|
uses: mknejp/delete-release-assets@v1
|
|
continue-on-error: true
|
|
with:
|
|
token: ${{ github.token }}
|
|
tag: dev
|
|
fail-if-no-assets: false
|
|
assets: |
|
|
weed-volume-*
|
|
|
|
build-rust-volume-dev-linux:
|
|
permissions:
|
|
contents: write
|
|
needs: cleanup
|
|
runs-on: ubuntu-22.04
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- target: x86_64-unknown-linux-gnu
|
|
asset_suffix: linux-amd64
|
|
|
|
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-dev-${{ matrix.target }}-${{ hashFiles('seaweed-volume/Cargo.lock') }}
|
|
restore-keys: |
|
|
rust-dev-${{ matrix.target }}-
|
|
|
|
- name: Set BUILD_TIME
|
|
run: echo BUILD_TIME=$(date -u +%Y%m%d-%H%M) >> "$GITHUB_ENV"
|
|
|
|
- name: Build Rust volume server (large disk)
|
|
env:
|
|
SEAWEEDFS_COMMIT: ${{ github.sha }}
|
|
run: cd seaweed-volume && cargo build --release
|
|
|
|
- name: Package large disk binary
|
|
run: |
|
|
cp seaweed-volume/target/release/weed-volume weed-volume-large-disk
|
|
tar czf "weed-volume-large-disk-${{ env.BUILD_TIME }}-${{ matrix.asset_suffix }}.tar.gz" weed-volume-large-disk
|
|
rm weed-volume-large-disk
|
|
|
|
- name: Build Rust volume server (normal)
|
|
env:
|
|
SEAWEEDFS_COMMIT: ${{ github.sha }}
|
|
run: cd seaweed-volume && cargo build --release --no-default-features
|
|
|
|
- name: Package normal binary
|
|
run: |
|
|
cp seaweed-volume/target/release/weed-volume weed-volume-normal
|
|
tar czf "weed-volume-${{ env.BUILD_TIME }}-${{ matrix.asset_suffix }}.tar.gz" weed-volume-normal
|
|
rm weed-volume-normal
|
|
|
|
- name: Upload dev release assets
|
|
uses: softprops/action-gh-release@v3
|
|
with:
|
|
tag_name: dev
|
|
prerelease: true
|
|
files: |
|
|
weed-volume-large-disk-${{ env.BUILD_TIME }}-${{ matrix.asset_suffix }}.tar.gz
|
|
weed-volume-${{ env.BUILD_TIME }}-${{ matrix.asset_suffix }}.tar.gz
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
build-rust-volume-dev-darwin:
|
|
permissions:
|
|
contents: write
|
|
needs: build-rust-volume-dev-linux
|
|
runs-on: macos-latest
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- target: aarch64-apple-darwin
|
|
asset_suffix: darwin-arm64
|
|
- target: x86_64-apple-darwin
|
|
asset_suffix: darwin-amd64
|
|
|
|
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-dev-${{ matrix.target }}-${{ hashFiles('seaweed-volume/Cargo.lock') }}
|
|
restore-keys: |
|
|
rust-dev-${{ matrix.target }}-
|
|
|
|
- name: Set BUILD_TIME
|
|
run: echo BUILD_TIME=$(date -u +%Y%m%d-%H%M) >> "$GITHUB_ENV"
|
|
|
|
- name: Build Rust volume server (large disk)
|
|
env:
|
|
SEAWEEDFS_COMMIT: ${{ github.sha }}
|
|
run: cd seaweed-volume && cargo build --release --target ${{ matrix.target }}
|
|
|
|
- name: Package large disk binary
|
|
run: |
|
|
cp seaweed-volume/target/${{ matrix.target }}/release/weed-volume weed-volume-large-disk
|
|
tar czf "weed-volume-large-disk-${{ env.BUILD_TIME }}-${{ matrix.asset_suffix }}.tar.gz" weed-volume-large-disk
|
|
rm weed-volume-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
|
|
|
|
- name: Package normal binary
|
|
run: |
|
|
cp seaweed-volume/target/${{ matrix.target }}/release/weed-volume weed-volume-normal
|
|
tar czf "weed-volume-${{ env.BUILD_TIME }}-${{ matrix.asset_suffix }}.tar.gz" weed-volume-normal
|
|
rm weed-volume-normal
|
|
|
|
- name: Upload dev release assets
|
|
uses: softprops/action-gh-release@v3
|
|
with:
|
|
tag_name: dev
|
|
prerelease: true
|
|
files: |
|
|
weed-volume-large-disk-${{ env.BUILD_TIME }}-${{ matrix.asset_suffix }}.tar.gz
|
|
weed-volume-${{ env.BUILD_TIME }}-${{ matrix.asset_suffix }}.tar.gz
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|