Skip to content

Commit

Permalink
ci(fix): resolve x86 linux build (tari-project#10)
Browse files Browse the repository at this point in the history
Description
Resolve x86 linux builds
Add cross-compile options that mostly work - need to resolve arm64
cross-compile from x86

Motivation and Context
Provide runtime assets

How Has This Been Tested?
Builds locally and in local fork

What process can a PR reviewer use to test or verify this change?
---

<!-- Checklist -->
<!-- 1. Is the title of your PR in the form that would make nice release
notes? The title, excluding the conventional commit
tag, will be included exactly as is in the CHANGELOG, so please think
about it carefully. -->


Breaking Changes
---

- [x] None
- [ ] Requires data directory on base node to be deleted
- [ ] Requires hard fork
- [ ] Other - Please specify

<!-- Does this include a breaking change? If so, include this line as a
footer -->
<!-- BREAKING CHANGE: Description what the user should do, e.g. delete a
database, resync the chain -->
  • Loading branch information
leet4tari authored Jul 4, 2024
1 parent d886349 commit fce27c7
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 20 deletions.
9 changes: 9 additions & 0 deletions .cargo/audit.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[advisories]
ignore = [

# We are not using a special allocator and will not suffer this issue
"RUSTSEC-2021-0145",
# We are not using RSA
"RUSTSEC-2023-0071"

]
8 changes: 7 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"

[target.riscv64gc-unknown-linux-gnu]
linker = "riscv64-linux-gnu-gcc"

[alias]
ci-fmt = "fmt --all -- --check"
ci-fmt-fix = "fmt --all"
ci-clippy = "lints clippy --all-targets --all-features"
ci-test-compile = "test --no-run --workspace --all-features --no-default-features"
ci-test = "nextest run --all-features --release --workspace --exclude integration_tests --profile ci"
ci-cucumber = "test --all-features --release --package integration_tests"
ci-check = "check --workspace --release --all-features --all-targets --locked"
ci-check = "check --workspace --release --all-features --all-targets --locked"
3 changes: 1 addition & 2 deletions .github/workflows/build_binaries.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
"runs-on": "windows-2019",
"rust": "stable",
"target": "x86_64-pc-windows-msvc",
"cross": false,
"features": "safe"
"cross": false
},
{
"name": "windows-arm64",
Expand Down
20 changes: 8 additions & 12 deletions .github/workflows/build_binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ env:
TS_SIG_FN: "sha256-unsigned.txt"
## Must be a JSon string
TS_FILES: '["sha_p2pool"]'
TS_FEATURES: "default"
toolchain: nightly-2024-03-01
matrix-json-file: ".github/workflows/build_binaries.json"
CARGO_HTTP_MULTIPLEXING: false
Expand Down Expand Up @@ -116,11 +115,6 @@ jobs:
"$GITHUB_WORKSPACE/Cargo.toml")
echo "TARI_VERSION=${TARI_VERSION}" >> $GITHUB_ENV
echo "TARI_VERSION=${TARI_VERSION}" >> $GITHUB_OUTPUT
if [[ "${{ matrix.builds.features }}" == "" ]]; then
echo "BUILD_FEATURES=${{ env.TS_FEATURES }}" >> $GITHUB_ENV
else
echo "BUILD_FEATURES=${{ matrix.builds.features }}" >> $GITHUB_ENV
fi
TARGET_BINS=""
if [[ "${{ matrix.builds.target_bins }}" == "" ]]; then
ARRAY_BINS=( $(echo ${TS_FILES} | jq --raw-output '.[]' | awk '{ print $1 }') )
Expand Down Expand Up @@ -275,7 +269,6 @@ jobs:
run: |
${{ env.CARGO }} build ${{ env.CARGO_OPTIONS }} \
--target ${{ matrix.builds.target }} \
--features "${{ env.BUILD_FEATURES }}" \
${{ env.TARGET_BINS }} \
${{ matrix.builds.flags }} --locked
Expand Down Expand Up @@ -316,7 +309,6 @@ jobs:
ls -alhtR ${{ env.MTS_SOURCE }}
- name: Pre/unsigned OSX Artifact upload for Archive
# Debug
if: ${{ false }}
# if: startsWith(runner.os,'macOS')
continue-on-error: true
Expand All @@ -326,7 +318,8 @@ jobs:
path: "${{ env.MTS_SOURCE }}/*"

