forked from 0xERR0R/blocky
-
Notifications
You must be signed in to change notification settings - Fork 3
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
190 changed files
with
904,186 additions
and
11,800 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,66 @@ | ||
{ | ||
"name": "blocky development", | ||
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-22.04", | ||
"features": { | ||
"ghcr.io/devcontainers/features/go:1": {}, | ||
"ghcr.io/jungaretti/features/make:1": {}, | ||
"ghcr.io/devcontainers/features/docker-in-docker:2": { | ||
"dockerDashComposeVersion": "v2" | ||
}, | ||
"ghcr.io/devcontainers/features/python:1": {}, | ||
"ghcr.io/devcontainers/features/github-cli:1": {}, | ||
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": { | ||
"packages": "dnsutils " | ||
} | ||
}, | ||
"remoteEnv": { | ||
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}", | ||
"WORKSPACE_FOLDER": "${containerWorkspaceFolder}", | ||
"GENERATE_LCOV": "true" | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"golang.go", | ||
"esbenp.prettier-vscode", | ||
"yzhang.markdown-all-in-one", | ||
"joselitofilho.ginkgotestexplorer", | ||
"fsevenm.run-it-on", | ||
"markis.code-coverage", | ||
"tooltitudeteam.tooltitude", | ||
"GitHub.vscode-github-actions" | ||
], | ||
"settings": { | ||
"go.lintFlags": ["--config=${containerWorkspaceFolder}/.golangci.yml"], | ||
"go.alternateTools": { | ||
"go-langserver": "gopls" | ||
}, | ||
"[go]": { | ||
"editor.defaultFormatter": "golang.go" | ||
}, | ||
"[json][jsonc][github-actions-workflow]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
}, | ||
"[markdown]": { | ||
"editor.defaultFormatter": "yzhang.markdown-all-in-one" | ||
}, | ||
"markiscodecoverage.searchCriteria": "**/*.lcov", | ||
"runItOn": { | ||
"commands": [ | ||
{ | ||
"match": "\\.go$", | ||
"cmd": "${workspaceRoot}/.devcontainer/scripts/runItOnGo.sh ${fileDirname} ${workspaceRoot}" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"mounts": [ | ||
"type=bind,readonly,source=/etc/localtime,target=/usr/share/host/localtime", | ||
"type=bind,readonly,source=/etc/timezone,target=/usr/share/host/timezone", | ||
"type=volume,source=blocky-pkg_cache,target=/go/pkg" | ||
], | ||
"postCreateCommand": "sudo chmod +x .devcontainer/scripts/*.sh", | ||
"postStartCommand": "sh .devcontainer/scripts/postStart.sh" | ||
} |
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,27 @@ | ||
#!/bin/bash -e | ||
|
||
echo "Setting up go environment..." | ||
# Use the host's timezone and time | ||
sudo ln -sf /usr/share/host/localtime /etc/localtime | ||
sudo ln -sf /usr/share/host/timezone /etc/timezone | ||
# Change permission on pkg volume | ||
sudo chown -R vscode:golang /go/pkg | ||
echo "" | ||
|
||
echo "Downloading Go modules..." | ||
go mod download -x | ||
echo "" | ||
|
||
echo "Tidying Go modules..." | ||
go mod tidy -x | ||
echo "" | ||
|
||
echo "Installing Go tools..." | ||
echo " - ginkgo" | ||
go install github.com/onsi/ginkgo/v2/ginkgo@latest | ||
echo " - golangci-lint" | ||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest | ||
echo " - gofumpt" | ||
go install mvdan.cc/gofumpt@latest | ||
echo " - gcov2lcov" | ||
go install github.com/jandelgado/gcov2lcov@latest |
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,39 @@ | ||
#!/bin/bash -e | ||
|
||
FOLDER_PATH=$1 | ||
if [ -z "${FOLDER_PATH}" ]; then | ||
FOLDER_PATH=$PWD | ||
fi | ||
|
||
BASE_PATH=$2 | ||
if [ -z "${BASE_PATH}" ]; then | ||
BASE_PATH=$WORKSPACE_FOLDER | ||
fi | ||
|
||
if [ "$FOLDER_PATH" = "$BASE_PATH" ]; then | ||
echo "Skipping lcov creation for base path" | ||
exit 1 | ||
fi | ||
|
||
FOLDER_NAME=${FOLDER_PATH#"$BASE_PATH/"} | ||
WORK_NAME="$(echo "$FOLDER_NAME" | sed 's/\//-/g')" | ||
WORK_FILE_NAME="$WORK_NAME.ginkgo" | ||
WORK_FILE_PATH="/tmp/$WORK_FILE_NAME" | ||
OUTPUT_FOLDER="$BASE_PATH/coverage" | ||
OUTPUT_FILE_PATH="$OUTPUT_FOLDER/$WORK_NAME.lcov" | ||
|
||
|
||
mkdir -p "$OUTPUT_FOLDER" | ||
|
||
echo "-- Start $FOLDER_NAME ($(date '+%T')) --" | ||
|
||
TIMEFORMAT=' - Ginkgo tests finished in: %R seconds' | ||
time ginkgo --label-filter="!e2e" --keep-going --timeout=5m --output-dir=/tmp --coverprofile="$WORK_FILE_NAME" --covermode=atomic --cover -r -p "$FOLDER_PATH" || true | ||
|
||
TIMEFORMAT=' - lcov convert finished in: %R seconds' | ||
time gcov2lcov -infile="$WORK_FILE_PATH" -outfile="$OUTPUT_FILE_PATH" || true | ||
|
||
TIMEFORMAT=' - cleanup finished in: %R seconds' | ||
time rm "$WORK_FILE_PATH" || true | ||
|
||
echo "-- Finished $FOLDER_NAME ($(date '+%T')) --" |
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
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 @@ | ||
* text=auto eol=lf |
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
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.