envconf/tests/build.sh

32 lines
718 B
Bash
Raw Normal View History

2022-01-29 12:29:09 +00:00
#!/usr/bin/env bash
dir=$(dirname $(realpath $0))
export GO111MODULE=on
export GOPROXY=direct
export GOPATH=${dir}/buildenv/deps
mkdir -p ${dir}/buildenv
chmod -R 755 ${dir}/buildenv
rm -rf ${dir}/buildenv
mkdir -p "${dir}/buildenv/src"
mkdir -p ${GOPATH}/src
mkdir -p ${dir}/bin
cp -r "${dir}/main.go" "${dir}/buildenv/src/main.go"
cd ${dir}/buildenv
go mod init src
go mod tidy
2022-09-17 11:07:12 +00:00
package_name=$(ls ${dir}/buildenv/deps/pkg/mod/git.purser.it/roypur | tr -d "\n")
package_dir="${dir}/buildenv/deps/pkg/mod/git.purser.it/roypur/${package_name}"
2022-09-23 18:22:24 +00:00
chmod -R 777 "${dir}/buildenv/deps"
rm -R "${package_dir}"
mkdir -p "${package_dir}"
2022-09-17 11:07:12 +00:00
cp $(dirname ${dir})/*.go ${package_dir}
2022-09-23 18:22:24 +00:00
cd "${dir}"
go build -o "${dir}/bin/test"