- name: Build the macOS pkg
if: startsWith(runner.os,'macOS')
if: ${{ false }}
# if: startsWith(runner.os,'macOS')
continue-on-error: true
env:
MACOS_KEYCHAIN_PASS: ${{ secrets.MACOS_KEYCHAIN_PASS }}
Expand Down Expand Up @@ -422,15 +415,17 @@ jobs:
${SHARUN} --check "${{ env.TS_FILENAME }}-${{ matrix.builds.name }}-${{ env.TARI_VERSION }}.pkg.sha256"
- name: Artifact upload for macOS pkg
if: startsWith(runner.os,'macOS')
if: ${{ false }}
# if: startsWith(runner.os,'macOS')
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: ${{ env.TS_FILENAME }}-${{ matrix.builds.name }}-${{ env.TARI_VERSION }}.pkg
path: "${{ env.distDirPKG }}/${{ env.TS_FILENAME }}-${{ matrix.builds.name }}-${{ env.TARI_VERSION }}*.pkg*"

- name: Build the Windows installer
if: startsWith(runner.os,'Windows')
if: ${{ false }}
# if: startsWith(runner.os,'Windows')
continue-on-error: true
shell: cmd
run: |
Expand All @@ -445,7 +440,8 @@ jobs:
${{ env.SHARUN }} --check "${{ env.TS_FILENAME }}-${{ env.TARI_VERSION }}-${{ env.VSHA_SHORT }}-${{ matrix.builds.name }}-installer.exe.sha256"
- name: Artifact upload for Windows installer
if: startsWith(runner.os,'Windows')
if: ${{ false }}
# if: startsWith(runner.os,'Windows')
continue-on-error: true
uses: actions/upload-artifact@v4
with:
Expand Down
45 changes: 40 additions & 5 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,41 @@
[build.env]
passthrough = [
"CFLAGS",
"TARGET",
"RUST_TARGET",
"BUILD_TARGET",
"CARGO_BUILD_TARGET",
"TARGET_CFLAGS",
"CC_aarch64_unknown_linux_gnu",
"PKG_CONFIG_SYSROOT_DIR",
"PKG_CONFIG_ALLOW_CROSS",
"RUSTFLAGS",
"RUST_BACKTRACE",
"RUST_DEBUG",
"RUST_LOG",
"ARCH",
"FEATURES",
"ROARING_ARCH",
"TARI_NETWORK",
"TARI_TARGET_NETWORK",
"TARI_NETWORK_DIR",
]

# Currently needs cross-rs from git
# ```cargo install cross --git https://github.com/cross-rs/cross```
[target.aarch64-unknown-linux-gnu]
image.name = "ubuntu:18.04"
# targetting is needed for apple silicon
image.toolchain = ["linux/arm64=aarch64-unknown-linux-gnu", "linux/amd64=x86_64-unknown-linux-gnu"]
pre-build = "./scripts/cross_compile_ubuntu_18-pre-build.sh"

[target.aarch64-unknown-linux-gnu.env]
passthrough = [
"CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc",
"PKG_CONFIG_SYSROOT_DIR=/usr/lib/aarch64-linux-gnu/",
"PKG_CONFIG_ALLOW_CROSS=true",
]

[target.x86_64-unknown-linux-gnu]
pre-build = [
"dpkg --add-architecture $CROSS_DEB_ARCH",
"apt-get update",
"apt-get install --no-install-recommends --assume-yes apt-transport-https ca-certificates curl gpg bash less openssl libssl-dev pkg-config libsqlite3-dev:$CROSS_DEB_ARCH libsqlite3-0:$CROSS_DEB_ARCH libreadline-dev git cmake dh-autoreconf clang g++ libc++-dev libc++abi-dev libprotobuf-dev protobuf-compiler:$CROSS_DEB_ARCH libncurses5-dev libncursesw5-dev libudev-dev libhidapi-dev zip"
]
image = "ubuntu:18.04"
pre-build = "./scripts/cross_compile_ubuntu_18-pre-build.sh"
2 changes: 2 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "stable"

0 comments on commit fce27c7

Please sign in to comment.