Skip to content

Commit 1f1367d

Browse files
stefantalpalaruzah
authored andcommitted
macOS binary distribution (both AMD64 and ARM64)
1 parent f6a1f60 commit 1f1367d

File tree

15 files changed

+300
-30
lines changed

15 files changed

+300
-30
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@ jobs:
233233
shell: bash
234234
working-directory: nim-beacon-chain
235235
run: |
236+
if [[ "${{ runner.os }}" == "macOS" ]]; then
237+
ulimit -n 1024
238+
fi
236239
make -j$ncpu ARCH_OVERRIDE=$PLATFORM CI_CACHE=NimBinaries QUICK_AND_DIRTY_COMPILER=1 update
237240
238241
- name: Get latest fixtures commit hash
@@ -268,13 +271,19 @@ jobs:
268271
shell: bash
269272
working-directory: nim-beacon-chain
270273
run: |
274+
if [[ "${{ runner.os }}" == "macOS" ]]; then
275+
ulimit -n 1024
276+
fi
271277
make -j$ncpu ARCH_OVERRIDE=$PLATFORM LOG_LEVEL=TRACE NIMFLAGS="-d:testnet_servers_image" nimbus_beacon_node nimbus_validator_client
272278
273279
- name: Run nim-beacon-chain tests
274280
if: matrix.target.TEST_KIND == 'unit-tests'
275281
shell: bash
276282
working-directory: nim-beacon-chain
277283
run: |
284+
if [[ "${{ runner.os }}" == "macOS" ]]; then
285+
ulimit -n 1024
286+
fi
278287
make -j$ncpu ARCH_OVERRIDE=$PLATFORM DISABLE_TEST_FIXTURES_SCRIPT=1 test
279288
280289
# The upload creates a combined report that gets posted as a comment on the PR

