-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
622 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
*out | ||
*logs | ||
*actions | ||
*notifications | ||
*tools | ||
plugins | ||
user_trunk.yaml | ||
user.yaml | ||
tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Following source doesn't work in most setups | ||
ignored: | ||
- SC1090 | ||
- SC1091 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Prettier friendly markdownlint config (all formatting rules disabled) | ||
extends: markdownlint/style/prettier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
enable=all | ||
source-path=SCRIPTDIR | ||
disable=SC2154 | ||
|
||
# If you're having issues with shellcheck following source, disable the errors via: | ||
# disable=SC1090 | ||
# disable=SC1091 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
rules: | ||
quoted-strings: | ||
required: only-when-needed | ||
extra-allowed: ["{|}"] | ||
key-duplicates: {} | ||
octal-values: | ||
forbid-implicit-octal: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# This file controls the behavior of Trunk: https://docs.trunk.io/cli | ||
# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml | ||
version: 0.1 | ||
cli: | ||
version: 1.22.2 | ||
# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins) | ||
plugins: | ||
sources: | ||
- id: trunk | ||
ref: v1.6.0 | ||
uri: https://github.com/trunk-io/plugins | ||
# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes) | ||
runtimes: | ||
enabled: | ||
- go@1.21.0 | ||
- node@18.12.1 | ||
- python@3.10.8 | ||
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration) | ||
lint: | ||
enabled: | ||
- actionlint@1.7.1 | ||
- checkov@3.2.184 | ||
- git-diff-check | ||
- gofmt@1.20.4 | ||
- golangci-lint@1.59.1 | ||
- hadolint@2.12.0 | ||
- markdownlint@0.41.0 | ||
- osv-scanner@1.8.2 | ||
- prettier@3.3.2 | ||
- shellcheck@0.10.0 | ||
- shfmt@3.6.0 | ||
- taplo@0.8.1 | ||
- trivy@0.52.2 | ||
- trufflehog@3.79.0 | ||
- yamllint@1.35.1 | ||
actions: | ||
enabled: | ||
- trunk-announce | ||
- trunk-check-pre-push | ||
- trunk-fmt-pre-commit | ||
- trunk-upgrade-available |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module docwhat.org/temple | ||
|
||
go 1.17 | ||
go 1.22.4 | ||
|
||
require ( | ||
github.com/Masterminds/sprig/v3 v3.2.2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,110 @@ | ||
#!/bin/bash | ||
# | ||
# Sets up all the dependencies, etc. so you can build and test. | ||
#!/usr/bin/env bash | ||
# shellcheck disable=SC2310 | ||
|
||
set -euo pipefail | ||
|
||
## GoLangCI Linter | ||
golangci_lint_version="v1.44.2" | ||
golangci_lint_uri="github.com/golangci/golangci-lint/cmd/golangci-lint@${golangci_lint_version}" | ||
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" | ||
readonly root | ||
|
||
go install "$golangci_lint_uri" || | ||
go get -u "$golangci_lint_uri" | ||
red=$(tput setaf 1 2>/dev/null || :) | ||
green=$(tput setaf 2 2>/dev/null || :) | ||
yellow=$(tput setaf 3 2>/dev/null || :) | ||
readonly red green yellow | ||
|
||
# vim: set ft=sh : | ||
bold=$(tput bold 2>/dev/null || :) | ||
reset=$(tput sgr0 2>/dev/null || :) | ||
readonly bold reset | ||
|
||
readonly checkmark="${green}✔${reset}" | ||
readonly crossmark="${red}✘${reset}" | ||
|
||
failure=0 | ||
success=0 | ||
|
||
has() { | ||
command -v "$1" >/dev/null 2>&1 | ||
} | ||
|
||
success() { | ||
printf "%s %s%s%s\n" \ | ||
"${checkmark}" "${green}${bold}" "$1" "${reset}" | ||
success=$((success + 1)) | ||
} | ||
|
||
failure() { | ||
printf "%s %s%s%s\n" \ | ||
"${crossmark}" "${red}${bold}" "$1" "${reset}" | ||
failure=$((failure + 1)) | ||
} | ||
|
||
instructions() { | ||
printf " %s%s%s\n" "${yellow}${bold}" "$1" "${reset}" | ||
} | ||
|
||
declare _os='' # memoize OS | ||
# os tries to detect the Operating System. | ||
os() { | ||
if [[ -z ${_os} ]]; then | ||
case "$(uname -s)" in | ||
Darwin) _os="macos" ;; | ||
Linux) | ||
if [[ -f /etc/os-release ]]; then | ||
_os=$(sh -c '. /etc/os-release; printf "%s" "${ID}"') | ||
else | ||
echo _os="linux" | ||
fi | ||
;; | ||
*) _os="unknown" ;; | ||
esac | ||
fi | ||
printf "%s" "${_os}" | ||
} | ||
|
||
## CURL | ||
############################################################ | ||
if has curl; then | ||
success "curl is installed" | ||
else | ||
failure "missing curl" | ||
instructions "Please install curl." | ||
case "$(os)" in | ||
ubuntu | debian) | ||
instructions "On Ubuntu or Debian, you can use:" | ||
instructions " sudo apt-get install curl" | ||
;; | ||
fedora) | ||
instructions "On Fedora, you can use:" | ||
instructions " sudo dnf install curl" | ||
;; | ||
macos) | ||
die "On macOS, you should already have curl installed." | ||
;; | ||
*) ;; | ||
esac | ||
fi | ||
|
||
## Trunk.IO | ||
############################################################ | ||
printf '\n%sInstalling Trunk%s\n' "${bold}" "${reset}" | ||
trunk_args=(install) | ||
if [[ -n ${CI-} ]]; then | ||
trunk_args+=(--no-progress) | ||
fi | ||
if "${root}/script/trunk" "${trunk_args[@]}"; then | ||
success "trunk is installed" | ||
else | ||
failure "unable to install trunk" | ||
fi | ||
|
||
printf '\nsuccesss: %s%d%s failures: %s%d%s\n' "${green}" "${success}" "${reset}" "${red}" "${failure}" "${reset}" | ||
|
||
if ((failure > 0)); then | ||
printf '\n%sBootstrap failed!%s\n' "${red}" "${reset}" | ||
instructions " Please fix the issues above and run this script again." | ||
exit 1 | ||
else | ||
printf '\n%sSuccess! 🎉%s\n' "${green}" "${reset}" | ||
exit 0 | ||
fi | ||
|
||
# EOF |
Oops, something went wrong.