use statically build libraries instead of syso files #6
Workflow file for this run
This file contains hidden or 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
name: Build Static Libraries | |
on: | |
workflow_dispatch: # Manual trigger | |
push: | |
paths: | |
- 'src/**' | |
- '.github/workflows/build-static-libs.yml' | |
pull_request: | |
paths: | |
- 'src/**' | |
jobs: | |
build-linux-amd64: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential | |
- name: Build Linux AMD64 library | |
run: | | |
cd src | |
make clean | |
# Build with maximum compatibility flags | |
CFLAGS="-O3 -Wall -Werror -static -fno-stack-protector -fno-plt" make | |
- name: Upload Linux AMD64 library | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libhashtree-linux-amd64 | |
path: build/lib/libhashtree.a | |
retention-days: 7 | |
build-linux-arm64: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install ARM64 cross-compiler | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gcc-aarch64-linux-gnu | |
- name: Build Linux ARM64 library | |
run: | | |
cd src | |
make clean | |
# Build with maximum compatibility flags | |
CC=aarch64-linux-gnu-gcc ARM=1 CFLAGS="-O3 -Wall -Werror -static -fno-stack-protector -fno-plt" make | |
- name: Upload Linux ARM64 library | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libhashtree-linux-arm64 | |
path: build/lib/libhashtree.a | |
retention-days: 7 | |
build-darwin-arm64: | |
runs-on: macos-14 # Apple Silicon macOS | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build Darwin ARM64 library | |
run: | | |
cd src | |
make clean | |
# Build with compatibility flags for older macOS (ARM64 minimum) | |
CFLAGS="-O3 -Wall -Werror -mmacosx-version-min=11.0" make | |
- name: Upload Darwin ARM64 library | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libhashtree-darwin-arm64 | |
path: build/lib/libhashtree.a | |
retention-days: 7 | |
build-windows-amd64: | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup MSYS2 | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: MINGW64 | |
update: true | |
install: >- | |
mingw-w64-x86_64-gcc | |
mingw-w64-x86_64-make | |
make | |
- name: Build Windows AMD64 library | |
run: | | |
cd src | |
make clean | |
# Build with compatibility flags | |
CFLAGS="-O3 -Wall -Werror -static" make | |
- name: Upload Windows AMD64 library | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libhashtree-windows-amd64 | |
path: build/lib/libhashtree.a | |
retention-days: 7 | |
collect-libraries: | |
runs-on: ubuntu-latest | |
needs: [build-linux-amd64, build-linux-arm64, build-darwin-arm64, build-windows-amd64] | |
steps: | |
- name: Create lib directories | |
run: | | |
mkdir -p lib/{linux_amd64,linux_arm64,darwin_arm64,windows_amd64} | |
- name: Download all libraries | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: libhashtree-* | |
merge-multiple: false | |
- name: Move libraries to correct locations | |
run: | | |
cp libhashtree-linux-amd64/libhashtree.a lib/linux_amd64/ | |
cp libhashtree-linux-arm64/libhashtree.a lib/linux_arm64/ | |
cp libhashtree-darwin-arm64/libhashtree.a lib/darwin_arm64/ | |
cp libhashtree-windows-amd64/libhashtree.a lib/windows_amd64/ | |
- name: Verify libraries | |
run: | | |
echo "Linux AMD64:" && file lib/linux_amd64/libhashtree.a | |
echo "Linux ARM64:" && file lib/linux_arm64/libhashtree.a | |
echo "Darwin ARM64:" && file lib/darwin_arm64/libhashtree.a | |
echo "Windows AMD64:" && file lib/windows_amd64/libhashtree.a | |
- name: Create library bundle | |
run: | | |
echo "# Static Library Bundle" > lib/README.md | |
echo "" >> lib/README.md | |
echo "Built from commit: ${{ github.sha }}" >> lib/README.md | |
echo "Build date: $(date -u +"%Y-%m-%d %H:%M:%S UTC")" >> lib/README.md | |
echo "Build trigger: ${{ github.event_name }}" >> lib/README.md | |
echo "" >> lib/README.md | |
echo "## Contents:" >> lib/README.md | |
echo "- linux_amd64/libhashtree.a - Linux x86_64 with AVX2/AVX512/SHANI optimizations" >> lib/README.md | |
echo "- linux_arm64/libhashtree.a - Linux ARM64 with NEON/SHA2 optimizations" >> lib/README.md | |
echo "- darwin_arm64/libhashtree.a - macOS Apple Silicon with SHA2 optimizations" >> lib/README.md | |
echo "- windows_amd64/libhashtree.a - Windows x86_64 with AVX2/AVX512/SHANI optimizations" >> lib/README.md | |
echo "" >> lib/README.md | |
echo "Note: macOS Intel (darwin_amd64) is not included - uses pure Go fallback implementation" >> lib/README.md | |
- name: Upload static library bundle | |
uses: actions/upload-artifact@v4 | |
with: | |
name: hashtree-static-libs-${{ github.sha }} | |
path: lib/ | |
retention-days: 30 |