.github/workflows/release.yml

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,63 @@ jobs:
178178
name: Windows_amd64_checksum
179179
path: ./dist/${{ steps.make_dist.outputs.archive_dir }}/build/nimbus_beacon_node.sha512sum
180180
retention-days: 2
181+
build-macos-amd64:
182+
name: macOS AMD64 release asset
183+
runs-on: ubuntu-latest
184+
steps:
185+
- name: Checkout code
186+
uses: actions/checkout@v2
187+
- name: Build project
188+
id: make_dist
189+
run: |
190+
make dist-macos
191+
cd dist
192+
ARCHIVE=$(echo nimbus-eth2_macOS_amd64_*.tar.gz)
193+
echo "::set-output name=archive::"${ARCHIVE}
194+
echo "::set-output name=archive_dir::"${ARCHIVE%.tar.gz}
195+
tar -xzf ${ARCHIVE} ${ARCHIVE%.tar.gz}/build/nimbus_beacon_node.sha512sum
196+
- name: Upload archive artefact
197+
uses: actions/upload-artifact@v2
198+
with:
199+
name: macOS_amd64_archive
200+
path: ./dist/${{ steps.make_dist.outputs.archive }}
201+
retention-days: 2
202+
- name: Upload checksum artefact
203+
uses: actions/upload-artifact@v2
204+
with:
205+
name: macOS_amd64_checksum
206+
path: ./dist/${{ steps.make_dist.outputs.archive_dir }}/build/nimbus_beacon_node.sha512sum
207+
retention-days: 2
208+
build-macos-arm64:
209+
name: macOS ARM64 release asset
210+
runs-on: ubuntu-latest
211+
steps:
212+
- name: Checkout code
213+
uses: actions/checkout@v2
214+
- name: Build project
215+
id: make_dist
216+
run: |
217+
make dist-macos-arm64
218+
cd dist
219+
ARCHIVE=$(echo nimbus-eth2_macOS_arm64_*.tar.gz)
220+
echo "::set-output name=archive::"${ARCHIVE}
221+
echo "::set-output name=archive_dir::"${ARCHIVE%.tar.gz}
222+
tar -xzf ${ARCHIVE} ${ARCHIVE%.tar.gz}/build/nimbus_beacon_node.sha512sum
223+
- name: Upload archive artefact
224+
uses: actions/upload-artifact@v2
225+
with:
226+
name: macOS_arm64_archive
227+
path: ./dist/${{ steps.make_dist.outputs.archive }}
228+
retention-days: 2
229+
- name: Upload checksum artefact
230+
uses: actions/upload-artifact@v2
231+
with:
232+
name: macOS_arm64_checksum
233+
path: ./dist/${{ steps.make_dist.outputs.archive_dir }}/build/nimbus_beacon_node.sha512sum
234+
retention-days: 2
181235
prepare-release:
182236
name: Prepare release draft
183-
needs: [build-amd64, build-arm64, build-arm, build-win64]
237+
needs: [build-amd64, build-arm64, build-arm, build-win64, build-macos-amd64, build-macos-arm64]
184238
runs-on: ubuntu-latest
185239
steps:
186240
- name: Download artefacts
@@ -202,6 +256,10 @@ jobs:
202256
cat Linux_arm_checksum/* >> release_notes.md
203257
echo '# Windows AMD64' >> release_notes.md
204258
cat Windows_amd64_checksum/* >> release_notes.md
259+
echo '# macOS AMD64' >> release_notes.md
260+
cat macOS_amd64_checksum/* >> release_notes.md
261+
echo '# macOS ARM64' >> release_notes.md
262+
cat macOS_arm64_checksum/* >> release_notes.md
205263
echo '```' >> release_notes.md
206264
- name: Create release
207265
id: create_release
@@ -217,6 +275,8 @@ jobs:
217275
Linux_arm64_archive/*
218276
Linux_arm_archive/*
219277
Windows_amd64_archive/*
278+
macOS_amd64_archive/*
279+
macOS_arm64_archive/*
220280
- name: Delete artefacts
221281
uses: geekyeggo/delete-artifact@v1
222282
with:
@@ -230,4 +290,8 @@ jobs:
230290
Linux_arm_checksum
231291
Windows_amd64_archive
232292
Windows_amd64_checksum
293+
macOS_amd64_archive
294+
macOS_amd64_checksum
295+
macOS_arm64_archive
296+
macOS_arm64_checksum
233297

CHANGELOG.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
2021-05-17 v1.3.0
22
=================
33

4-
A new release offering safer and easier options for migrating to Nimbus from
5-
other clients and bringing further performance optimizations.
4+
This release offers safer and easier options to migrate to Nimbus from other clients.
5+
It also brings further performance optimizations.
66

7-
**New features:**
7+
**We've added:**
88

9-
* A new `slashingdb` sub-command offering import and export options for the
10-
EIP-3076 slashing protection interchange format. Please see the the prepared
11-
[migration guides](https://nimbus.guide/migrate.html) outlining the safest
12-
way to migrate to Nimbus from other clients.
9+
* A new `slashingdb` sub-command with `import` and `export` options. This allows for
10+
safely migrating to Nimbus from another client (as per the [EIP-3076](https://eips.ethereum.org/EIPS/eip-3076) slashing
11+
protection interchange format).
12+
Please see the the newly prepared [migration guides](https://nimbus.guide/migrate.html) for the details.
1313

14-
* Pruning of the slashing protection database and transition to more optimal
15-
queries *->* significant reduction of disk and CPU usage on nodes running
16-
large number of validators.
14+
* Pruning of the slashing protection database and a transition to more optimal
15+
queries. This results in a significant reduction in both disk and CPU usage
16+
on nodes running a large number of validators.
1717

1818
* More consistent level of validation for the attestations received from
19-
third-party sources and the JSON-RPC and REST APIs, preventing invalid
20-
attestations to be broadcasted to the network.
19+
third-party sources and the JSON-RPC and REST APIs. This prevents invalid
20+
attestations from being broadcasted to the network.
2121

2222
* Performance tuning of attestation subnet transition timings and state
23-
snapshotting intervals *->* improved CPU and bandwidth usage.
23+
snapshotting intervals. This results in improved CPU and bandwidth usage.
2424

25-
**We've fixed:**
25+
* A new `ncli_db validatorPerf` command. This can be used to perform a textual
26+
report for the attestation performance of a particular validator
27+
(please note that `ncli_db` is available only when compiling from source).
2628

27-
* Problems in the GossipSub subnet walking logic leading to unnecessary
28-
bandwidth and CPU costs.
29+
* Official binaries for macOS (AMD64 and ARM64).
2930

30-
**New tools:**
31+
**We've fixed:**
3132

32-
* A new `ncli_db validatorPerf` command for producing a textual report for the
33-
attestation performance of a particular validator (please note that `ncli_db`
34-
is available only when compiling from source).
33+
* Problems in the GossipSub subnet walking logic leading to unnecessary bandwidth
34+
and CPU costs.
3535

3636

3737
2021-05-03 v1.2.2

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ TOOLS_CSV := $(subst $(SPACE),$(COMMA),$(TOOLS))
8585
dist-arm64 \
8686
dist-arm \
8787
dist-win64 \
88+
dist-macos \
89+
dist-macos-arm64 \
8890
dist \
8991
benchmarks
9092

@@ -582,11 +584,21 @@ dist-win64:
582584
+ MAKE="$(MAKE)" \
583585
scripts/make_dist.sh win64
584586

587+
dist-macos:
588+
+ MAKE="$(MAKE)" \
589+
scripts/make_dist.sh macos
590+
591+
dist-macos-arm64:
592+
+ MAKE="$(MAKE)" \
593+
scripts/make_dist.sh macos-arm64
594+
585595
dist:
586596
+ $(MAKE) dist-amd64
587597
+ $(MAKE) dist-arm64
588598
+ $(MAKE) dist-arm
589599
+ $(MAKE) dist-win64
600+
+ $(MAKE) dist-macos
601+
+ $(MAKE) dist-macos-arm64
590602

591603
#- this simple test will show any missing dynamically-linked Glibc symbols in the target distro
592604
dist-test:

config.nims

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import strutils
2+
13
const nimCachePathOverride {.strdefine.} = ""
24
when nimCachePathOverride == "":
35
when defined(release):
@@ -79,8 +81,7 @@ switch("define", "withoutPCRE")
7981

8082
switch("import", "testutils/moduletests")
8183

82-
const useLibStackTrace = not defined(macosx) and
83-
not defined(windows) and
84+
const useLibStackTrace = not defined(windows) and
8485
not defined(disable_libbacktrace)
8586

8687
when useLibStackTrace:
@@ -90,9 +91,25 @@ else:
9091
--stacktrace:on
9192
--linetrace:on
9293

93-
# the default open files limit is too low on macOS (512), breaking the
94-
# "--debugger:native" build. It can be increased with `ulimit -n 1024`.
95-
if not defined(macosx):
94+
var canEnableDebuggingSymbols = true
95+
if defined(macosx):
96+
# The default open files limit is too low on macOS (512), breaking the
97+
# "--debugger:native" build. It can be increased with `ulimit -n 1024`.
98+
let openFilesLimitTarget = 1024
99+
var openFilesLimit = 0
100+
try:
101+
openFilesLimit = staticExec("ulimit -n").strip(chars = Whitespace + Newlines).parseInt()
102+
if openFilesLimit < openFilesLimitTarget:
103+
echo "Open files limit too low to enable debugging symbols and lightweight stack traces."
104+
echo "Increase it with \"ulimit -n " & $openFilesLimitTarget & "\""
105+
canEnableDebuggingSymbols = false
106+
except:
107+
echo "ulimit error"
108+
# We ignore this resource limit on Windows, where a default `ulimit -n` of 256
109+
# in Git Bash is apparently ignored by the OS, and on Linux where the default of
110+
# 1024 is good enough for us.
111+
112+
if canEnableDebuggingSymbols:
96113
# add debugging symbols and original files and line numbers
97114
--debugger:native
98115

docker/dist/Dockerfile.macos

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# The build is reproducible only if this base image stays the same.
2+
FROM statusteam/nimbus_beacon_node:dist_base_20210513160553_macos@sha256:eef4aff594307c0ff615160aa7184b3660648ce929bb670a409428fc32bd04ed
3+
4+
SHELL ["/bin/bash", "-c"]
5+
6+
ARG USER_ID
7+
ARG GROUP_ID
8+
9+
RUN addgroup --gid ${GROUP_ID} user; \
10+
adduser --disabled-password --gecos '' --uid ${USER_ID} --gid ${GROUP_ID} user;
11+
12+
USER user
13+
14+
STOPSIGNAL SIGINT
15+
16+
COPY "entry_point.sh" "/home/user/"
17+
ENTRYPOINT ["/home/user/entry_point.sh", "macOS_amd64"]
18+

docker/dist/Dockerfile.macos-arm64

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# The build is reproducible only if this base image stays the same.
2+
FROM statusteam/nimbus_beacon_node:dist_base_20210513160553_macos@sha256:eef4aff594307c0ff615160aa7184b3660648ce929bb670a409428fc32bd04ed
3+
4+
SHELL ["/bin/bash", "-c"]
5+
6+
ARG USER_ID
7+
ARG GROUP_ID
8+
9+
RUN addgroup --gid ${GROUP_ID} user; \
10+
adduser --disabled-password --gecos '' --uid ${USER_ID} --gid ${GROUP_ID} user;
11+
12+
USER user
13+
14+
STOPSIGNAL SIGINT
15+
16+
COPY "entry_point.sh" "/home/user/"
17+
ENTRYPOINT ["/home/user/entry_point.sh", "macOS_arm64"]
18+

docker/dist/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Binary Nimbus beacon node distribution
22

33
This binary distribution of the Nimbus eth2 package is compiled
4-
in [reproducible way](https://reproducible-builds.org/) from source files
4+
in a [reproducible way](https://reproducible-builds.org/) from source files
55
hosted at https://github.com/status-im/nimbus-eth2.
66

77
The tarball containing this README uses the following naming scheme:
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# This Docker image can change from one build to another, because the upstream
2+
# Debian/Ubuntu package index is continuously updated and we have to run
3+
# `apt-get update` in here.
4+
#
5+
# The only way to make this a part of our reproducible build system is to build
6+
# it once, upload it to Docker Hub and make sure it's being pulled regularly so
7+
# it's not deleted after 6 months of inactivity.
8+
9+
FROM ubuntu:20.04
10+
11+
SHELL ["/bin/bash", "-c"]
12+
13+
ENV DEBIAN_FRONTEND=noninteractive TZ="Etc/UTC"
14+
RUN apt-get -qq update \
15+
&& apt-get -qq -y install build-essential git clang-11 llvm-11-dev cmake curl libssl-dev lzma-dev libxml2-dev &>/dev/null \
16+
&& update-alternatives --install /usr/bin/clang clang /usr/bin/clang-11 100 \
17+
&& update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-11 100 \
18+
&& apt-get -qq clean \
19+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
20+
21+
COPY "build_osxcross.sh" "/root/"
22+
RUN cd /root \
23+
&& ./build_osxcross.sh
24+

docker/dist/base_image/Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ IMAGE_NAME := statusteam/nimbus_beacon_node:$(IMAGE_TAG)
88
build-arm64 \
99
build-arm \
1010
build-win64 \
11+
build-macos \
1112
push-amd64 \
1213
push-arm64 \
1314
push-arm \
14-
push-win64
15+
push-win64 \
16+
push-macos
1517

1618
build-amd64:
1719
$(CURDIR)/make_base_image.sh amd64 "$(IMAGE_NAME)"
@@ -25,6 +27,9 @@ build-arm:
2527
build-win64:
2628
$(CURDIR)/make_base_image.sh win64 "$(IMAGE_NAME)_win64"
2729

30+
build-macos:
31+
$(CURDIR)/make_base_image.sh macos "$(IMAGE_NAME)_macos"
32+
2833
# You probably don't want to recreate and push these base images to Docker Hub,
2934
# because when older images expire and get deleted, it will no longer be possible
3035
# to reproduce old releases.
@@ -41,3 +46,6 @@ build-win64:
4146
#push-win64: build-win64
4247
# docker push $(IMAGE_NAME)_win64
4348

49+
#push-macos: build-macos
50+
#docker push $(IMAGE_NAME)_macos
51+

0 commit comments

Comments
 (0)