Try to build in an Alpine chroot. #16
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: Static Builds | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| - dev | |
| jobs: | |
| # build-x86_64-linux-static: | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - uses: actions/checkout@v3 | |
| # with: | |
| # submodules: 'true' | |
| # - name: Install Dependencies | |
| # run: | | |
| # sudo apt-get update | |
| # sudo apt-get install -y --fix-missing cmake pkg-config musl-tools musl-dev | |
| # echo "CC_x86_64_unknown_linux_musl=musl-gcc" >> $GITHUB_ENV | |
| # echo "AR_x86_64_unknown_linux_musl=ar" >> $GITHUB_ENV | |
| # echo "CXX_x86_64_unknown_linux_musl=musl-gcc" >> $GITHUB_ENV | |
| # echo "CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc" >> $GITHUB_ENV | |
| # - uses: actions-rs/toolchain@v1 | |
| # with: | |
| # toolchain: 1.93.1 | |
| # target: x86_64-unknown-linux-musl | |
| # default: true | |
| # - name: Rust Build | |
| # run: | | |
| # cargo build --target x86_64-unknown-linux-musl --release --features=static --example static_geos | |
| # | |
| # build-aarch64-apple-darwin: | |
| # runs-on: macos-15 | |
| # steps: | |
| # - uses: actions/checkout@v3 | |
| # with: | |
| # submodules: 'true' | |
| # # - name: Install Dependencies | |
| # # run: | | |
| # # brew update && brew install geos | |
| # # CMake v4 is too new: https://github.com/georust/geos/issues/194 | |
| # - name: Downgrade CMake | |
| # run: | | |
| # pipx install --force cmake==3.31 | |
| # - uses: actions-rs/toolchain@v1 | |
| # with: | |
| # toolchain: 1.93.1 | |
| # target: aarch64-apple-darwin | |
| # default: true | |
| # - name: Rust Build | |
| # run: | | |
| # cargo build --target aarch64-apple-darwin --release --features=static --example static_geos | |
| # | |
| # build-x86_64-windows: | |
| # runs-on: windows-latest | |
| # steps: | |
| # - uses: actions/checkout@v3 | |
| # with: | |
| # submodules: 'true' | |
| # # - uses: MinoruSekine/setup-scoop@v4.0.1 | |
| # # with: | |
| # # buckets: extras | |
| # # # We use this as a proxy: we need sqlite libs and not binary :/ | |
| # # apps: sqlite | |
| # - uses: actions-rs/toolchain@v1 | |
| # with: | |
| # toolchain: 1.93.1 | |
| # target: x86_64-pc-windows-msvc | |
| # default: true | |
| # - name: Rust Build | |
| # shell: bash | |
| # run: | | |
| # cargo build --target x86_64-pc-windows-msvc --release --features=static --example static_geos | |
| build-x86_64-linux-static: | |
| runs-on: ubuntu-latest | |
| env: | |
| RUST_TARGET: x86_64-unknown-linux-musl | |
| OS_ARCH: x86_64 | |
| VOLUME: /mnt/alpine-volume | |
| # CROSS_SYSROOT: /mnt/alpine-${{ matrix.target.os-arch }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: 'true' | |
| - name: Set up Alpine Linux | |
| id: alpine-chroot | |
| uses: jirutka/setup-alpine@v1 | |
| with: | |
| # arch: ${{ env.OS_ARCH }} | |
| branch: v3.22 | |
| packages: > | |
| build-base | |
| lld | |
| cmake=3.31.7-r1 | |
| pkgconf | |
| rustup | |
| # volumes: ${{ steps.alpine-chroot.outputs.root-path }}:${{ env.VOLUME }} | |
| shell-name: alpine.sh | |
| # - name: Install CMake | |
| # run: | | |
| # pipx install --force cmake==3.31 | |
| # shell: alpine.sh {0} | |
| - name: Install Rust stable toolchain via rustup | |
| run: | | |
| rustup-init --target ${{ env.RUST_TARGET }} --default-toolchain stable --profile minimal -y | |
| shell: alpine.sh {0} | |
| - name: Build statically linked binary | |
| env: | |
| PKG_CONFIG_ALL_STATIC: '1' | |
| # PKG_CONFIG_LIBDIR: ${{ env.VOLUME }}/usr/lib/pkgconfig | |
| # RUSTFLAGS: -C linker=/usr/bin/ld.lld | |
| # SYSROOT: /dummy # workaround for https://github.com/rust-lang/pkg-config-rs/issues/102 | |
| run: | | |
| # Workaround for https://github.com/rust-lang/pkg-config-rs/issues/102. | |
| # echo -e '#!/bin/sh\nPKG_CONFIG_SYSROOT_DIR=${{ env.VOLUME }} exec pkgconf "$@"' \ | |
| # | install -m755 /dev/stdin pkg-config | |
| # export PKG_CONFIG="$(pwd)/pkg-config" | |
| cargo build --target ${{ env.RUST_TARGET }} --release --features=static --example static_geos | |
| shell: alpine.sh {0} | |
| - name: Check binary exists | |
| run: | | |
| test -e examples/static_geos | |
| working-directory: ${{ steps.alpine-chroot.outputs.root-path }}/target/${{ env.RUST_TARGET }}/release/ | |
| # build-on-alpine-with-musl: | |
| # strategy: | |
| # matrix: | |
| # target: | |
| # - name: ubuntu | |
| # runs-on: ubtuntu-latest | |
| # rust-target: x86_64-unknown-linux-musl | |
| # os-arch: x86_64 | |
| # | |
| # runs-on: ${{matrix.target.runs-on}} | |
| # | |
| # env: | |
| # CROSS_SYSROOT: /mnt/alpine-${{ matrix.target.os-arch }} | |
| # | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # with: | |
| # submodules: 'true' | |
| # | |
| # # - name: Set up Alpine Linux for ${{ matrix.os-arch }} (target arch) | |
| # # id: alpine-target | |
| # # uses: jirutka/setup-alpine@v1 | |
| # # with: | |
| # # arch: ${{ matrix.os-arch }} | |
| # # branch: edge | |
| # # packages: > | |
| # # dbus-dev | |
| # # dbus-static | |
| # # shell-name: alpine-target.sh | |
| # | |
| # - name: Set up Alpine Linux | |
| # uses: jirutka/setup-alpine@v1 | |
| # with: | |
| # arch: ${{ matrix.target.os-arch }} | |
| # packages: > | |
| # build-base | |
| # pkgconf | |
| # lld | |
| # rustup | |
| # volumes: ${{ steps.alpine-target.outputs.root-path }}:${{ env.CROSS_SYSROOT }} | |
| # shell-name: alpine.sh | |
| # | |
| # - name: Install Rust stable toolchain via rustup | |
| # run: | | |
| # rustup-init --target ${{ matrix.target.rust-target }} --default-toolchain stable --profile minimal -y | |
| # shell: alpine.sh {0} | |
| # | |
| # - name: Build statically linked binary | |
| # env: | |
| # PKG_CONFIG_ALL_STATIC: '1' | |
| # PKG_CONFIG_LIBDIR: ${{ env.CROSS_SYSROOT }}/usr/lib/pkgconfig | |
| # RUSTFLAGS: -C linker=/usr/bin/ld.lld | |
| # SYSROOT: /dummy # workaround for https://github.com/rust-lang/pkg-config-rs/issues/102 | |
| # run: | | |
| # # Workaround for https://github.com/rust-lang/pkg-config-rs/issues/102. | |
| # echo -e '#!/bin/sh\nPKG_CONFIG_SYSROOT_DIR=${{ env.CROSS_SYSROOT }} exec pkgconf "$@"' \ | |
| # | install -m755 /dev/stdin pkg-config | |
| # export PKG_CONFIG="$(pwd)/pkg-config" | |
| # | |
| # cargo build --target ${{ matrix.target.rust-target }} --release --features=static --example static_geos | |
| # shell: alpine.sh {0} | |
| # | |
| # - name: Check binary exists | |
| # run: | | |
| # test -e examples/static_geos | |
| # working-directory: target/${{ matrix.target.rust-target }}/release/ |