Skip to content

Commit

Permalink
~ stay withoit apis
Browse files Browse the repository at this point in the history
  • Loading branch information
m0zgen committed Nov 25, 2023
2 parents b61035f + 270dc17 commit a3a1f62
Show file tree
Hide file tree
Showing 190 changed files with 904,186 additions and 11,800 deletions.
66 changes: 66 additions & 0 deletions .devcontainer/devcontainer.json
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"
}
27 changes: 27 additions & 0 deletions .devcontainer/scripts/postStart.sh
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
39 changes: 39 additions & 0 deletions .devcontainer/scripts/runItOnGo.sh
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')) --"
6 changes: 4 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
bin
dist
site
docs
node_modules
.git
.idea
Expand All @@ -11,4 +10,7 @@ node_modules
*.md
LICENSE
vendor
e2e/
e2e/
.devcontainer/
coverage.txt
coverage/
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
16 changes: 10 additions & 6 deletions .github/workflows/close_stale.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: 'Close stale issues and PRs'
name: Close stale issues and PRs

on:
schedule:
- cron: '0 4 * * *'
- cron: "0 4 * * *"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
stale:
Expand All @@ -13,10 +17,10 @@ jobs:
steps:
- uses: actions/stale@v8
with:
stale-issue-message: 'This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.'
close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.'
close-pr-message: 'This PR was closed because it has been stalled for 10 days with no activity.'
stale-issue-message: "This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days."
stale-pr-message: "This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days."
close-issue-message: "This issue was closed because it has been stalled for 5 days with no activity."
close-pr-message: "This PR was closed because it has been stalled for 10 days with no activity."
days-before-issue-stale: 90
days-before-pr-stale: 45
days-before-issue-close: 5
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
name: "CodeQL"
name: CodeQL

on:
push:
branches:
branches:
- main
pull_request:
branches:
branches:
- main
schedule:
- cron: '33 15 * * 1'
- cron: "33 15 * * 1"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

# Use Golang cache
- name: Setup Golang
uses: actions/setup-go@v4
with:
go-version-file: go.mod

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
Expand Down
37 changes: 0 additions & 37 deletions .github/workflows/delete-workflow-runs.yml

This file was deleted.

Loading

0 comments on commit a3a1f62

Please sign in to comment.