forked from keep-starknet-strange/madara
-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (112 loc) · 4.8 KB
/
binaries-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
---
name: Task - Build binaries and publish
on:
workflow_dispatch:
inputs:
release_tag_name:
description: "Release tag name"
type: string
required: true
workflow_call:
inputs:
release_tag_name:
description: "Release tag name"
type: string
required: true
jobs:
build:
strategy:
fail-fast: false
matrix:
build:
- aarch64-apple-darwin
- aarch64-unknown-linux-gnu
- x86_64-apple-darwin
- x86_64-unknown-linux-gnu
# https://github.com/rust-rocksdb/rust-rocksdb/issues/665
# - x86_64-pc-windows-gnu
- x86_64-pc-windows-msvc
include:
- build: aarch64-apple-darwin
os: macos-latest-xl
bin_name: madara
- build: aarch64-unknown-linux-gnu
os: ubuntu-latest-32-cores
bin_name: madara
- build: x86_64-apple-darwin
os: macos-latest-xl
bin_name: madara
- build: x86_64-unknown-linux-gnu
os: ubuntu-latest-32-cores
bin_name: madara
- build: x86_64-pc-windows-msvc
os: windows-latest
bin_name: madara.exe
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup rust toolchain
run: |
rustup target add ${{ matrix.build }}
- name: Setup build deps (linux)
if:
matrix.build == 'x86_64-unknown-linux-gnu' || matrix.build ==
'aarch64-unknown-linux-gnu'
run: |
sudo apt update
sudo apt install -y clang llvm libudev-dev protobuf-compiler libssl-dev
- name: Setup build deps (aarch64-unknown-linux-gnu)
if: matrix.build == 'aarch64-unknown-linux-gnu'
run: |
sudo apt update
sudo apt install -y g++-aarch64-linux-gnu libc6-dev-arm64-cross
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
export CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc
export CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g+
- name: Setup build deps (x86_64-apple-darwin)
if:
matrix.build == 'x86_64-apple-darwin' || matrix.build ==
'aarch64-apple-darwin'
run: |
brew install protobuf
- name: Setup build deps (x86_64-pc-windows-msvc)
if: matrix.build == 'x86_64-pc-windows-msvc'
run: |
choco install -y protoc llvm
mkdir C:/tmp/madara-libs
(New-Object net.webclient).Downloadfile("https://github.com/keep-starknet-strange/madara-infra/releases/download/win-bins-build-libs/libjemalloc.a", "C:/tmp/madara-libs/libjemalloc.a")
(New-Object net.webclient).Downloadfile("https://github.com/keep-starknet-strange/madara-infra/releases/download/win-bins-build-libs/rocksdb.lib", "C:/tmp/madara-libs/rocksdb.lib")
- name: Build (x86_64 linux and x86_64/aarch64 apple)
if:
matrix.build == 'x86_64-unknown-linux-gnu' || matrix.build ==
'x86_64-apple-darwin' || matrix.build == 'aarch64-apple-darwin'
run: cargo build --release --target ${{ matrix.build }}
- name: Build (aarch64-unknown-linux-gnu)
if: matrix.build == 'aarch64-unknown-linux-gnu'
run: |
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc
export CC_aarch64_unknown_linux_gnu=/usr/bin/aarch64-linux-gnu-gcc
export CXX_aarch64_unknown_linux_gnu=/usr/bin/aarch64-linux-gnu-g++
cargo build --release --target ${{ matrix.build }}
- name: Pre-Build (x86_64-pc-windows-msvc)
if: matrix.build == 'x86_64-pc-windows-msvc'
shell: bash
run: |
cargo fetch --target ${{ matrix.build }}
export reg_folder=$(ls C:/Users/runneradmin/.cargo/registry/src | grep github.com)
export pdb_folder=$(ls C:/Users/runneradmin/.cargo/registry/src/$reg_folder | grep parity-db)
sed -ir 's/madvise_random(_id: TableId, _map: \&mut memmap2::MmapMut)/madvise_random(_map: \&mut memmap2::MmapMut)/g' C:/Users/runneradmin/.cargo/registry/src/$reg_folder/$pdb_folder/src/file.rs
- name: Build (x86_64-pc-windows-msvc)
if: matrix.build == 'x86_64-pc-windows-msvc'
shell: bash
run: |
JEMALLOC_OVERRIDE=C:/tmp/madara-libs/libjemalloc.a ROCKSDB_LIB_DIR=C:/tmp/madara-libs cargo build --release --target ${{ matrix.build }}
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/${{ matrix.build }}/release/${{ matrix.bin_name }}
asset_name: ${{ matrix.build}}-${{ matrix.bin_name }}
tag: ${{ inputs.release_tag_name }}
overwrite: true