You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

94 lines
2.0 KiB

# i need to preserve --release in args, not to pass cargo make -p release
# due to cargo failing to parse "" argument
env_scripts = ['''
#!@duckscript
args = array ${1} ${2} ${3} ${4} ${5} ${6} ${7}
set_env PROFILE_OVERRIDE debug
for arg in ${args}
e = eq ${arg} "--release"
if ${e}
set_env PROFILE_OVERRIDE release
end
end
profile = get_env PROFILE_OVERRIDE
echo PROFILE_OVERRIDE=${profile}
''']
[config]
default_to_workspace = false
[env]
TARGET = "x86_64-unknown-linux-musl"
CARGO = "cargo"
ROOTDIR = "${CARGO_MAKE_WORKING_DIRECTORY}"
STATIC_PREFIX = "${ROOTDIR}/static"
PQ_LIB_STATIC_X86_64_UNKNOWN_LINUX_MUSL = "true"
PG_CONFIG_X86_64_UNKNOWN_LINUX_GNU = "${STATIC_PREFIX}/bin/pg_config"
OPENSSL_STATIC = "true"
OPENSSL_DIR = "${STATIC_PREFIX}"
[tasks.build_static_libs]
script = "./scripts/build_musl_libs.sh"
[tasks.build_frontend]
script = '''
cd ./bin/u_panel/src/server/fe
ng build
'''
[tasks.clean]
command = "${CARGO}"
args = ["clean"]
[tasks.cargo_build]
dependencies = ["build_static_libs", "build_frontend"]
command = "${CARGO}"
args = ["build", "--target", "${TARGET}", "${@}"]
[tasks.release_tasks]
condition = { env = { "PROFILE_OVERRIDE" = "release"} }
script = '''
BINS=$(ls ./target/${TARGET}/${PROFILE_OVERRIDE}/u_* -1 | grep -v ".d")
echo "Stripping..."
strip $BINS
echo "Packing..."
upx -9 $BINS
'''
[tasks.build]
dependencies = ["cargo_build", "release_tasks"]
clear = true
[tasks.run]
disabled = true
[tasks.unit]
command = "${CARGO}"
args = ["test", "--target", "${TARGET}", "--lib", "--", "${@}"]
[tasks.integration]
script = '''
[[ ! -d "./target/${TARGET}/${PROFILE_OVERRIDE}" ]] && echo 'No target folder. Build project first' && exit 1
cd ./integration
bash integration_tests.sh ${@}
'''
[tasks.gen_schema]
script = '''
docker run --rm \
--env-file=$PWD/.env \
--env-file=$PWD/.env.private \
-v $PWD:/unki \
-w /unki \
unki/u_db \
/unki/images/integration-tests/u_db_entrypoint.sh || true
'''
[tasks.test]
dependencies = ["unit", "integration"]
[tasks.deploy]
script = './scripts/deploy.sh'