ci: install system dependencies in release action #13
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: Release | ||
| on: | ||
| release: | ||
| types: [created] | ||
| push: | ||
| branches: | ||
| - ci-buildbinary | ||
| jobs: | ||
| build-release-assets: | ||
| name: build-release-assets | ||
| # This permissions block is the required change | ||
| permissions: | ||
| contents: write | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| - target: x86_64-unknown-linux-gnu | ||
| os: ubuntu-latest | ||
| - target: x86_64-unknown-linux-musl | ||
| os: ubuntu-latest | ||
| - target: x86_64-apple-darwin | ||
| os: macos-latest | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v3 | ||
| - name: Install Rust toolchain | ||
| uses: actions-rs/toolchain@v1 | ||
| with: | ||
| toolchain: stable | ||
| target: ${{ matrix.target }} | ||
| override: true | ||
| - name: Install system dependencies (Ubuntu) | ||
| if: startsWith(matrix.os, 'ubuntu') | ||
| run: sudo apt-get update && sudo apt-get install -y liburing-dev pkg-config libclang-dev | ||
| - name: Install MUSL toolchain (Ubuntu) | ||
| if: matrix.target == 'x86_64-unknown-linux-musl' && startsWith(matrix.os, 'ubuntu') | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y musl-tools musl-dev | ||
| - name: Setup C++ for MUSL | ||
| if: matrix.target == 'x86_64-unknown-linux-musl' | ||
| run: | | ||
| # Install build-essential for libstdc++ | ||
| sudo apt-get install -y build-essential | ||
| # Create musl-g++ wrapper with proper C++ support | ||
| GCC_VERSION=$(gcc -dumpversion | cut -d. -f1) | ||
| cat << WRAPPER | sudo tee /usr/local/bin/musl-g++ | ||
| #!/bin/bash | ||
| exec musl-gcc -x c++ \\ | ||
| -idirafter /usr/include/c++/$GCC_VERSION \\ | ||
| -idirafter /usr/include/x86_64-linux-gnu/c++/$GCC_VERSION \\ | ||
| -idirafter /usr/include/c++/$GCC_VERSION/backward \\ | ||
| "\$@" | ||
| WRAPPER | ||
| # Make it executable | ||
| sudo chmod +x /usr/local/bin/musl-g++ | ||
| echo "musl-g++ created successfully" | ||
| cat /usr/local/bin/musl-g++ | ||
| - name: Configure MUSL environment | ||
| if: matrix.target == 'x86_64-unknown-linux-musl' | ||
| run: | | ||
| echo "CC_x86_64_unknown_linux_musl=musl-gcc" >> $GITHUB_ENV | ||
| echo "CXX_x86_64_unknown_linux_musl=musl-g++" >> $GITHUB_ENV | ||
| echo "AR_x86_64_unknown_linux_musl=ar" >> $GITHUB_ENV | ||
| echo "CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc" >> $GITHUB_ENV | ||
| - name: Build binary | ||
| run: cargo build --profile maxperf --features jemalloc,asm-keccak --target ${{ matrix.target }} | ||
| env: | ||
| RUSTFLAGS: ${{ matrix.target == 'x86_64-unknown-linux-gnu' && '-C strip=symbols -C target-cpu=native' || matrix.target == 'x86_64-unknown-linux-musl' && '-C strip=symbols -C target-feature=+crt-static -C default-linker-libraries -Clink-arg=-static-libgcc' || '-C strip=symbols' }} | ||
| - name: Prepare artifact | ||
| run: | | ||
| set -e | ||
| bin_name="reth-bsc" | ||
| tag_name="${{ github.ref_name }}" | ||
| asset_name="${bin_name}-${tag_name}-${{ matrix.target }}" | ||
| mkdir -p "${asset_name}" | ||
| cp "target/${{ matrix.target }}/maxperf/${bin_name}" "${asset_name}/" | ||
| tar -czvf "${asset_name}.tar.gz" "${asset_name}" | ||
| echo "ASSET_NAME=${asset_name}.tar.gz" >> $GITHUB_ENV | ||
| - name: Upload release asset | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | ||
| uses: softprops/action-gh-release@v1 | ||
| with: | ||
| files: ${{ env.ASSET_NAME }} | ||