Update to v0.12.18 #316
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 | |
| on: | |
| push: | |
| tags: | |
| - "v[0-9]+.[0-9]+.[0-9]+" | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| APT_PACKAGES: "build-essential cmake perl pkg-config libclang-dev" | |
| # pkgconfiglite package is broken upstream (404), skip to keep Windows builds green | |
| CHOCOLATEY_PACKAGES: "cmake strawberryperl llvm nasm" | |
| HOMEBREW_PACKAGES: "llvm" | |
| BIN_NAME: "clewdr" | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-frontend: | |
| name: Build Frontend | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: latest | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "lts/*" | |
| check-latest: true | |
| cache: pnpm | |
| cache-dependency-path: frontend/pnpm-lock.yaml | |
| - name: Build frontend | |
| run: | | |
| cd frontend | |
| pnpm install | |
| pnpm run build | |
| - name: Upload static directory | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: static-files | |
| path: static/ | |
| retention-days: 1 | |
| build: | |
| name: Build binary | |
| needs: build-frontend | |
| strategy: | |
| matrix: | |
| os: [linux, musllinux, android, windows, macos] | |
| target_arch: [x86_64, aarch64] | |
| include: | |
| # rust target vendor + system + environment | |
| - os: android | |
| target_vendor_sys_env: linux-android | |
| - os: macos | |
| target_vendor_sys_env: apple-darwin | |
| - os: linux | |
| target_vendor_sys_env: unknown-linux-gnu | |
| - os: musllinux | |
| target_vendor_sys_env: unknown-linux-musl | |
| - os: windows | |
| target_vendor_sys_env: pc-windows-msvc | |
| # runner | |
| - os: linux | |
| target_arch: x86_64 | |
| runner: ubuntu-latest | |
| - os: linux | |
| target_arch: aarch64 | |
| runner: ubuntu-24.04-arm | |
| - os: android | |
| runner: ubuntu-latest | |
| - os: windows | |
| runner: windows-latest | |
| - os: macos | |
| runner: macos-latest | |
| # musl packages | |
| - os: musllinux | |
| cross: true | |
| runner: ubuntu-latest | |
| exclude: | |
| - os: android | |
| target_arch: x86_64 | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Add Rust target | |
| shell: bash | |
| id: target | |
| run: | | |
| echo "triple=${{ matrix.target_arch }}-${{matrix.target_vendor_sys_env}}" >> $GITHUB_OUTPUT | |
| rustup target add ${{ matrix.target_arch }}-${{matrix.target_vendor_sys_env}} && rustup update | |
| - uses: nttld/setup-ndk@v1.5.0 | |
| if: ${{ matrix.os == 'android' }} | |
| id: setup-ndk | |
| with: | |
| ndk-version: r27c | |
| add-to-path: true | |
| - name: Install APT packages | |
| if: contains(matrix.runner, 'ubuntu') | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ${{ env.APT_PACKAGES }} | |
| - name: Install Chocolatey Packages | |
| if: matrix.os == 'windows' | |
| run: | | |
| choco install -y --ignore-unfound ${{ env.CHOCOLATEY_PACKAGES }} | |
| - name: Install Homebrew Packages | |
| if: matrix.os == 'macos' | |
| run: | | |
| brew update | |
| brew install ${{ env.HOMEBREW_PACKAGES }} | |
| - name: Install cross | |
| if: ${{ matrix.cross }} | |
| run: | | |
| cargo install cross --locked | |
| echo "CROSS_NO_DEFAULT_TOOLCHAIN=1" >> $GITHUB_ENV | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: ${{ steps.target.outputs.triple }} | |
| - name: Prepare build env | |
| shell: bash | |
| run: | | |
| echo "FEATURE_ARGS=--no-default-features --features embed-resource,portable" >> $GITHUB_ENV | |
| - name: Download static files | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: static-files | |
| path: static | |
| - name: Build ${{ steps.target.outputs.triple }} | |
| if: ${{ matrix.os != 'android' }} | |
| shell: bash | |
| run: | | |
| if [ ${{ matrix.os }} == "musllinux" ] && [ "${{ matrix.cross }}" != "true" ]; then | |
| export CXX=${{ matrix.target_arch }}-linux-gnu-g++ | |
| if [ ${{ matrix.target_arch }} == "aarch64" ]; then | |
| export RUSTFLAGS='-C link-arg=-Wl,--allow-shlib-undefined' | |
| export CFLAGS="-D_FILE_OFFSET_BITS=64" | |
| fi | |
| fi | |
| if [ ${{ matrix.os }} == "windows" ]; then | |
| export RUSTFLAGS="-C target-feature=+crt-static" | |
| fi | |
| if [ "${{ matrix.cross }}" = "true" ]; then | |
| cross build --release --target ${{ steps.target.outputs.triple }} $FEATURE_ARGS | |
| else | |
| cargo build --release --target ${{ steps.target.outputs.triple }} $FEATURE_ARGS | |
| fi | |
| - name: Build with Android NDK | |
| if: ${{ matrix.os == 'android' }} | |
| run: | | |
| cargo install cargo-ndk | |
| cargo ndk --target ${{ steps.target.outputs.triple }} build --release $FEATURE_ARGS | |
| env: | |
| ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
| ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }} | |
| - name: Move artifact to work dir and zip | |
| shell: bash | |
| run: | | |
| mv target/${{ steps.target.outputs.triple }}/release/${{ env.BIN_NAME }} . | |
| mkdir -p release-package | |
| mv ${{ env.BIN_NAME }} release-package/ | |
| if [ ${{ matrix.os }} == "android" ]; then | |
| mv ${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/${{ matrix.target_arch }}-linux-android/libc++_shared.so release-package/ | |
| fi | |
| cd release-package | |
| if [ ${{ matrix.os }} == "windows" ]; then | |
| 7z a -tzip ../${{ env.BIN_NAME }}-${{ matrix.os }}-${{matrix.target_arch}}.zip * | |
| else | |
| zip -r ../${{ env.BIN_NAME }}-${{ matrix.os }}-${{matrix.target_arch}}.zip . | |
| fi | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.BIN_NAME }}-${{ matrix.os }}-${{matrix.target_arch}} | |
| path: ${{ env.BIN_NAME }}-${{ matrix.os }}-${{matrix.target_arch}}.zip | |
| retention-days: 1 | |
| release: | |
| name: Create Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: master # Ensure we get the latest master with RELEASE_NOTES.md | |
| fetch-depth: 0 # Full history for consistency | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: List downloaded artifacts | |
| run: ls -R artifacts | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: artifacts/**/${{ env.BIN_NAME }}*.zip | |
| name: ${{ github.ref_name }} | |
| body_path: RELEASE_NOTES.md # Use release notes file | |
| draft: false | |
| prerelease: false | |
| fail_on_unmatched_files: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |