Skip to content

Commit fe2f37f

Browse files
author
Philip Sampaio
authored
Fix "cross" configuration for release workflow (#14)
1 parent 1222399 commit fe2f37f

File tree

6 files changed

+46
-16
lines changed

6 files changed

+46
-16
lines changed

.github/workflows/ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ env:
99
ELIXIR_VERSION: 1.13
1010
OTP_VERSION: 24.2
1111
MIX_ENV: test
12+
TOKENIZERS_BUILD: "true"
1213

1314
jobs:
1415
test:

.github/workflows/release.yml

+11-16
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ jobs:
3333
os: ubuntu-20.04,
3434
nif: "2.16",
3535
use-cross: true,
36+
features: "static_openssl",
3637
}
3738
- { target: aarch64-unknown-linux-gnu, os: ubuntu-20.04, nif: "2.16", use-cross: true }
3839
- { target: aarch64-apple-darwin, os: macos-11, nif: "2.16" }
3940
- { target: x86_64-apple-darwin, os: macos-11, nif: "2.16" }
4041
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04, nif: "2.16" }
41-
- { target: x86_64-unknown-linux-musl, os: ubuntu-20.04, nif: "2.16", use-cross: true }
42+
- { target: x86_64-unknown-linux-musl, os: ubuntu-20.04, nif: "2.16", use-cross: true, features: "static_openssl" }
4243
- { target: x86_64-pc-windows-gnu, os: windows-2019, nif: "2.16" }
4344
- { target: x86_64-pc-windows-msvc, os: windows-2019, nif: "2.16" }
4445
# NIF version 2.15
@@ -47,26 +48,28 @@ jobs:
4748
os: ubuntu-20.04,
4849
nif: "2.15",
4950
use-cross: true,
51+
features: "static_openssl",
5052
}
5153
- { target: aarch64-unknown-linux-gnu, os: ubuntu-20.04, nif: "2.15", use-cross: true }
5254
- { target: aarch64-apple-darwin, os: macos-11, nif: "2.15" }
5355
- { target: x86_64-apple-darwin, os: macos-11, nif: "2.15" }
5456
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04, nif: "2.15" }
55-
- { target: x86_64-unknown-linux-musl, os: ubuntu-20.04, nif: "2.15", use-cross: true }
57+
- { target: x86_64-unknown-linux-musl, os: ubuntu-20.04, nif: "2.15", use-cross: true, features: "static_openssl" }
5658
- { target: x86_64-pc-windows-gnu, os: windows-2019, nif: "2.15" }
5759
- { target: x86_64-pc-windows-msvc, os: windows-2019, nif: "2.15" }
58-
# # NIF version 2.14
60+
# NIF version 2.14
5961
- {
6062
target: arm-unknown-linux-gnueabihf,
6163
os: ubuntu-20.04,
6264
nif: "2.14",
6365
use-cross: true,
66+
features: "static_openssl",
6467
}
6568
- { target: aarch64-unknown-linux-gnu, os: ubuntu-20.04, nif: "2.14", use-cross: true }
6669
- { target: aarch64-apple-darwin, os: macos-11, nif: "2.14" }
6770
- { target: x86_64-apple-darwin, os: macos-11, nif: "2.14" }
6871
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04, nif: "2.14" }
69-
- { target: x86_64-unknown-linux-musl, os: ubuntu-20.04, nif: "2.14", use-cross: true }
72+
- { target: x86_64-unknown-linux-musl, os: ubuntu-20.04, nif: "2.14", use-cross: true, features: "static_openssl" }
7073
- { target: x86_64-pc-windows-gnu, os: windows-2019, nif: "2.14" }
7174
- { target: x86_64-pc-windows-msvc, os: windows-2019, nif: "2.14" }
7275

@@ -76,14 +79,6 @@ jobs:
7679
- name: Checkout source code
7780
uses: actions/checkout@v2
7881

79-
- name: Install prerequisites
80-
shell: bash
81-
run: |
82-
case ${{ matrix.job.target }} in
83-
arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf libssl-dev openssl;;
84-
aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu libssl-dev openssl;;
85-
esac
86-
8782
- name: Extract crate information
8883
shell: bash
8984
run: |
@@ -115,18 +110,18 @@ jobs:
115110
if: ${{ matrix.job.use-cross }}
116111
with:
117112
binary: "cross"
118-
version: "v0.2.1"
119-
download_url: "https://github.com/rust-embedded/cross/releases/download/${version}/cross-${version}-x86_64-unknown-linux-gnu.tar.gz"
113+
version: "v0.2.4"
114+
download_url: "https://github.com/cross-rs/cross/releases/download/${version}/cross-x86_64-unknown-linux-gnu.tar.gz"
120115
tarball_binary_path: "${binary}"
121116
smoke_test: "${binary} --version"
122117

123118
- name: Build
124119
shell: bash
125120
run: |
126121
if [ "${{ matrix.job.use-cross }}" == "true" ]; then
127-
cross build --release --target=${{ matrix.job.target }}
122+
cross build --release --target=${{ matrix.job.target }} --features=${{ matrix.job.features }}
128123
else
129-
cargo build --release --target=${{ matrix.job.target }}
124+
cargo build --release --target=${{ matrix.job.target }} --features=${{ matrix.job.features }}
130125
fi
131126
132127
- name: Rename lib to the final name

native/ex_tokenizers/Cargo.lock

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

native/ex_tokenizers/Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@ anyhow = "1"
1414
rustler = "0.25.0"
1515
thiserror = "1"
1616
tokenizers = "0.11.3"
17+
openssl = { version = "0.10", optional = true }
18+
19+
[features]
20+
static_openssl = ["openssl/vendored"]

native/ex_tokenizers/Cross.toml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[build.env]
2+
passthrough = [
3+
"RUSTLER_NIF_VERSION"
4+
]
5+
6+
# We need to install some dependencies for specific targets.
7+
[target.arm-unknown-linux-gnueabihf]
8+
pre-build = "./scripts/install-cross-deps"
9+
10+
[target.aarch64-unknown-linux-gnu]
11+
pre-build = "./scripts/install-cross-deps"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
# Script to install dependencies for cross compilation
4+
5+
dpkg --add-architecture $CROSS_DEB_ARCH
6+
7+
apt-get update
8+
apt-get install --assume-yes libssl-dev:$CROSS_DEB_ARCH openssl:$CROSS_DEB_ARCH

0 commit comments

Comments
 (0)