Skip to content

Commit

Permalink
Merge pull request #73 from serokell/rvem/#64-arm-building-in-CI
Browse files Browse the repository at this point in the history
[#64] Arm building in CI
  • Loading branch information
rvem authored Sep 14, 2020
2 parents e5358a4 + acad6cf commit e583224
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
19 changes: 18 additions & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,21 @@ steps:
- nix run -f.. pkgs.upx -c upx tezos-*
artifact_paths:
- ./docker/tezos-*
# arm builer is an ubuntu machine without nix
- label: build arm via docker
commands:
- eval "$SET_VERSION"
- cd docker
- ./docker-static-build.sh
- upx tezos-*
- >
for f in ./tezos-*; do
mv "\$f" "\$f-arm64"
done
artifact_paths:
- ./docker/tezos-*
agents:
queue: "arm64-build"
- label: test docker-built binaries
commands:
- buildkite-agent artifact download "docker/*" . --step "build via docker"
Expand All @@ -60,11 +75,13 @@ steps:
- rm -rf out
branches: "!master"


- wait
- label: create auto pre-release
commands:
- mkdir binaries
- mkdir arm-binaries
- buildkite-agent artifact download "docker/*" binaries --step "build via docker"
- buildkite-agent artifact download "docker/*" arm-binaries --step "build arm via docker"
- ls binaries
- GITHUB_TOKEN=$(cat ~/niv-bot-token) ./scripts/autorelease.sh
branches: master
6 changes: 3 additions & 3 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: MPL-2.0

{ docker-binaries ? null }:
{ docker-binaries ? null, docker-arm-binaries ? null }:
let
pkgs = import ./nix/build/pkgs.nix { };
source = (import ./nix/nix/sources.nix).tezos;
Expand All @@ -14,7 +14,7 @@ let
branchName = source.ref;
licenseFile = "${source}/LICENSE";
} // meta;
release =
pkgs.callPackage ./release.nix { binaries = docker-binaries; inherit commonMeta; };
release = pkgs.callPackage ./release.nix
{ binaries = docker-binaries; arm-binaries = docker-arm-binaries; inherit commonMeta; };

in { inherit release commonMeta pkgs; }
12 changes: 9 additions & 3 deletions release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,34 @@
#
# SPDX-License-Identifier: MPL-2.0

{ writeTextDir, runCommand, buildEnv, binaries, commonMeta }:
{ writeTextDir, runCommand, buildEnv, binaries, arm-binaries, commonMeta }:
let
release-binaries = import ./nix/build/release-binaries.nix;
release-notes = writeTextDir "release-notes.md" ''
Automatic release
This release contains assets based on [${commonMeta.branchName} release](https://gitlab.com/tezos/tezos/tree/${commonMeta.branchName}).
Binaries that target arm64 architecture has `-arm64` suffix in the name.
Other binaries target x86_64.
Descriptions for binaries included in this release:
${builtins.concatStringsSep "\n"
(map ({ name, description, ... }: "- `${name}`: ${description}")
release-binaries)}
'';
releaseNoTarball = buildEnv {
name = "tezos-release-no-tarball";
paths = [ "${binaries}" LICENSE release-notes ];
paths = [ "${binaries}" "${arm-binaries}" LICENSE release-notes ];
};
tarballName = "binaries-${commonMeta.version}-${commonMeta.release}.tar.gz";
armTarballName = "binaries-${commonMeta.version}-${commonMeta.release}-arm64.tar.gz";
binariesTarball = runCommand "binaries-tarball" { }
"mkdir $out; tar --owner=serokell:1000 --mode='u+rwX' -czhf $out/${tarballName} -C ${binaries} .";
armBinariesTarball = runCommand "binaries-tarball" { }
"mkdir $out; tar --owner=serokell:1000 --mode='u+rwX' -czhf $out/${armTarballName} -C ${arm-binaries} .";
LICENSE = writeTextDir "LICENSE" (builtins.readFile commonMeta.licenseFile);
in buildEnv {
name = "tezos-release";
paths = [ releaseNoTarball binariesTarball ];
paths = [ releaseNoTarball binariesTarball armBinariesTarball ];
}
3 changes: 2 additions & 1 deletion scripts/autorelease.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ trap finish EXIT
assets_dir=$TEMPDIR/assets

# Build release.nix
nix-build -A release -o "$TEMPDIR"/"$project" --arg timestamp "$(date +\"%Y%m%d%H%M\")" --arg docker-binaries ./binaries/docker
nix-build -A release -o "$TEMPDIR"/"$project" --arg timestamp "$(date +\"%Y%m%d%H%M\")" \
--arg docker-binaries ./binaries/docker --arg docker-arm-binaries ./arm-binaries/docker
mkdir -p "$assets_dir"
# Move archive with binaries and tezos license to assets
shopt -s extglob
Expand Down

0 comments on commit e583224

Please sign in to comment.