Add common tools

This commit is contained in:
2023-05-09 14:16:12 +04:00
parent 930eaaebfb
commit 7200d400f0
11 changed files with 145 additions and 2 deletions

View File

@@ -0,0 +1,4 @@
#!/bin/bash
apt update && apt upgrade -y
apt install -y build-essential curl file git make

View File

@@ -0,0 +1,12 @@
#!/bin/bash
gofumpt_version="0.5.0"
set -xe
cd /tmp
git clone https://github.com/mvdan/gofumpt.git
cd gofumpt || exit 1
git checkout "v${gofumpt_version}"
go build -o /usr/local/bin/gofumpt .
rm -rf /tmp/gofumpt

22
scripts/workers/golang.sh Normal file
View File

@@ -0,0 +1,22 @@
#!/bin/bash
# shellcheck disable=SC2154
# Line above disables shellcheck linters:
# * SC2154 - variable referenced but not assigned (false positive, assigned when sourced arch.sh).
set -xe
go_version=1.20.3
# shellcheck disable=SC2086,SC2046,SC2164
cd $(dirname ${BASH_SOURCE[0]})
script_path=$(pwd)
# shellcheck disable=SC1091
source "${script_path}/../helpers/arch.sh"
curl "https://dl.google.com/go/go${go_version}.linux-${arch}.tar.gz" -o "/tmp/go-${arch}.tar.gz"
file "/tmp/go-${arch}.tar.gz"
tar -xf "/tmp/go-${arch}.tar.gz" -C /usr/local/
rm "/tmp/go-${arch}.tar.gz"
ln -s /usr/local/go/bin/* /usr/local/bin

View File

@@ -0,0 +1,20 @@
#!/bin/bash
# shellcheck disable=SC2154
# Line above disables shellcheck linters:
# * SC2154 - variable referenced but not assigned (false positive, assigned when sourced arch.sh).
golangci_lint_version=1.52.2
# shellcheck disable=SC2086,SC2046,SC2164
cd "$(dirname ${BASH_SOURCE[0]})"
script_path=$(pwd)
# shellcheck disable=SC1091
source "${script_path}/../helpers/arch.sh"
curl -L "https://github.com/golangci/golangci-lint/releases/download/v${golangci_lint_version}/golangci-lint-${golangci_lint_version}-linux-${arch}.tar.gz" -o "/tmp/golangci-lint-${arch}.tar.gz"
file "/tmp/golangci-lint-${arch}.tar.gz"
tar -xf "/tmp/golangci-lint-${arch}.tar.gz" -C /tmp
mv "/tmp/golangci-lint-${golangci_lint_version}-linux-${arch}/golangci-lint" /usr/local/bin
rm -rf "/tmp/golangci-lint-${arch}.tar.gz" "/tmp/golangci-lint-${golangci_lint_version}-linux-${arch}/"

View File

@@ -0,0 +1,21 @@
#!/bin/bash
# shellcheck disable=SC2154
# Line above disables shellcheck linters:
# * SC2154 - variable referenced but not assigned (false positive, assigned when sourced arch.sh).
taskfile_version=3.24.0
# shellcheck disable=SC2086,SC2046,SC2164
cd "$(dirname ${BASH_SOURCE[0]})"
script_path=$(pwd)
# shellcheck disable=SC1091
source "${script_path}/../helpers/arch.sh"
curl -L "https://github.com/go-task/task/releases/download/v${taskfile_version}/task_linux_${arch}.tar.gz" -o "/tmp/taskfile-${arch}.tar.gz"
file "/tmp/taskfile-${arch}.tar.gz"
tar -xf "/tmp/taskfile-${arch}.tar.gz" -C /tmp
mv "/tmp/task" /usr/local/bin
rm -rf "/tmp/*"
ls -la /usr/local/bin