From 6f5c178661df6ab4acc9bd44a266f7ebd0fbb425 Mon Sep 17 00:00:00 2001 From: Michael Mullin Date: Tue, 19 Sep 2023 22:45:05 -0400 Subject: [PATCH] Update CI for arm static Signed-off-by: Michael Mullin --- .github/workflows/ci.yml | 406 ++++++++++++++++++++++----------------- build.rs | 15 ++ 2 files changed, 242 insertions(+), 179 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54563a4..5e317dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,196 +4,244 @@ on: push: jobs: - test-gnu: - # dynamically linked glibc - name: Test on Ubuntu ${{ matrix.os-arch }} (${{ matrix.features }}) + test-arm-static: + name: Test Static on Arm + runs-on: ubuntu-latest strategy: matrix: include: - - rust-target: x86_64-unknown-linux-gnu - os-target: x86_64-linux-gnu - os-arch: amd64 - features: '' - - - rust-target: x86_64-unknown-linux-gnu - os-target: x86_64-linux-gnu - os-arch: amd64 - features: static - - rust-target: aarch64-unknown-linux-gnu os-target: aarch64-linux-gnu os-arch: arm64 - features: '' - - - rust-target: powerpc64le-unknown-linux-gnu - os-target: powerpc64le-linux-gnu - os-arch: ppc64el - features: '' - runs-on: ubuntu-latest + features: static env: CARGO_BUILD_TARGET: ${{ matrix.rust-target }} CARGO_TERM_VERBOSE: 'true' RUSTFLAGS: -C linker=/usr/bin/${{ matrix.os-target }}-gcc steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Add apt sources for ${{ matrix.os-arch }} - if: matrix.os-arch != 'amd64' - run: | - dpkg --add-architecture ${{ matrix.os-arch }} - - release=$(. /etc/os-release && echo "$UBUNTU_CODENAME") - sed -i 's/^deb /deb [arch=amd64] /' /etc/apt/sources.list - printf 'deb [arch=${{ matrix.os-arch }}] http://ports.ubuntu.com/ %s main restricted\n' \ - $release $release-updates $release-security \ - >> /etc/apt/sources.list - shell: sudo sh -e {0} - - - name: Install system dependencies - run: | - sudo apt-get update - sudo apt-get install \ - build-essential \ - libelf-dev:${{ matrix.os-arch }} \ - zlib1g-dev:${{ matrix.os-arch }} - - - name: Install libbpf-dev - run: sudo apt-get install libbpf-dev:${{ matrix.os-arch }} - - - name: Install Static Compilation dependencies - run: | - sudo apt-get install \ - autopoint:${{ matrix.os-arch }} \ - autoconf:${{ matrix.os-arch }} \ - flex:${{ matrix.os-arch }} \ - bison:${{ matrix.os-arch }} \ - gawk:${{ matrix.os-arch }} - - - name: Install linker for ${{ matrix.os-target }} - if: matrix.os-arch != 'amd64' - run: sudo apt-get install gcc-${{ matrix.os-target }} - - - name: Install Rust stable for ${{ matrix.rust-target }} - uses: dtolnay/rust-toolchain@stable - with: - targets: ${{ matrix.rust-target }} - - - run: cargo build --features "${{ matrix.features }}" - - - run: cargo test --features "${{ matrix.features }}" - if: matrix.os-arch == 'amd64' - - test-musl: - # dynamically linked musl libc - name: Test on Alpine Linux x86_64 (${{ matrix.features }}) - runs-on: ubuntu-latest - strategy: - matrix: - features: - - '' - env: - CARGO_TERM_VERBOSE: 'true' - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Install Alpine Linux with dependencies - uses: jirutka/setup-alpine@v1 - with: - branch: latest-stable - packages: > - build-base - cargo - elfutils-dev - linux-headers - zlib-dev - - - name: Install libbpf-dev - run: apk add libbpf-dev - shell: alpine.sh --root {0} - - - run: cargo build --features "${{ matrix.features }}" - shell: alpine.sh {0} - - - run: cargo test --features "${{ matrix.features }}" - shell: alpine.sh {0} - - test-libbpf-rs: - # check that libbpf-rs, one of the main consumers of the library, works with - # this version of libbpf-sys - name: Test libbpf-rs integration - runs-on: ubuntu-latest - env: - CARGO_TERM_VERBOSE: 'true' - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Install system dependencies - run: | - sudo apt-get update - sudo apt-get install \ - build-essential \ - libelf-dev \ - zlib1g-dev - - - name: Build libbpf-rs with libbpf-sys - run: | - cargo init --bin libbpf-rs-test-project - cd libbpf-rs-test-project - # Add the most recent *published* version of libbpf-rs (as opposed to, - # say, cloning a development snapshot, which would just introduce - # additional uncertainty into the process). - cargo add libbpf-rs - # Override libbpf-sys in use with our current one. - cat >> Cargo.toml <> /etc/apt/sources.list + #shell: sudo sh -e {0} + + #- name: Install system dependencies + #run: | + #sudo apt-get update + #sudo apt-get install \ + #build-essential \ + #libelf-dev:${{ matrix.os-arch }} \ + #zlib1g-dev:${{ matrix.os-arch }} + + #- name: Install libbpf-dev + #run: sudo apt-get install libbpf-dev:${{ matrix.os-arch }} + + #- name: Install Static Compilation dependencies + #run: | + #sudo apt-get install \ + #autopoint \ + #autoconf \ + #flex \ + #bison \ + #gawk \ + + #- name: Install linker for ${{ matrix.os-target }} + #if: matrix.os-arch != 'amd64' + #run: sudo apt-get install gcc-${{ matrix.os-target }} + + #- name: Install Rust stable for ${{ matrix.rust-target }} + #uses: dtolnay/rust-toolchain@stable + #with: + #targets: ${{ matrix.rust-target }} + + #- run: cargo build --features "${{ matrix.features }}" + + #- run: cargo test --features "${{ matrix.features }}" + #if: matrix.os-arch == 'amd64' + + #test-musl: + ## dynamically linked musl libc + #name: Test on Alpine Linux x86_64 (${{ matrix.features }}) + #runs-on: ubuntu-latest + #strategy: + #matrix: + #features: + #- '' + #env: + #CARGO_TERM_VERBOSE: 'true' + #steps: + #- name: Checkout repository + #uses: actions/checkout@v3 + #with: + #submodules: recursive + + #- name: Install Alpine Linux with dependencies + #uses: jirutka/setup-alpine@v1 + #with: + #branch: latest-stable + #packages: > + #build-base + #cargo + #elfutils-dev + #linux-headers + #zlib-dev + + #- name: Install libbpf-dev + #run: apk add libbpf-dev + #shell: alpine.sh --root {0} + + #- run: cargo build --features "${{ matrix.features }}" + #shell: alpine.sh {0} + + #- run: cargo test --features "${{ matrix.features }}" + #shell: alpine.sh {0} + + #test-libbpf-rs: + ## check that libbpf-rs, one of the main consumers of the library, works with + ## this version of libbpf-sys + #name: Test libbpf-rs integration + #runs-on: ubuntu-latest + #env: + #CARGO_TERM_VERBOSE: 'true' + #steps: + #- name: Checkout repository + #uses: actions/checkout@v3 + #with: + #submodules: recursive + + #- name: Install system dependencies + #run: | + #sudo apt-get update + #sudo apt-get install \ + #build-essential \ + #libelf-dev \ + #zlib1g-dev + + #- name: Build libbpf-rs with libbpf-sys + #run: | + #cargo init --bin libbpf-rs-test-project + #cd libbpf-rs-test-project + ## Add the most recent *published* version of libbpf-rs (as opposed to, + ## say, cloning a development snapshot, which would just introduce + ## additional uncertainty into the process). + #cargo add libbpf-rs + ## Override libbpf-sys in use with our current one. + #cat >> Cargo.toml <