parent
1551cf6925
commit
3553870668
|
@ -4,3 +4,4 @@
|
||||||
/internal/server/assets/dist/*
|
/internal/server/assets/dist/*
|
||||||
dist/
|
dist/
|
||||||
/CHANGELOG.md
|
/CHANGELOG.md
|
||||||
|
/tools
|
||||||
|
|
12
Makefile
12
Makefile
|
@ -15,9 +15,19 @@ help: ## Display this help
|
||||||
watch: deps ## Watching updated files - live reload
|
watch: deps ## Watching updated files - live reload
|
||||||
( set -o allexport && source .env && set +o allexport && go run -mod=readonly github.com/cortesi/modd/cmd/modd@latest )
|
( set -o allexport && source .env && set +o allexport && go run -mod=readonly github.com/cortesi/modd/cmd/modd@latest )
|
||||||
|
|
||||||
test: deps ## Executing tests
|
.PHONY: help
|
||||||
|
test: test-go test-install-script ## Executing tests
|
||||||
|
|
||||||
|
test-go: deps
|
||||||
( set -o allexport && source .env && set +o allexport && go test -v -race -count=1 $(GOTEST_ARGS) ./... )
|
( set -o allexport && source .env && set +o allexport && go test -v -race -count=1 $(GOTEST_ARGS) ./... )
|
||||||
|
|
||||||
|
test-install-script: tools/bin/bash_unit
|
||||||
|
tools/bin/bash_unit ./misc/script/test_install.sh
|
||||||
|
|
||||||
|
tools/bin/bash_unit:
|
||||||
|
mkdir -p tools/bin
|
||||||
|
cd tools/bin && bash <(curl -s https://raw.githubusercontent.com/pgrange/bash_unit/master/install.sh)
|
||||||
|
|
||||||
lint: ## Lint sources code
|
lint: ## Lint sources code
|
||||||
golangci-lint run --enable-all $(LINT_ARGS)
|
golangci-lint run --enable-all $(LINT_ARGS)
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ set -e
|
||||||
FORMIDABLE_RELEASES_URL="https://github.com/Bornholm/formidable/releases"
|
FORMIDABLE_RELEASES_URL="https://github.com/Bornholm/formidable/releases"
|
||||||
FORMIDABLE_DESTDIR="."
|
FORMIDABLE_DESTDIR="."
|
||||||
FORMIDABLE_FILE_BASENAME="frmd"
|
FORMIDABLE_FILE_BASENAME="frmd"
|
||||||
|
FORMIDABLE_PLATEFORM_SUFFIX="$(uname -s)_$(uname -m)"
|
||||||
|
|
||||||
function main {
|
function main {
|
||||||
test -z "${FORMIDABLE_VERSION}" && FORMIDABLE_VERSION="$(curl -sfL -o /dev/null -w %{url_effective} "${FORMIDABLE_RELEASES_URL}/latest" |
|
test -z "${FORMIDABLE_VERSION}" && FORMIDABLE_VERSION="$(curl -sfL -o /dev/null -w %{url_effective} "${FORMIDABLE_RELEASES_URL}/latest" |
|
||||||
|
@ -18,7 +19,7 @@ function main {
|
||||||
}
|
}
|
||||||
|
|
||||||
test -z "${FORMIDABLE_TMPDIR}" && FORMIDABLE_TMPDIR="$(mktemp -d)"
|
test -z "${FORMIDABLE_TMPDIR}" && FORMIDABLE_TMPDIR="$(mktemp -d)"
|
||||||
export TAR_FILE="${FORMIDABLE_TMPDIR}/${FORMIDABLE_FILE_BASENAME}_${FORMIDABLE_VERSION}_$(uname -s)_$(uname -m).tar.gz"
|
export TAR_FILE="${FORMIDABLE_TMPDIR}/${FORMIDABLE_FILE_BASENAME}_${FORMIDABLE_VERSION}_${FORMIDABLE_PLATEFORM_SUFFIX}.tar.gz"
|
||||||
|
|
||||||
(
|
(
|
||||||
cd "${FORMIDABLE_TMPDIR}"
|
cd "${FORMIDABLE_TMPDIR}"
|
||||||
|
@ -26,14 +27,14 @@ function main {
|
||||||
# Download Formidable
|
# Download Formidable
|
||||||
echo "Downloading Formidable ${FORMIDABLE_VERSION}..."
|
echo "Downloading Formidable ${FORMIDABLE_VERSION}..."
|
||||||
curl -sfLo "${TAR_FILE}" \
|
curl -sfLo "${TAR_FILE}" \
|
||||||
"${FORMIDABLE_RELEASES_URL}/download/${FORMIDABLE_VERSION}/${FORMIDABLE_FILE_BASENAME}_${FORMIDABLE_VERSION}_$(uname -s)_$(uname -m).tar.gz" ||
|
"${FORMIDABLE_RELEASES_URL}/download/${FORMIDABLE_VERSION}/${FORMIDABLE_FILE_BASENAME}_${FORMIDABLE_VERSION}_${FORMIDABLE_PLATEFORM_SUFFIX}.tar.gz" ||
|
||||||
( echo "Error while downloading Formidable !" >&2 && exit 1 )
|
( echo "Error while downloading Formidable !" >&2 && exit 1 )
|
||||||
|
|
||||||
# Download checksums
|
# Download checksums
|
||||||
curl -sfLo "checksums.txt" "${FORMIDABLE_RELEASES_URL}/download/${FORMIDABLE_VERSION}/checksums.txt"
|
curl -sfLo "checksums.txt" "${FORMIDABLE_RELEASES_URL}/download/${FORMIDABLE_VERSION}/checksums.txt"
|
||||||
|
|
||||||
echo "Verifying checksums..."
|
echo "Verifying checksum..."
|
||||||
sha256sum --ignore-missing --quiet --check checksums.txt ||
|
check_sum ||
|
||||||
( echo "Error while verifying checksums !" >&2 && exit 1 )
|
( echo "Error while verifying checksums !" >&2 && exit 1 )
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -46,4 +47,10 @@ function main {
|
||||||
echo "You can now use '${FORMIDABLE_DESTDIR}/${FORMIDABLE_FILE_BASENAME}', enjoy !"
|
echo "You can now use '${FORMIDABLE_DESTDIR}/${FORMIDABLE_FILE_BASENAME}', enjoy !"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function check_sum {
|
||||||
|
set -o pipefail
|
||||||
|
cat checksums.txt | grep frmd_*_${FORMIDABLE_PLATEFORM_SUFFIX}.tar.gz | sha256sum -c
|
||||||
|
set +o pipefail
|
||||||
|
}
|
||||||
|
|
||||||
main $@
|
main $@
|
|
@ -0,0 +1,36 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )";
|
||||||
|
|
||||||
|
function test_install_ubuntu_20.04 {
|
||||||
|
cat <<EOF | run_in_docker ubuntu:20.04
|
||||||
|
apt update && apt install -y curl
|
||||||
|
bash /src/misc/script/install.sh
|
||||||
|
test -f ./frmd
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_install_alpine_3.16 {
|
||||||
|
cat <<EOF | run_in_docker alpine:3.16
|
||||||
|
apk add curl
|
||||||
|
sh /src/misc/script/install.sh
|
||||||
|
test -f ./frmd
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_install_fedora_36 {
|
||||||
|
cat <<EOF | run_in_docker fedora:36
|
||||||
|
yum install -y util-linux
|
||||||
|
bash /src/misc/script/install.sh
|
||||||
|
test -f ./frmd
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
function run_in_docker {
|
||||||
|
local image=$1
|
||||||
|
cat | docker run \
|
||||||
|
-v "${SCRIPT_DIR}/../..:/src" \
|
||||||
|
--workdir /tmp \
|
||||||
|
-i --rm \
|
||||||
|
${image}
|
||||||
|
}
|
Loading…
Reference in New Issue