Skip to content

Resize ESP packet to data size instead of max. #114

Resize ESP packet to data size instead of max.

Resize ESP packet to data size instead of max. #114

Workflow file for this run

name: Cargo build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
validate:
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v4
- name: Get current Rust version
id: get-rust-version
run: echo VERSION=$(rustc --version | sed s/\ /_/g) >> "$GITHUB_OUTPUT"
- name: Cache Rust dependencies and artifacts
id: cache-rust
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
~/.cargo/bin
${{ github.workspace }}/target
key: lint-${{ runner.os }}-${{ steps.get-rust-version.outputs.VERSION }}-${{ hashFiles('Cargo.*') }}
- name: Validate Rust code with clippy
run: cargo clippy
build-linux:
runs-on: ubuntu-latest
needs: validate
strategy:
fail-fast: true
matrix:
include:
- arch: x86_64
os: ubuntu
- arch: aarch64
os: ubuntu
steps:
- uses: actions/checkout@v4
- name: Get current Rust version
id: get-rust-version
run: echo VERSION=$(rustc --version | sed s/\ /_/g) >> "$GITHUB_OUTPUT"
- name: Cache Rust dependencies and artifacts
id: cache-rust
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
${{ github.workspace }}/target
key: rust-${{ runner.os }}-${{ matrix.os }}-${{ matrix.arch }}-${{ steps.get-rust-version.outputs.VERSION }}-${{ hashFiles('Cargo.*') }}
- name: Install compiler and prepare for cross-compilation
if: matrix.arch == 'aarch64'
run: |
sudo apt-get install -y crossbuild-essential-arm64
sudo dpkg --add-architecture arm64
sudo sed 's/deb http/deb \[arch=amd64,i386\] http/' -i /etc/apt/sources.list
echo | sudo tee -a /etc/apt/sources.list <<EOF
deb [arch=arm64] http://azure.ports.ubuntu.com/ $(lsb_release -cs) main universe restricted multiverse
deb [arch=arm64] http://azure.ports.ubuntu.com/ $(lsb_release -cs)-updates main universe restricted multiverse
deb [arch=arm64] http://azure.ports.ubuntu.com/ $(lsb_release -cs)-security main universe restricted multiverse
EOF
sudo apt-get update || echo "Some sources failed to update, http://azure.archive.ubuntu.com doesn't have arm64 images"
echo "LD_LIBRARY_PATH=/usr/lib/aarch64-linux-gnu:$LD_LIBRARY_PATH" >> $GITHUB_ENV
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "CC=/usr/bin/aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "CXX=/usr/bin/aarch64-linux-gnu-g++" >> $GITHUB_ENV
echo "CFLAGS=-march=armv8.2-a" >> $GITHUB_ENV
echo "CXXFLAGS=-march=armv8.2-a" >> $GITHUB_ENV
rustup target add ${{ matrix.arch }}-unknown-linux-gnu
- name: Build
run: cargo build --target=${{ matrix.arch }}-unknown-linux-gnu --release
- name: Package application
run: tar -cvjf pterodapter-${{ matrix.os }}-${{ matrix.arch }}.tar.bz2 -C target/${{ matrix.arch }}-unknown-linux-gnu/release pterodapter
- name: Upload application
uses: actions/upload-artifact@v4
with:
name: pterodapter-${{ matrix.os }}-${{ matrix.arch }}
path: pterodapter-*.tar.bz2
build-macos:
runs-on: macos-latest
needs: validate
strategy:
fail-fast: true
matrix:
arch: [aarch64, x86_64]
steps:
- uses: actions/checkout@v4
- name: Get current Rust version
id: get-rust-version
run: echo VERSION=$(rustc --version | sed s/\ /_/g) >> "$GITHUB_OUTPUT"
- name: Cache Rust dependencies and artifacts
id: cache-rust
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
${{ github.workspace }}/target
key: rust-${{ runner.os }}-${{ matrix.arch }}-${{ steps.get-rust-version.outputs.VERSION }}-${{ hashFiles('Cargo.*') }}
- name: Install compiler and prepare for cross-compilation
if: matrix.arch == 'x86_64'
run: rustup target add ${{ matrix.arch }}-apple-darwin
- name: Build
run: cargo build --target=${{ matrix.arch }}-apple-darwin --release
- name: Package application
run: tar -cvjf pterodapter-${{ runner.os }}-${{ matrix.arch }}.tar.bz2 -C target/${{ matrix.arch }}-apple-darwin/release pterodapter
- name: Upload application
uses: actions/upload-artifact@v4
with:
name: pterodapter-${{ runner.os }}-${{ matrix.arch }}
path: pterodapter-*.tar.bz2
package:
runs-on: ubuntu-latest
needs: [ "build-linux", "build-macos" ]
steps:
- name: Merge all applications
uses: actions/upload-artifact/merge@v4
with:
name: pterodapter-all
pattern: pterodapter-*