chore: clear remaining clippy lints and stop compiling tests in non-t… #1090
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: Development release for client & installer to s3 | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| branches: | |
| - "main" | |
| push: | |
| branches: | |
| - "main" | |
| jobs: | |
| build-and-release: | |
| permissions: write-all | |
| strategy: | |
| matrix: | |
| arch: [x86_64, aarch64, macos-arm64, macos-x86_64] | |
| channel: [dev, prod] | |
| include: | |
| - arch: x86_64 | |
| target: x86_64-unknown-linux-gnu | |
| runner: ubuntu-22.04 | |
| - arch: aarch64 | |
| target: aarch64-unknown-linux-gnu | |
| runner: ubuntu-22.04-arm | |
| - arch: macos-arm64 | |
| target: aarch64-apple-darwin | |
| runner: macos-latest | |
| - arch: macos-x86_64 | |
| target: x86_64-apple-darwin | |
| runner: macos-latest | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - name: Check out repository with submodules | |
| uses: actions/checkout@v4.1.4 | |
| with: | |
| submodules: recursive # This will fetch all submodules recursively | |
| fetch-depth: 1 # Shallow clone is sufficient and faster | |
| - name: Update version in Cargo.toml | |
| run: | | |
| # Get current date in YYYY.MM.DD format | |
| DATE=$(date +'%Y.%-m.%-d') | |
| # Get time in HH.MM format | |
| TIME=$(date +'%H%M') | |
| # Create new version string | |
| NEW_VERSION="${DATE}+${TIME}" | |
| # Update version in Cargo.toml (compatible with both macOS and Linux) | |
| if [[ "${{ matrix.runner }}" == *"macos"* ]]; then | |
| sed -i '' "s/^version = \".*\"/version = \"${NEW_VERSION}\"/" Cargo.toml | |
| else | |
| sed -i "s/^version = \".*\"/version = \"${NEW_VERSION}\"/" Cargo.toml | |
| fi | |
| # Print the new version for verification | |
| echo "Updated version to: ${NEW_VERSION}" | |
| - name: Install Rust | |
| uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1 | |
| with: | |
| profile: minimal | |
| toolchain: 1.91.1 | |
| override: true | |
| - name: Install target | |
| run: rustup target add ${{ matrix.target }} | |
| - name: Cache Rust dependencies | |
| id: cache-deps | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| key: cargo-deps-${{ matrix.target }}-stable-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| cargo-deps-${{ matrix.target }}-stable- | |
| - name: Cache build artifacts | |
| id: cache-build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| target/ | |
| key: cargo-build-${{ matrix.target }}-stable-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| cargo-build-${{ matrix.target }}-stable- | |
| - name: Install build dependencies | |
| run: | | |
| if [[ "${{ matrix.runner }}" == *"ubuntu"* ]]; then | |
| sudo apt-get update | |
| sudo apt-get install -y linux-headers-$(uname -r) libbpf-dev clang llvm libelf-dev libssl-dev pkg-config | |
| fi | |
| # Verify submodules are properly loaded | |
| - name: Verify submodule content | |
| run: | | |
| # Find all vmlinux.h files | |
| vmlinux_files=$(find vendor -name "vmlinux.h") | |
| # Check if any vmlinux.h files exist | |
| if [ -z "$vmlinux_files" ]; then | |
| echo "ERROR: No vmlinux.h files found in vendor directory" | |
| exit 1 | |
| fi | |
| # Print out the found vmlinux.h files for debugging | |
| echo "Found vmlinux.h files:" | |
| echo "$vmlinux_files" | |
| # Optional: Check for specific directories or files you expect | |
| if [ ! -d "vendor/bpftool" ] || [ ! -d "vendor/libbpf" ]; then | |
| echo "WARNING: Expected vendor subdirectories are missing" | |
| fi | |
| - name: Build the binary | |
| env: | |
| BUILD_CHANNEL: ${{ matrix.channel }} | |
| run: cargo build --release --target ${{ matrix.target }} -p tracer -p tracer-installer | |
| - name: Prepare binary for release | |
| run: | | |
| mkdir -p release-files/${{ matrix.arch }} | |
| cp target/${{ matrix.target }}/release/tracer release-files/${{ matrix.arch }}/tracer | |
| chmod +x release-files/${{ matrix.arch }}/tracer | |
| tar -czf release-files/tracer-${{ matrix.channel }}-${{ matrix.target }}.tar.gz -C release-files/${{ matrix.arch }} tracer | |
| if [ -f target/${{ matrix.target }}/release/tracer-installer ]; then | |
| cp target/${{ matrix.target }}/release/tracer-installer release-files/${{ matrix.arch }}/tracer-installer | |
| chmod +x release-files/${{ matrix.arch }}/tracer-installer | |
| tar -czf release-files/tracer-installer-${{ matrix.target }}.tar.gz -C release-files/${{ matrix.arch }} tracer-installer | |
| fi | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: us-east-1 | |
| - name: Upload to S3 | |
| run: | | |
| aws s3 cp release-files/tracer-${{ matrix.channel }}-${{ matrix.target }}.tar.gz s3://tracer-releases/tracer-${{ matrix.channel }}-${{ matrix.target }}.tar.gz | |
| aws s3 cp release-files/tracer-${{ matrix.channel }}-${{ matrix.target }}.tar.gz s3://tracer-releases/${{ github.head_ref || github.ref_name }}/tracer-${{ matrix.channel }}-${{ matrix.target }}.tar.gz | |
| if [ -f release-files/tracer-installer-${{ matrix.target }}.tar.gz ]; then | |
| aws s3 cp release-files/tracer-installer-${{ matrix.target }}.tar.gz s3://tracer-installer-releases/${{ github.head_ref || github.ref_name }}/tracer-installer-${{ matrix.target }}.tar.gz | |
| fi | |
| build-and-release-amazon-linux-2023: | |
| permissions: write-all | |
| strategy: | |
| matrix: | |
| channel: [dev, prod] | |
| runs-on: ubuntu-latest | |
| container: | |
| image: amazonlinux:2023 | |
| steps: | |
| - name: Cache Rust dependencies (Amazon Linux) | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| key: amazon-linux-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| amazon-linux-cargo- | |
| - name: Install dependencies | |
| run: | | |
| yum update -y --allowerasing | |
| yum groupinstall -y "Development Tools" --allowerasing | |
| yum install -y kernel-devel kernel-headers clang llvm libbpf-devel openssl-devel pkgconfig --allowerasing | |
| - name: Install Rust | |
| run: | | |
| curl https://sh.rustup.rs -sSf | sh -s -- -y | |
| echo 'source $HOME/.cargo/env' >> ~/.bashrc | |
| source $HOME/.cargo/env | |
| rustup target add x86_64-unknown-linux-gnu | |
| rustup toolchain install 1.91.1 --profile minimal | |
| rustup component add clippy | |
| rustup component add rustfmt | |
| - name: Check out repository with submodules | |
| uses: actions/checkout@v4.1.4 | |
| with: | |
| submodules: recursive # This will fetch all submodules recursively | |
| fetch-depth: 0 # Fetch all history for versioning | |
| - name: Configure Git safe directory | |
| run: git config --global --add safe.directory $GITHUB_WORKSPACE | |
| - name: Update version in Cargo.toml | |
| run: | | |
| # Get current date in YYYY.MM.DD format | |
| DATE=$(date +'%Y.%-m.%-d') | |
| # Get time in HH.MM format | |
| TIME=$(date +'%H%M') | |
| # Create new version string | |
| NEW_VERSION="${DATE}+${TIME}" | |
| # Update version in Cargo.toml | |
| sed -i "s/^version = \".*\"/version = \"${NEW_VERSION}\"/" Cargo.toml | |
| # Print the new version for verification | |
| echo "Updated version to: ${NEW_VERSION}" | |
| - name: Build the binary | |
| env: | |
| CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | |
| CARGO_INCREMENTAL: "0" | |
| BUILD_CHANNEL: ${{ matrix.channel }} | |
| run: | | |
| source $HOME/.cargo/env | |
| cargo build --release -p tracer | |
| - name: Prepare binary for release | |
| run: | | |
| mkdir -p release-files/amazon-linux | |
| cp target/release/tracer release-files/amazon-linux/tracer | |
| chmod +x release-files/amazon-linux/tracer | |
| tar -czf release-files/tracer-${{ matrix.channel }}-x86_64-amazon-linux-gnu.tar.gz -C release-files/amazon-linux tracer | |
| - name: Install AWS CLI | |
| run: | | |
| curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | |
| unzip awscliv2.zip | |
| ./aws/install | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: us-east-1 | |
| - name: Upload to S3 | |
| run: | | |
| aws s3 cp release-files/tracer-${{ matrix.channel }}-x86_64-amazon-linux-gnu.tar.gz s3://tracer-releases/tracer-${{ matrix.channel }}-x86_64-amazon-linux-gnu.tar.gz | |
| aws s3 cp release-files/tracer-${{ matrix.channel }}-x86_64-amazon-linux-gnu.tar.gz s3://tracer-releases/${{ github.head_ref || github.ref_name }}/tracer-${{ matrix.channel }}-x86_64-amazon-linux-gnu.tar.gz |