|
| 1 | +name: Ensure parseable builds on all release targets |
| 2 | + |
1 | 3 | on:
|
2 | 4 | pull_request:
|
3 | 5 | paths-ignore:
|
|
6 | 8 | - "assets/**"
|
7 | 9 | - "**.md"
|
8 | 10 |
|
9 |
| -name: Ensure parseable builds on all release targets |
10 | 11 | jobs:
|
11 |
| - build-linux: |
12 |
| - name: Build for ${{matrix.target}} |
13 |
| - runs-on: ubuntu-latest |
| 12 | + # Default build without Kafka |
| 13 | + build-default: |
| 14 | + name: Build Default ${{matrix.target}} |
| 15 | + runs-on: ${{ matrix.os }} |
14 | 16 | strategy:
|
15 | 17 | fail-fast: false
|
16 | 18 | matrix:
|
17 |
| - target: |
18 |
| - - aarch64-unknown-linux-gnu # linux(arm) |
19 |
| - - x86_64-unknown-linux-gnu # linux(64 bit) |
| 19 | + include: |
| 20 | + # Linux builds |
| 21 | + - os: ubuntu-latest |
| 22 | + target: x86_64-unknown-linux-gnu |
| 23 | + - os: ubuntu-latest |
| 24 | + target: aarch64-unknown-linux-gnu |
| 25 | + # macOS builds |
| 26 | + - os: macos-latest |
| 27 | + target: x86_64-apple-darwin |
| 28 | + - os: macos-latest |
| 29 | + target: aarch64-apple-darwin |
| 30 | + # Windows build |
| 31 | + - os: windows-latest |
| 32 | + target: x86_64-pc-windows-msvc |
20 | 33 |
|
21 | 34 | steps:
|
22 |
| - - uses: actions/checkout@v2 |
| 35 | + - uses: actions/checkout@v4 |
| 36 | + |
| 37 | + - name: Setup Rust toolchain |
| 38 | + uses: dtolnay/rust-toolchain@stable |
| 39 | + with: |
| 40 | + targets: ${{ matrix.target }} |
23 | 41 |
|
24 |
| - - uses: actions-rs/toolchain@v1 |
| 42 | + - name: Cache dependencies |
| 43 | + uses: actions/cache@v4 |
25 | 44 | with:
|
26 |
| - toolchain: stable |
27 |
| - profile: minimal # minimal component installation (ie, no documentation) |
28 |
| - target: ${{ matrix.target }} |
29 |
| - override: true |
| 45 | + path: | |
| 46 | + ~/.cargo/registry |
| 47 | + ~/.cargo/git |
| 48 | + target |
| 49 | + key: ${{ runner.os }}-cargo-${{ matrix.target }}-default-${{ hashFiles('**/Cargo.lock') }} |
30 | 50 |
|
31 |
| - - uses: actions-rs/cargo@v1 |
| 51 | + - name: Build |
| 52 | + uses: actions-rs/cargo@v1 |
32 | 53 | with:
|
33 |
| - use-cross: true |
| 54 | + use-cross: ${{ runner.os == 'Linux' }} |
34 | 55 | command: build
|
35 |
| - args: --target ${{matrix.target}} |
| 56 | + args: --target ${{ matrix.target }} --release |
36 | 57 |
|
37 |
| - build-windows: |
38 |
| - name: Build for windows |
39 |
| - runs-on: windows-latest |
| 58 | + # Kafka build for supported platforms |
| 59 | + build-kafka: |
| 60 | + name: Build Kafka ${{matrix.target}} |
| 61 | + runs-on: ${{ matrix.os }} |
| 62 | + strategy: |
| 63 | + fail-fast: false |
| 64 | + matrix: |
| 65 | + include: |
| 66 | + # Linux builds |
| 67 | + - os: ubuntu-latest |
| 68 | + target: x86_64-unknown-linux-gnu |
| 69 | + - os: macos-latest |
| 70 | + target: aarch64-apple-darwin |
40 | 71 |
|
41 | 72 | steps:
|
42 |
| - - uses: actions/checkout@v2 |
| 73 | + - uses: actions/checkout@v4 |
43 | 74 |
|
44 |
| - - uses: actions-rs/toolchain@v1 |
45 |
| - with: |
46 |
| - toolchain: stable |
47 |
| - profile: minimal # minimal component installation (ie, no documentation) |
48 |
| - default: true |
49 |
| - override: true |
| 75 | + # Linux-specific dependencies |
| 76 | + - name: Install Linux dependencies |
| 77 | + if: runner.os == 'Linux' |
| 78 | + run: | |
| 79 | + sudo apt-get update |
| 80 | + sudo apt-get install -y \ |
| 81 | + build-essential \ |
| 82 | + pkg-config \ |
| 83 | + cmake \ |
| 84 | + clang \ |
| 85 | + zlib1g-dev \ |
| 86 | + libzstd-dev \ |
| 87 | + liblz4-dev \ |
| 88 | + libssl-dev \ |
| 89 | + libsasl2-dev \ |
| 90 | + python3 \ |
| 91 | + gcc-aarch64-linux-gnu \ |
| 92 | + g++-aarch64-linux-gnu |
| 93 | + |
| 94 | + # Install cross-compilation specific packages |
| 95 | + if [ "${{ matrix.target }}" = "aarch64-unknown-linux-gnu" ]; then |
| 96 | + sudo apt-get install -y \ |
| 97 | + gcc-aarch64-linux-gnu \ |
| 98 | + g++-aarch64-linux-gnu \ |
| 99 | + libc6-dev-arm64-cross \ |
| 100 | + libsasl2-dev:arm64 \ |
| 101 | + libssl-dev:arm64 \ |
| 102 | + pkg-config-aarch64-linux-gnu |
| 103 | + fi |
50 | 104 |
|
51 |
| - - name: Build on windows |
52 |
| - run: cargo build --target x86_64-pc-windows-msvc |
53 | 105 |
|
54 |
| - build-macos: |
55 |
| - name: Build for ${{matrix.target}} |
56 |
| - runs-on: macos-latest |
57 |
| - strategy: |
58 |
| - matrix: |
59 |
| - target: |
60 |
| - - aarch64-apple-darwin # macos(arm) |
61 |
| - - x86_64-apple-darwin # macos(intel 64 bit) |
| 106 | + # macOS-specific dependencies |
| 107 | + - name: Install macOS dependencies |
| 108 | + if: runner.os == 'macOS' |
| 109 | + run: | |
| 110 | + brew install \ |
| 111 | + cmake \ |
| 112 | + llvm \ |
| 113 | + pkg-config \ |
| 114 | + zstd \ |
| 115 | + lz4 \ |
| 116 | + |
| 117 | + cyrus-sasl \ |
| 118 | + python3 |
62 | 119 |
|
63 |
| - steps: |
64 |
| - - uses: actions/checkout@v2 |
65 |
| - - uses: actions-rs/toolchain@v1 |
| 120 | + - name: Setup Rust toolchain |
| 121 | + uses: dtolnay/rust-toolchain@stable |
66 | 122 | with:
|
67 |
| - toolchain: stable |
68 |
| - profile: minimal |
69 |
| - target: ${{ matrix.target }} |
70 |
| - override: true |
| 123 | + targets: ${{ matrix.target }} |
71 | 124 |
|
72 |
| - - name: Build on ${{ matrix.target }} |
73 |
| - run: cargo build --target ${{ matrix.target }} |
| 125 | + - name: Cache dependencies |
| 126 | + uses: actions/cache@v4 |
| 127 | + with: |
| 128 | + path: | |
| 129 | + ~/.cargo/registry |
| 130 | + ~/.cargo/git |
| 131 | + target |
| 132 | + key: ${{ runner.os }}-cargo-${{ matrix.target }}-kafka-${{ hashFiles('**/Cargo.lock') }} |
| 133 | + |
| 134 | + - name: Build with Kafka |
| 135 | + uses: actions-rs/cargo@v1 |
| 136 | + with: |
| 137 | + use-cross: ${{ runner.os == 'Linux' }} |
| 138 | + command: build |
| 139 | + args: --target ${{ matrix.target }} --features kafka --release |
| 140 | + env: |
| 141 | + LIBRDKAFKA_SSL_VENDORED: 1 |
| 142 | + PKG_CONFIG_ALLOW_CROSS: "1" |
| 143 | + PKG_CONFIG_PATH: "/usr/lib/aarch64-linux-gnu/pkgconfig" |
| 144 | + SASL2_DIR: "/usr/lib/aarch64-linux-gnu" |
| 145 | + OPENSSL_DIR: "/usr/lib/aarch64-linux-gnu" |
| 146 | + OPENSSL_ROOT_DIR: "/usr/lib/aarch64-linux-gnu" |
| 147 | + OPENSSL_STATIC: "1" |
| 148 | + SASL2_STATIC: "0" |
0 commit comments