Skip to content

Commit

Permalink
Make execution of tests in Nix builds optional (#873)
Browse files Browse the repository at this point in the history
  • Loading branch information
neodix42 authored Jan 24, 2024
1 parent 2e231ec commit 9f1b370
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ton-x86-64-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
run: |
cp assembly/nix/build-linux-x86-64-nix.sh .
chmod +x build-linux-x86-64-nix.sh
./build-linux-x86-64-nix.sh
./build-linux-x86-64-nix.sh -t
- name: Simple binaries test
run: |
Expand All @@ -38,4 +38,4 @@ jobs:
uses: actions/upload-artifact@master
with:
name: ton-x86_64-linux-binaries
path: artifacts
path: artifacts
4 changes: 2 additions & 2 deletions .github/workflows/ton-x86-64-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
run: |
cp assembly/nix/build-macos-nix.sh .
chmod +x build-macos-nix.sh
./build-macos-nix.sh
./build-macos-nix.sh -t
- name: Simple binaries test
run: |
Expand All @@ -34,4 +34,4 @@ jobs:
uses: actions/upload-artifact@master
with:
name: ton-x86_64-macos-binaries
path: artifacts
path: artifacts
10 changes: 5 additions & 5 deletions assembly/cicd/jenkins/test-builds.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pipeline {
sh '''
cp assembly/nix/build-linux-x86-64-nix.sh .
chmod +x build-linux-x86-64-nix.sh
./build-linux-x86-64-nix.sh
./build-linux-x86-64-nix.sh -t
'''
sh '''
cd artifacts
Expand Down Expand Up @@ -69,7 +69,7 @@ pipeline {
sh '''
cp assembly/nix/build-linux-arm64-nix.sh .
chmod +x build-linux-arm64-nix.sh
./build-linux-arm64-nix.sh
./build-linux-arm64-nix.sh -t
'''
sh '''
cd artifacts
Expand Down Expand Up @@ -107,7 +107,7 @@ pipeline {
sh '''
cp assembly/nix/build-macos-nix.sh .
chmod +x build-macos-nix.sh
./build-macos-nix.sh
./build-macos-nix.sh -t
'''
sh '''
cd artifacts
Expand Down Expand Up @@ -145,7 +145,7 @@ pipeline {
sh '''
cp assembly/nix/build-macos-nix.sh .
chmod +x build-macos-nix.sh
./build-macos-nix.sh
./build-macos-nix.sh -t
'''
sh '''
cd artifacts
Expand Down Expand Up @@ -233,4 +233,4 @@ pipeline {
}
}
}
}
}
19 changes: 17 additions & 2 deletions assembly/nix/build-linux-arm64-nix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,27 @@
nix-build --version
test $? -eq 0 || { echo "Nix is not installed!"; exit 1; }

with_tests=false


while getopts 't' flag; do
case "${flag}" in
t) with_tests=true ;;
*) break
;;
esac
done

cp assembly/nix/linux-arm64* .
cp assembly/nix/microhttpd.nix .
cp assembly/nix/openssl.nix .
export NIX_PATH=nixpkgs=https://github.com/nixOS/nixpkgs/archive/23.05.tar.gz

