Skip to content

Commit a6c5e7c

Browse files
committed
fix: use rustls-tls for cross-compilation, add crates.io publish
- Switch reqwest from native-tls to rustls-tls to avoid OpenSSL cross-compile issues - Use cross tool for ARM/musl Linux targets - Remove Raspberry Pi (armv7) target - low demand, complex cross-compile - Add crates.io publish step to release workflow (requires CARGO_REGISTRY_TOKEN secret)
1 parent 95835fa commit a6c5e7c

3 files changed

Lines changed: 381 additions & 70 deletions

File tree

.github/workflows/release.yml

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,54 +27,56 @@ jobs:
2727
os: macos-latest
2828
binary_name: indra
2929
archive_name: indra-x86_64-apple-darwin.tar.gz
30+
use_cross: false
3031

3132
# macOS Apple Silicon
3233
- target: aarch64-apple-darwin
3334
os: macos-latest
3435
binary_name: indra
3536
archive_name: indra-aarch64-apple-darwin.tar.gz
37+
use_cross: false
3638

3739
# Linux x86_64 (glibc)
3840
- target: x86_64-unknown-linux-gnu
3941
os: ubuntu-latest
4042
binary_name: indra
4143
archive_name: indra-x86_64-unknown-linux-gnu.tar.gz
44+
use_cross: false
4245

4346
# Linux x86_64 (musl - static)
4447
- target: x86_64-unknown-linux-musl
4548
os: ubuntu-latest
4649
binary_name: indra
4750
archive_name: indra-x86_64-unknown-linux-musl.tar.gz
51+
use_cross: true
4852

49-
# Linux ARM64
53+
# Linux ARM64 - use cross for proper sysroot
5054
- target: aarch64-unknown-linux-gnu
5155
os: ubuntu-latest
5256
binary_name: indra
5357
archive_name: indra-aarch64-unknown-linux-gnu.tar.gz
58+
use_cross: true
5459

5560
# Linux ARM64 (musl)
5661
- target: aarch64-unknown-linux-musl
5762
os: ubuntu-latest
5863
binary_name: indra
5964
archive_name: indra-aarch64-unknown-linux-musl.tar.gz
60-
61-
# Raspberry Pi (ARMv7)
62-
- target: armv7-unknown-linux-gnueabihf
63-
os: ubuntu-latest
64-
binary_name: indra
65-
archive_name: indra-armv7-unknown-linux-gnueabihf.tar.gz
65+
use_cross: true
6666

6767
# Windows x86_64
6868
- target: x86_64-pc-windows-msvc
6969
os: windows-latest
7070
binary_name: indra.exe
7171
archive_name: indra-x86_64-pc-windows-msvc.zip
72+
use_cross: false
7273

7374
# Windows ARM64
7475
- target: aarch64-pc-windows-msvc
7576
os: windows-latest
7677
binary_name: indra.exe
7778
archive_name: indra-aarch64-pc-windows-msvc.zip
79+
use_cross: false
7880

7981
steps:
8082
- name: Checkout code
@@ -103,25 +105,22 @@ jobs:
103105
path: target
104106
key: ${{ runner.os }}-${{ matrix.target }}-cargo-target-${{ hashFiles('**/Cargo.lock') }}
105107

106-
- name: Install cross-compilation tools (Linux ARM)
107-
if: runner.os == 'Linux' && contains(matrix.target, 'aarch64')
108-
run: |
109-
sudo apt-get update
110-
sudo apt-get install -y gcc-aarch64-linux-gnu
111-
112-
- name: Install cross-compilation tools (Linux ARMv7)
113-
if: runner.os == 'Linux' && contains(matrix.target, 'armv7')
114-
run: |
115-
sudo apt-get update
116-
sudo apt-get install -y gcc-arm-linux-gnueabihf
108+
- name: Install cross
109+
if: matrix.use_cross
110+
run: cargo install cross --git https://github.com/cross-rs/cross
117111

118-
- name: Install musl tools
119-
if: contains(matrix.target, 'musl')
112+
- name: Install musl tools (native musl build)
113+
if: matrix.target == 'x86_64-unknown-linux-musl' && !matrix.use_cross
120114
run: |
121115
sudo apt-get update
122116
sudo apt-get install -y musl-tools
123117
124-
- name: Build binary
118+
- name: Build binary (cross)
119+
if: matrix.use_cross
120+
run: cross build --release --locked --target ${{ matrix.target }}
121+
122+
- name: Build binary (native)
123+
if: "!matrix.use_cross"
125124
run: cargo build --release --locked --target ${{ matrix.target }}
126125

127126
- name: Strip binary (Unix)
@@ -223,7 +222,6 @@ jobs:
223222
- **Linux x86_64 (musl/static)**: `indra-x86_64-unknown-linux-musl.tar.gz`
224223
- **Linux ARM64**: `indra-aarch64-unknown-linux-gnu.tar.gz`
225224
- **Linux ARM64 (musl)**: `indra-aarch64-unknown-linux-musl.tar.gz`
226-
- **Raspberry Pi (ARMv7)**: `indra-armv7-unknown-linux-gnueabihf.tar.gz`
227225
- **Windows x86_64**: `indra-x86_64-pc-windows-msvc.zip`
228226
- **Windows ARM64**: `indra-aarch64-pc-windows-msvc.zip`
229227
@@ -238,3 +236,19 @@ jobs:
238236
See [README](https://github.com/moonstripe/indra_db#readme) for full documentation.
239237
env:
240238
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
239+
240+
publish-crates:
241+
name: Publish to crates.io
242+
needs: release
243+
runs-on: ubuntu-latest
244+
steps:
245+
- name: Checkout code
246+
uses: actions/checkout@v4
247+
248+
- name: Install Rust toolchain
249+
uses: dtolnay/rust-toolchain@stable
250+
251+
- name: Publish to crates.io
252+
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
253+
env:
254+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

0 commit comments

Comments
 (0)