build(deps): bump tempfile from 3.6.0 to 3.7.0 #588
This file contains 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: Test | |
on: | |
push: | |
pull_request: | |
branches: [ master ] | |
workflow_call: | |
jobs: | |
build: | |
name: Test [${{ matrix.rust }}, ${{ matrix.profile }}] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
rust: [stable, nightly] | |
profile: [dev] | |
include: | |
- rust: stable | |
profile: release | |
# Anything nightly is treated as informational-only. | |
continue-on-error: ${{ matrix.rust == 'nightly' }} | |
steps: | |
- name: "Set environmental variables" | |
shell: bash | |
run: | | |
RUST_BACKTRACE_nightly='1' | |
CFLAGS_nightly='-fsanitize=leak' | |
CXXFLAGS_nightly='-fsanitize=leak' | |
RUSTFLAGS_nightly='-Zsanitizer=leak' | |
# A function for defining a variable conditional on the toolchain in | |
# use. | |
tc_var() { | |
# Replace any dots in the toolchain name with underscores. Necessary | |
# due to shell imposed variable naming restrictions. | |
var="${1}_$(echo ${{ matrix.rust }} | tr . _)" | |
echo "${1}=${!var}" >> ${GITHUB_ENV} | |
} | |
tc_var RUST_BACKTRACE | |
tc_var RUSTFLAGS | |
tc_var CFLAGS | |
tc_var CXXFLAGS | |
- uses: actions/checkout@v3 | |
- name: Install Rust | |
uses: actions-rs/[email protected] | |
with: | |
profile: minimal | |
toolchain: ${{ matrix.rust }} | |
components: rustfmt | |
override: true | |
- name: Install deps | |
run: | | |
sudo apt-get install -y clang-14 libelf-dev zlib1g-dev linux-headers-$(uname -r) | |
sudo ln -s /usr/include/asm-generic /usr/include/asm | |
sudo rm -f /bin/clang && sudo ln -s /usr/bin/clang-14 /bin/clang | |
- uses: Swatinem/[email protected] | |
- name: Build | |
run: cargo build --profile=${{ matrix.profile }} --locked --verbose --workspace --exclude runqslower | |
- name: Run tests | |
# Skip tests which require sudo | |
run: cargo test --profile=${{ matrix.profile }} --locked --verbose --workspace --exclude runqslower -- --skip test_sudo_ --include-ignored | |
- name: Run root tests | |
run: cd libbpf-rs && cargo test --profile=${{ matrix.profile }} --locked --verbose -- test_sudo_ | |
build-minimum: | |
name: Build using minimum versions of dependencies | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install deps | |
run: sudo apt-get install -y libelf-dev | |
- name: Install Nightly Rust | |
uses: actions-rs/[email protected] | |
with: | |
profile: minimal | |
toolchain: nightly | |
- run: cargo +nightly -Z minimal-versions update | |
- name: Install minimum Rust | |
uses: actions-rs/[email protected] | |
with: | |
profile: minimal | |
# Please adjust README and rust-version field in Cargo.toml files when | |
# bumping version. | |
toolchain: 1.63.0 | |
components: rustfmt | |
default: true | |
- uses: Swatinem/[email protected] | |
- name: Build | |
run: cargo build --verbose --workspace --exclude runqslower | |
build-capable: | |
name: Build capable example with static libelf and libz | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install deps | |
run: sudo apt-get install -y libelf-dev | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- uses: Swatinem/[email protected] | |
- run: RUSTFLAGS="$RUSTFLAGS -L /usr/lib/x86_64-linux-gnu" cargo build --locked --package capable --features=static | |
build-aarch64: | |
name: Build for aarch64 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Add apt sources for arm64 | |
run: | | |
dpkg --add-architecture arm64 | |
release=$(. /etc/os-release && echo "$UBUNTU_CODENAME") | |
sed -i 's/^deb /deb [arch=amd64] /' /etc/apt/sources.list | |
printf 'deb [arch=arm64] http://ports.ubuntu.com/ %s main restricted\n' \ | |
$release $release-updates $release-security \ | |
>> /etc/apt/sources.list | |
shell: sudo sh -e {0} | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
target: aarch64-unknown-linux-gnu | |
override: true | |
- name: Install deps | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libelf-dev:arm64 zlib1g-dev:arm64 gcc-aarch64-linux-gnu | |
- uses: Swatinem/[email protected] | |
- name: Build | |
env: | |
CARGO_BUILD_TARGET: aarch64-unknown-linux-gnu | |
RUSTFLAGS: -C linker=/usr/bin/aarch64-linux-gnu-gcc | |
run: cargo build --lib | |
build-armhf: | |
name: Build for aarch32 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Add apt sources for armhf | |
run: | | |
dpkg --add-architecture armhf | |
release=$(. /etc/os-release && echo "$UBUNTU_CODENAME") | |
sed -i 's/^deb /deb [arch=amd64] /' /etc/apt/sources.list | |
printf 'deb [arch=armhf] http://ports.ubuntu.com/ %s main restricted\n' \ | |
$release $release-updates $release-security \ | |
>> /etc/apt/sources.list | |
shell: sudo sh -e {0} | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
target: armv7-unknown-linux-gnueabihf | |
override: true | |
- name: Install deps | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libelf-dev:armhf zlib1g-dev:armhf gcc-arm-linux-gnueabihf | |
- uses: Swatinem/[email protected] | |
- name: Build | |
env: | |
CARGO_BUILD_TARGET: armv7-unknown-linux-gnueabihf | |
RUSTFLAGS: -C linker=/usr/bin/armhf-linux-gnu-gcc | |
run: cargo build --lib | |
clippy: | |
name: Lint with clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install deps | |
run: sudo apt-get install -y libelf-dev | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
# TODO: Move back to `stable` once we are past 1.69 | |
# See: | |
# https://github.com/clap-rs/clap/issues/4849 | |
# https://github.com/rust-lang/rust-clippy/issues/10421 | |
toolchain: 1.68.2 | |
components: clippy,rustfmt | |
override: true | |
- uses: Swatinem/[email protected] | |
- run: cargo clippy --locked --no-deps --all-targets --tests -- -D warnings | |
rustfmt: | |
name: Check code formatting | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly | |
components: rustfmt | |
override: true | |
- run: cargo fmt --package libbpf-cargo libbpf-rs -- --check | |
cargo-doc: | |
name: Check documentation | |
runs-on: ubuntu-latest | |
env: | |
RUSTDOCFLAGS: '-D warnings' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install deps | |
run: sudo apt-get install -y libelf-dev | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- run: cargo doc --locked --no-deps |