Skip to content

Commit

Permalink
fix: ci binary building (#3)
Browse files Browse the repository at this point in the history
* small update

* small update

* small update

* small update

* small update

* small update

* small update

* small update

* small update

* small update

* small update

* small update

* small update

* small update

* small update

* small update

* small update
  • Loading branch information
ksrichard authored Nov 22, 2024
1 parent e08907c commit 21a698f
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 59 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/build_binaries.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
{
"name": "linux-x86_64",
"runs-on": "ubuntu-22.04",
"rust": "1.77",
"rust": "1.82",
"target": "x86_64-unknown-linux-gnu",
"cross": false,
"features": ""
},
{
"name": "linux-arm64",
"runs-on": "ubuntu-20.04",
"rust": "1.77",
"rust": "1.82",
"target": "aarch64-unknown-linux-gnu",
"cross": true,
"flags": "--workspace --exclude tari_integration_tests",
"flags": "",
"build_enabled": true,
"best_effort": true
},
Expand All @@ -23,23 +23,23 @@
"rust": "stable",
"target": "riscv64gc-unknown-linux-gnu",
"cross": true,
"flags": "--workspace --exclude tari_integration_tests",
"flags": "",
"build_enabled": true,
"best_effort": true
},

{
"name": "macos-x86_64",
"runs-on": "macos-12",
"rust": "1.77",
"rust": "1.82",
"target": "x86_64-apple-darwin",
"cross": false,
"features": ""
},
{
"name": "macos-arm64",
"runs-on": "macos-14",
"rust": "1.77",
"rust": "1.82",
"target": "aarch64-apple-darwin",
"cross": false,
"features": "",
Expand All @@ -49,18 +49,18 @@
{
"name": "windows-x64",
"runs-on": "windows-2019",
"rust": "1.77",
"rust": "1.82",
"target": "x86_64-pc-windows-msvc",
"cross": false,
"features": ""
},
{
"name": "windows-arm64",
"runs-on": "windows-latest",
"rust": "1.77",
"rust": "1.82",
"target": "aarch64-pc-windows-msvc",
"cross": false,
"target_bins": "tari_dan_wallet_cli, tari_dan_wallet_daemon, tari_indexer, tari_validator_node, tari_signaling_server",
"target_bins": "tari",
"features": "",
"build_enabled": true,
"best_effort": true
Expand Down
96 changes: 47 additions & 49 deletions .github/workflows/build_binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@ on:
default: "development-tag"

env:
TS_FILENAME: "tari_network_suite"
TS_BUNDLE_ID_BASE: "com.tari.network.pkg"
TS_SIG_FN: "sha256-unsigned.txt"
## Must be a JSon string
TS_FILES: '["tari_dan_wallet_cli","tari_dan_wallet_daemon","tari_indexer","tari_validator_node","tari_signaling_server","tari_generate"]'
TS_FEATURES: "default"
TS_FILES: '["tari"]'
TS_FILENAME: "tari"
TS_FEATURES: ""
TS_LIBRARIES: ""
TARI_TARGET_NETWORK: igor
TARI_NETWORK: igor
toolchain: 1.77
toolchain: 1.82
matrix-json-file: ".github/workflows/build_binaries.json"
CARGO_HTTP_MULTIPLEXING: false
CARGO_UNSTABLE_SPARSE_REGISTRY: true
Expand Down Expand Up @@ -95,7 +93,7 @@ jobs:
continue-on-error: ${{ matrix.builds.best_effort || false }}
outputs:
TARI_NETWORK_DIR: ${{ steps.set-tari-network.outputs.TARI_NETWORK_DIR }}
TARI_VERSION: ${{ steps.set-tari-vars.outputs.TARI_VERSION }}
TARI_CLI_VERSION: ${{ steps.set-tari-vars.outputs.TARI_CLI_VERSION }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix-prep.outputs.matrix) }}
Expand Down Expand Up @@ -132,11 +130,11 @@ jobs:
run: |
echo "VBRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
echo "VSHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
TARI_VERSION=$(awk -F ' = ' '$1 ~ /^version/ \
TARI_CLI_VERSION=$(awk -F ' = ' '$1 ~ /^version/ \
{ gsub(/["]/, "", $2); printf("%s",$2) }' \
"$GITHUB_WORKSPACE/applications/tari_validator_node/Cargo.toml")
echo "TARI_VERSION=${TARI_VERSION}" >> $GITHUB_ENV
echo "TARI_VERSION=${TARI_VERSION}" >> $GITHUB_OUTPUT
"$GITHUB_WORKSPACE/Cargo.toml")
echo "TARI_CLI_VERSION=${TARI_CLI_VERSION}" >> $GITHUB_ENV
echo "TARI_CLI_VERSION=${TARI_CLI_VERSION}" >> $GITHUB_OUTPUT
if [[ "${{ matrix.builds.features }}" == "" ]]; then
echo "BUILD_FEATURES=${{ env.TS_FEATURES }}" >> $GITHUB_ENV
else
Expand Down Expand Up @@ -333,7 +331,7 @@ jobs:
# set -xo pipefail
mkdir -p "$GITHUB_WORKSPACE${TS_DIST}"
cd "$GITHUB_WORKSPACE${TS_DIST}"
BINFILE="${TS_FILENAME}-${TARI_VERSION}-${VSHA_SHORT}-${{ matrix.builds.name }}${TS_EXT}"
BINFILE="${TS_FILENAME}-${TARI_CLI_VERSION}-${VSHA_SHORT}-${{ matrix.builds.name }}${TS_EXT}"
echo "BINFILE=${BINFILE}" >> $GITHUB_ENV
echo "Copying files for ${BINFILE} to $(pwd)"
echo "MTS_SOURCE=$(pwd)" >> $GITHUB_ENV
Expand Down Expand Up @@ -441,14 +439,14 @@ jobs:
TS_ARCH=$(echo "${${{ matrix.builds.target }}//-apple-darwin/}")
pkgbuild --root "${{ runner.temp }}/osxpkg/${{ env.TARI_NETWORK_DIR }}" \
--identifier "${{ env.TS_BUNDLE_ID_BASE }}.pkg.${TS_BUNDLE_ID_VALID_NAME}" \
--version "${TARI_VERSION}" \
--version "${TARI_CLI_VERSION}" \
--install-location "/tmp/tari" \
--scripts "${{ runner.temp }}/osxpkg/${{ env.TARI_NETWORK_DIR }}/scripts" \
--sign "Developer ID Installer: ${MACOS_INSTALLER_ID}" \
"${distDirPKG}/${{ env.TS_FILENAME }}-${{ matrix.builds.name }}-${{ env.TARI_VERSION }}.pkg"
"${distDirPKG}/${{ env.TS_FILENAME }}-${{ matrix.builds.name }}-${{ env.TARI_CLI_VERSION }}.pkg"
echo -e "Submitting to Apple...\n\n"
xcrun notarytool submit \
"${distDirPKG}/${{ env.TS_FILENAME }}-${{ matrix.builds.name }}-${{ env.TARI_VERSION }}.pkg" \
"${distDirPKG}/${{ env.TS_FILENAME }}-${{ matrix.builds.name }}-${{ env.TARI_CLI_VERSION }}.pkg" \
--apple-id "${MACOS_NOTARIZE_USERNAME}" \
--password ${MACOS_NOTARIZE_PASSWORD} \
--team-id ${MACOS_ASC_PROVIDER} \
Expand All @@ -457,22 +455,22 @@ jobs:
requestUUID=$(tail -n5 notarisation.result | grep "id:" | cut -d" " -f 4)
requestSTATUS=$(tail -n5 notarisation.result | grep "\ \ status:" | cut -d" " -f 4)
if [[ ${requestUUID} == "" ]] || [[ ${requestSTATUS} != "Accepted" ]]; then
echo "## status: ${requestSTATUS} - could not notarize - ${requestUUID} - ${{ env.TS_FILENAME }}-${{ matrix.builds.name }}-${{ env.TARI_VERSION }}.pkg"
echo "## status: ${requestSTATUS} - could not notarize - ${requestUUID} - ${{ env.TS_FILENAME }}-${{ matrix.builds.name }}-${{ env.TARI_CLI_VERSION }}.pkg"
exit 1
else
echo "Notarization RequestUUID: ${requestUUID}"
echo -e "\nStapling package...\
${{ env.TS_FILENAME }}-${{ matrix.builds.name }}-${{ env.TARI_VERSION }}.pkg\n"
${{ env.TS_FILENAME }}-${{ matrix.builds.name }}-${{ env.TARI_CLI_VERSION }}.pkg\n"
xcrun stapler staple -v \
"${distDirPKG}/${{ env.TS_FILENAME }}-${{ matrix.builds.name }}-${{ env.TARI_VERSION }}.pkg"
"${distDirPKG}/${{ env.TS_FILENAME }}-${{ matrix.builds.name }}-${{ env.TARI_CLI_VERSION }}.pkg"
fi
cd ${distDirPKG}
echo "Compute pkg shasum"
${SHARUN} "${{ env.TS_FILENAME }}-${{ matrix.builds.name }}-${{ env.TARI_VERSION }}.pkg" \
>> "${{ env.TS_FILENAME }}-${{ matrix.builds.name }}-${{ env.TARI_VERSION }}.pkg.sha256"
cat "${{ env.TS_FILENAME }}-${{ matrix.builds.name }}-${{ env.TARI_VERSION }}.pkg.sha256"
${SHARUN} "${{ env.TS_FILENAME }}-${{ matrix.builds.name }}-${{ env.TARI_CLI_VERSION }}.pkg" \
>> "${{ env.TS_FILENAME }}-${{ matrix.builds.name }}-${{ env.TARI_CLI_VERSION }}.pkg.sha256"
cat "${{ env.TS_FILENAME }}-${{ matrix.builds.name }}-${{ env.TARI_CLI_VERSION }}.pkg.sha256"
echo "Checksum verification for pkg is "
${SHARUN} --check "${{ env.TS_FILENAME }}-${{ matrix.builds.name }}-${{ env.TARI_VERSION }}.pkg.sha256"
${SHARUN} --check "${{ env.TS_FILENAME }}-${{ matrix.builds.name }}-${{ env.TARI_CLI_VERSION }}.pkg.sha256"
- name: Artifact upload for macOS pkg
# Disabled
Expand All @@ -481,8 +479,8 @@ jobs:
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: ${{ env.TS_FILENAME }}-${{ matrix.builds.name }}-${{ env.TARI_CLI_VERSION }}.pkg
path: "${{ env.distDirPKG }}/${{ env.TS_FILENAME }}-${{ matrix.builds.name }}-${{ env.TARI_CLI_VERSION }}*.pkg*"

- name: Build the Windows installer
# Disabled
Expand All @@ -491,14 +489,14 @@ jobs:
shell: cmd
run: |
cd buildtools
"%programfiles(x86)%\Inno Setup 6\iscc.exe" "/DMyAppVersion=${{ env.TARI_VERSION }}-${{ env.VSHA_SHORT }}-${{ matrix.builds.name }}-installer" "/DMinotariSuite=${{ env.TS_FILENAME }}" "/DTariSuitePath=${{ github.workspace }}${{ env.TS_DIST }}" "windows_inno_installer.iss"
"%programfiles(x86)%\Inno Setup 6\iscc.exe" "/DMyAppVersion=${{ env.TARI_CLI_VERSION }}-${{ env.VSHA_SHORT }}-${{ matrix.builds.name }}-installer" "/DMinotariSuite=${{ env.TS_FILENAME }}" "/DTariSuitePath=${{ github.workspace }}${{ env.TS_DIST }}" "windows_inno_installer.iss"
cd Output
echo "Compute archive shasum"
${{ env.SHARUN }} "${{ env.TS_FILENAME }}-${{ env.TARI_VERSION }}-${{ env.VSHA_SHORT }}-${{ matrix.builds.name }}-installer.exe" >> "${{ env.TS_FILENAME }}-${{ env.TARI_VERSION }}-${{ env.VSHA_SHORT }}-${{ matrix.builds.name }}-installer.exe.sha256"
${{ env.SHARUN }} "${{ env.TS_FILENAME }}-${{ env.TARI_CLI_VERSION }}-${{ env.VSHA_SHORT }}-${{ matrix.builds.name }}-installer.exe" >> "${{ env.TS_FILENAME }}-${{ env.TARI_CLI_VERSION }}-${{ env.VSHA_SHORT }}-${{ matrix.builds.name }}-installer.exe.sha256"
echo "Show the shasum"
cat "${{ env.TS_FILENAME }}-${{ env.TARI_VERSION }}-${{ env.VSHA_SHORT }}-${{ matrix.builds.name }}-installer.exe.sha256"
cat "${{ env.TS_FILENAME }}-${{ env.TARI_CLI_VERSION }}-${{ env.VSHA_SHORT }}-${{ matrix.builds.name }}-installer.exe.sha256"
echo "Checksum verification archive is "
${{ env.SHARUN }} --check "${{ env.TS_FILENAME }}-${{ env.TARI_VERSION }}-${{ env.VSHA_SHORT }}-${{ matrix.builds.name }}-installer.exe.sha256"
${{ env.SHARUN }} --check "${{ env.TS_FILENAME }}-${{ env.TARI_CLI_VERSION }}-${{ env.VSHA_SHORT }}-${{ matrix.builds.name }}-installer.exe.sha256"
- name: Artifact upload for Windows installer
# Disabled
Expand Down Expand Up @@ -539,7 +537,7 @@ jobs:
needs: builds

env:
TARI_VERSION: ${{ needs.builds.outputs.TARI_VERSION }}
TARI_CLI_VERSION: ${{ needs.builds.outputs.TARI_CLI_VERSION }}
VSHA_SHORT: ${{ needs.builds.outputs.VSHA_SHORT }}
SHARUN: "shasum --algorithm 256"

Expand All @@ -562,7 +560,7 @@ jobs:
- name: Set environment variables for macOS universal
shell: bash
run: |
BINFN="${TS_FILENAME}-${TARI_VERSION}-${VSHA_SHORT}"
BINFN="${TS_FILENAME}-${TARI_CLI_VERSION}-${VSHA_SHORT}"
echo "BINFN=${BINFN}" >> $GITHUB_ENV
- name: Install macOS dependencies
Expand Down Expand Up @@ -660,14 +658,14 @@ jobs:
TS_ARCH=universal
pkgbuild --root "${{ runner.temp }}/osxpkg/${{ env.TARI_NETWORK_DIR }}" \
--identifier "${{ env.TS_BUNDLE_ID_BASE }}.pkg.${TS_BUNDLE_ID_VALID_NAME}" \
--version "${TARI_VERSION}" \
--version "${TARI_CLI_VERSION}" \
--install-location "/tmp/tari" \
--scripts "${{ runner.temp }}/osxpkg/${{ env.TARI_NETWORK_DIR }}/scripts" \
--sign "Developer ID Installer: ${MACOS_INSTALLER_ID}" \
"${distDirPKG}/${{ env.TS_FILENAME }}-macos-universal-${{ env.TARI_VERSION }}.pkg"
"${distDirPKG}/${{ env.TS_FILENAME }}-macos-universal-${{ env.TARI_CLI_VERSION }}.pkg"
echo -e "Submitting to Apple...\n\n"
xcrun notarytool submit \
"${distDirPKG}/${{ env.TS_FILENAME }}-macos-universal-${{ env.TARI_VERSION }}.pkg" \
"${distDirPKG}/${{ env.TS_FILENAME }}-macos-universal-${{ env.TARI_CLI_VERSION }}.pkg" \
--apple-id "${MACOS_NOTARIZE_USERNAME}" \
--password ${MACOS_NOTARIZE_PASSWORD} \
--team-id ${MACOS_ASC_PROVIDER} \
Expand All @@ -676,22 +674,22 @@ jobs:
requestUUID=$(tail -n5 notarisation.result | grep "id:" | cut -d" " -f 4)
requestSTATUS=$(tail -n5 notarisation.result | grep "\ \ status:" | cut -d" " -f 4)
if [[ ${requestUUID} == "" ]] || [[ ${requestSTATUS} != "Accepted" ]]; then
echo "## status: ${requestSTATUS} - could not notarize - ${requestUUID} - ${{ env.TS_FILENAME }}-macos-universal-${{ env.TARI_VERSION }}.pkg"
echo "## status: ${requestSTATUS} - could not notarize - ${requestUUID} - ${{ env.TS_FILENAME }}-macos-universal-${{ env.TARI_CLI_VERSION }}.pkg"
exit 1
else
echo "Notarization RequestUUID: ${requestUUID}"
echo -e "\nStapling package...\
${{ env.TS_FILENAME }}-macos-universal-${{ env.TARI_VERSION }}.pkg\n"
${{ env.TS_FILENAME }}-macos-universal-${{ env.TARI_CLI_VERSION }}.pkg\n"
xcrun stapler staple -v \
"${distDirPKG}/${{ env.TS_FILENAME }}-macos-universal-${{ env.TARI_VERSION }}.pkg"
"${distDirPKG}/${{ env.TS_FILENAME }}-macos-universal-${{ env.TARI_CLI_VERSION }}.pkg"
fi
cd ${distDirPKG}
echo "Compute pkg shasum"
${SHARUN} "${{ env.TS_FILENAME }}-macos-universal-${{ env.TARI_VERSION }}.pkg" \
>> "${{ env.TS_FILENAME }}-macos-universal-${{ env.TARI_VERSION }}.pkg.sha256"
cat "${{ env.TS_FILENAME }}-macos-universal-${{ env.TARI_VERSION }}.pkg.sha256"
${SHARUN} "${{ env.TS_FILENAME }}-macos-universal-${{ env.TARI_CLI_VERSION }}.pkg" \
>> "${{ env.TS_FILENAME }}-macos-universal-${{ env.TARI_CLI_VERSION }}.pkg.sha256"
cat "${{ env.TS_FILENAME }}-macos-universal-${{ env.TARI_CLI_VERSION }}.pkg.sha256"
echo "Checksum verification for pkg is "
${SHARUN} --check "${{ env.TS_FILENAME }}-macos-universal-${{ env.TARI_VERSION }}.pkg.sha256"
${SHARUN} --check "${{ env.TS_FILENAME }}-macos-universal-${{ env.TARI_CLI_VERSION }}.pkg.sha256"
- name: Artifact upload for macOS universal pkg
# Disabled
Expand All @@ -700,8 +698,8 @@ jobs:
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: ${{ env.TS_FILENAME }}-macos-universal-${{ env.TARI_VERSION }}.pkg
path: "${{ env.distDirPKG }}/${{ env.TS_FILENAME }}-macos-universal-${{ env.TARI_VERSION }}*.pkg*"
name: ${{ env.TS_FILENAME }}-macos-universal-${{ env.TARI_CLI_VERSION }}.pkg
path: "${{ env.distDirPKG }}/${{ env.TS_FILENAME }}-macos-universal-${{ env.TARI_CLI_VERSION }}*.pkg*"

- name: Archive and Checksum macOS universal Binaries
shell: bash
Expand Down Expand Up @@ -739,7 +737,7 @@ jobs:

env:
TARI_NETWORK_DIR: ${{ needs.builds.outputs.TARI_NETWORK_DIR }}
TARI_VERSION: ${{ needs.builds.outputs.TARI_VERSION }}
TARI_CLI_VERSION: ${{ needs.builds.outputs.TARI_CLI_VERSION }}

permissions:
contents: write
Expand All @@ -760,14 +758,14 @@ jobs:
sudo apt-get update
sudo apt-get --no-install-recommends --assume-yes install dos2unix
ls -alhtR
if [ -f "${{ env.TS_FILENAME }}-${{ env.TARI_VERSION }}.${{ env.TS_SIG_FN }}" ] ; then
rm -fv "${{ env.TS_FILENAME }}-${{ env.TARI_VERSION }}.${{ env.TS_SIG_FN }}"
if [ -f "${{ env.TS_FILENAME }}-${{ env.TARI_CLI_VERSION }}.${{ env.TS_SIG_FN }}" ] ; then
rm -fv "${{ env.TS_FILENAME }}-${{ env.TARI_CLI_VERSION }}.${{ env.TS_SIG_FN }}"
fi
# Merge all sha256 files into one
find . -name "*.sha256" -type f -print | xargs cat >> "${{ env.TS_FILENAME }}-${{ env.TARI_VERSION }}.${{ env.TS_SIG_FN }}"
dos2unix --quiet "${{ env.TS_FILENAME }}-${{ env.TARI_VERSION }}.${{ env.TS_SIG_FN }}"
cat "${{ env.TS_FILENAME }}-${{ env.TARI_VERSION }}.${{ env.TS_SIG_FN }}"
sha256sum --ignore-missing --check "${{ env.TS_FILENAME }}-${{ env.TARI_VERSION }}.${{ env.TS_SIG_FN }}"
find . -name "*.sha256" -type f -print | xargs cat >> "${{ env.TS_FILENAME }}-${{ env.TARI_CLI_VERSION }}.${{ env.TS_SIG_FN }}"
dos2unix --quiet "${{ env.TS_FILENAME }}-${{ env.TARI_CLI_VERSION }}.${{ env.TS_SIG_FN }}"
cat "${{ env.TS_FILENAME }}-${{ env.TARI_CLI_VERSION }}.${{ env.TS_SIG_FN }}"
sha256sum --ignore-missing --check "${{ env.TS_FILENAME }}-${{ env.TARI_CLI_VERSION }}.${{ env.TS_SIG_FN }}"
ls -alhtR
- name: Create release
Expand Down
1 change: 1 addition & 0 deletions Cross.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ image.name = "ubuntu:18.04"
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",
Expand Down
6 changes: 5 additions & 1 deletion scripts/cross_compile_ubuntu_18-pre-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ else
fi

crossArch=${CROSS_DEB_ARCH}

apt-get update

# Base install packages
Expand All @@ -78,9 +79,9 @@ apt-get install --no-install-recommends --assume-yes \
gpg \
bash \
less \
pkg-config \
openssl \
libssl-dev \
pkg-config \
libsqlite3-dev \
libsqlite3-0 \
libreadline-dev \
Expand Down Expand Up @@ -168,6 +169,9 @@ EoF
dpkg --add-architecture ${CROSS_DEB_ARCH}
apt-get update

apt-get install --assume-yes openssl:${CROSS_DEB_ARCH}
apt-get install --assume-yes libssl-dev:${CROSS_DEB_ARCH}

# scripts/install_ubuntu_dependencies-cross_compile.sh x86-64
apt-get --assume-yes install \
pkg-config-${targetPlatform}-linux-gnu \
Expand Down

0 comments on commit 21a698f

Please sign in to comment.