nix-build linux-arm64-static.nix
if [ "$with_tests" = true ]; then
nix-build linux-arm64-static.nix --arg testing true
else
nix-build linux-arm64-static.nix
fi
mkdir artifacts
cp ./result/bin/* artifacts/
chmod +x artifacts/*
Expand All @@ -17,4 +32,4 @@ nix-build linux-arm64-tonlib.nix
cp ./result/lib/libtonlibjson.so.0.5 artifacts/libtonlibjson.so
cp ./result/lib/libemulator.so artifacts/
cp -r crypto/fift/lib artifacts/
cp -r crypto/smartcont artifacts/
cp -r crypto/smartcont artifacts/
20 changes: 18 additions & 2 deletions assembly/nix/build-linux-x86-64-nix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,28 @@
nix-build --version
test $? -eq 0 || { echo "Nix is not installed!"; exit 1; }

with_tests=false


while getopts 't' flag; do
case "${flag}" in
t) with_tests=true ;;
*) break
;;
esac
done

cp assembly/nix/linux-x86-64* .
cp assembly/nix/microhttpd.nix .
cp assembly/nix/openssl.nix .
export NIX_PATH=nixpkgs=https://github.com/nixOS/nixpkgs/archive/23.05.tar.gz

nix-build linux-x86-64-static.nix
if [ "$with_tests" = true ]; then
nix-build linux-x86-64-static.nix --arg testing true
else
nix-build linux-x86-64-static.nix
fi

mkdir artifacts
cp ./result/bin/* artifacts/
chmod +x artifacts/*
Expand All @@ -17,4 +33,4 @@ nix-build linux-x86-64-tonlib.nix
cp ./result/lib/libtonlibjson.so.0.5 artifacts/libtonlibjson.so
cp ./result/lib/libemulator.so artifacts/
cp -r crypto/fift/lib artifacts/
cp -r crypto/smartcont artifacts/
cp -r crypto/smartcont artifacts/
20 changes: 18 additions & 2 deletions assembly/nix/build-macos-nix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,25 @@
nix-build --version
test $? -eq 0 || { echo "Nix is not installed!"; exit 1; }

with_tests=false


while getopts 't' flag; do
case "${flag}" in
t) with_tests=true ;;
*) break
;;
esac
done

cp assembly/nix/macos-* .
export NIX_PATH=nixpkgs=https://github.com/nixOS/nixpkgs/archive/23.05.tar.gz
nix-build macos-static.nix

if [ "$with_tests" = true ]; then
nix-build macos-static.nix --arg testing true
else
nix-build macos-static.nix
fi
mkdir artifacts
cp ./result-bin/bin/* artifacts/
chmod +x artifacts/*
Expand All @@ -14,4 +30,4 @@ nix-build macos-tonlib.nix
cp ./result/lib/libtonlibjson.dylib artifacts/
cp ./result/lib/libemulator.dylib artifacts/
cp -r crypto/fift/lib artifacts/
cp -r crypto/smartcont artifacts/
cp -r crypto/smartcont artifacts/
3 changes: 2 additions & 1 deletion assembly/nix/linux-arm64-static.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{ pkgs ? import <nixpkgs> { system = builtins.currentSystem; }
, lib ? pkgs.lib
, stdenv ? pkgs.stdenv
, testing ? false
}:
let
microhttpdmy = (import ./microhttpd.nix) {};
Expand All @@ -25,7 +26,7 @@ stdenv.mkDerivation {
];

makeStatic = true;
doCheck = true;
doCheck = testing;

cmakeFlags = [
"-DTON_USE_ABSEIL=OFF"
Expand Down
3 changes: 2 additions & 1 deletion assembly/nix/linux-x86-64-static.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{ pkgs ? import <nixpkgs> { system = builtins.currentSystem; }
, lib ? pkgs.lib
, stdenv ? pkgs.stdenv
, testing ? false
}:
let
microhttpdmy = (import ./microhttpd.nix) {};
Expand All @@ -25,7 +26,7 @@ stdenv.mkDerivation {
];

makeStatic = true;
doCheck = true;
doCheck = testing;

cmakeFlags = [
"-DTON_USE_ABSEIL=OFF"
Expand Down
5 changes: 3 additions & 2 deletions assembly/nix/macos-static.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{ pkgs ? import <nixpkgs> { system = builtins.currentSystem; }
, lib ? pkgs.lib
, stdenv ? pkgs.stdenv
, testing ? false
}:

pkgs.llvmPackages_14.stdenv.mkDerivation {
Expand All @@ -29,7 +30,7 @@ pkgs.llvmPackages_14.stdenv.mkDerivation {

dontAddStaticConfigureFlags = true;
makeStatic = true;
doCheck = true;
doCheck = testing;

configureFlags = [];

Expand Down Expand Up @@ -62,4 +63,4 @@ pkgs.llvmPackages_14.stdenv.mkDerivation {
done
'';
outputs = [ "bin" "out" ];
}
}

0 comments on commit 9f1b370

Please sign in to comment.