build status-go for Nix cache

Also fix scripts/update-status-go.sh to accept commit SHA1

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-07-21 23:31:47 -04:00
parent 688bafc294
commit b9ab37019d
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
8 changed files with 32 additions and 11 deletions

View File

@ -32,6 +32,16 @@ pipeline {
'''
}
}
stage('Build status-go') {
steps { script {
['android', 'desktop', 'ios'].each { os ->
sh """
. ~/.nix-profile/etc/profile.d/nix.sh && \
nix-build --argstr target-os all -A targets.status-go.${os}.buildInputs
"""
}
} }
}
stage('Build prod-build-android') {
steps {
// Run a Nix build to build/fetch everything that is necessary to produce a prod-build for TARGET_OS=android (e.g. maven and node repos)
@ -53,7 +63,7 @@ pipeline {
// Run a Nix build to build/fetch everything that is necessary to instantiate shell.nix for TARGET_OS=all
sh '''
. ~/.nix-profile/etc/profile.d/nix.sh && \
nix-shell --pure --show-trace shell.nix
nix-shell --argstr target-os all --pure --show-trace shell.nix
'''
}
}

View File

@ -9,7 +9,7 @@ let deriv = pkgs.callPackage ./nix/derivation.nix { inherit pkgs target-os; inhe
in {
targets = {
inherit (deriv) mobile leiningen watchman;
inherit (deriv) mobile leiningen watchman status-go;
};
inherit (deriv) shell;

View File

@ -6,7 +6,7 @@ This folder contains configuration for [Nix](https://nixos.org/), a purely funct
The main config file is [`nix/nix.conf`](/nix/nix.conf) and its main purpose is defining the [binary caches](https://nixos.org/nix/manual/#ch-basic-package-mgmt) which allow download of packages to avoid having to compile them yourself locally.
__NOTE:__ If you are in Asia you might want to move the `nix-cache-cn` to be first in order of `extra-substituters`. Removing `cache.nixos.org` could also help.
__NOTE:__ If you are in Asia you might want to add the `https://nix-cache-cn.status.im/` to be first in order of `substituters`. Removing `cache.nixos.org` could also help.
# Shell

View File

@ -44,7 +44,7 @@ let
in {
# CHILD DERIVATIONS
inherit mobile;
inherit mobile status-go;
# TARGETS
leiningen = {

View File

@ -1,4 +1,4 @@
# NOTE: If you are in Asia you might want to move the nix-cache-cn to be first in order.
substituters = https://nix-cache.status.im/ https://cache.nixos.org https://nix-cache-cn.status.im/
trusted-public-keys = nix-cache.status.im-1:x/93lOfLU+duPplwMSBR+OlY4+mo+dCN7n0mr4oPwgY= nix-cache-cn.status.im:WUiOoTQQurm+rEL/yuAuU/a3TViDtMM9DCMgMx/KkOw= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
# NOTE: If you are in Asia you might want to add https://nix-cache-cn.status.im/ to substituters
substituters = https://nix-cache.status.im/ https://cache.nixos.org/
trusted-public-keys = nix-cache.status.im-1:x/93lOfLU+duPplwMSBR+OlY4+mo+dCN7n0mr4oPwgY= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nix-cache-cn.status.im:WUiOoTQQurm+rEL/yuAuU/a3TViDtMM9DCMgMx/KkOw=
connect-timeout = 10

View File

@ -12,9 +12,9 @@ let
extractStatusGoConfig = callPackage ./extract-status-go-config.nix { inherit (stdenv) lib; };
versionJSON = importJSON ../../status-go-version.json; # TODO: Simplify this path search with lib.locateDominatingFile
owner = versionJSON.owner;
repo = versionJSON.repo;
version = versionJSON.version;
sha256 = versionJSON.src-sha256;
repo = "status-go";
rev = versionJSON.commit-sha1;
goPackagePath = "github.com/${owner}/${repo}";
src = fetchFromGitHub { inherit rev owner repo sha256; name = "${repo}-${strings.substring 0 7 rev}-source"; };

View File

@ -6,7 +6,6 @@ GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
usage() {
printf "%s is a tool for upgrading status-go to a given version.\n" "$(basename "$0")"
printf "The given version must be uploaded to Artifactory first.\n\n"
printf "Usage:\n\n"
printf " %s version\n\n" "$(basename "$0")"
printf "Example:\n\n"
@ -23,15 +22,26 @@ if [ $# -eq 0 ]; then
exit 1
fi
repoUrl="https://github.com/${STATUS_GO_OWNER:=status-im}/status-go"
STATUS_GO_REPO="${STATUS_GO_REPO:=status-go}"
STATUS_GO_OWNER="${STATUS_GO_OWNER:=status-im}"
STATUS_GO_VERSION=$1
STATUS_GO_SHA256=$(nix-prefetch-url --unpack ${repoUrl}/archive/${STATUS_GO_VERSION}.zip)
repoUrl="https://github.com/${STATUS_GO_OWNER}/${STATUS_GO_REPO}"
STATUS_GO_COMMIT_SHA1=$(git ls-remote ${repoUrl} U ${STATUS_GO_VERSION} | cut -f1)
if [[ -z "${STATUS_GO_COMMIT_SHA1}" ]]; then
echo "Could not find SHA1 for rev ${STATUS_GO_VERSION}, assuming it's a commit."
STATUS_GO_COMMIT_SHA1="${STATUS_GO_VERSION}"
fi
STATUS_GO_SHA256=$(nix-prefetch-url --unpack ${repoUrl}/archive/${STATUS_GO_VERSION}.zip)
cat << EOF > ${GIT_ROOT}/status-go-version.json
{
"_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead",
"owner": "${STATUS_GO_OWNER}",
"repo": "${STATUS_GO_REPO}",
"version": "${STATUS_GO_VERSION}",
"commit-sha1": "${STATUS_GO_COMMIT_SHA1}",
"src-sha256": "${STATUS_GO_SHA256}"

View File

@ -1,6 +1,7 @@
{
"_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead",
"owner": "status-im",
"repo": "status-go",
"version": "v0.30.0-beta.3",
"commit-sha1": "9a0502fa8ffe8cb63676212dd6868f3683b2c725",
"src-sha256": "1w1x5ws8fr2cjx53y9p3w9kb4ssd2lfljfgv28rksz1jm4pk4dg1"