-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: refactor tests to not use gnomock (#36)
* feat: refactor test to not use gnomock * chore: set parallel to all tests * chore: add mongo serice to tests
- Loading branch information
Showing
46 changed files
with
670 additions
and
938 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
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 |
---|---|---|
|
@@ -26,62 +26,29 @@ jobs: | |
token: "${{ secrets.ACCESS_TOKEN }}" | ||
ref: "main" | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Config Git User | ||
run: | | ||
git config --local user.email "$GIT_USER_EMAIL" | ||
git config --local user.name "$GIT_USER_NAME" | ||
git config --local pull.ff only | ||
- id: cz | ||
name: Create bump and changelog | ||
run: | | ||
python -m pip install -U commitizen | ||
cz bump --changelog --yes | ||
export REV=`cz version --project` | ||
echo "version=$REV" >> $GITHUB_OUTPUT | ||
- name: Push changes | ||
uses: Woile/github-push-action@master | ||
uses: commitizen-tools/[email protected] | ||
with: | ||
github_token: ${{ secrets.ACCESS_TOKEN }} | ||
tags: "true" | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: "main" | ||
git_name: ${{ secrets.GIT_NAME }} | ||
git_email: ${{ secrets.GIT_EMAIL }} | ||
changelog_increment_filename: body.md | ||
|
||
- name: Print Version | ||
run: echo "Bumped to version ${{ steps.cz.outputs.version }}" | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
name: "Release service" | ||
needs: | ||
- bump_version | ||
steps: | ||
- name: Check out | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
token: "${{ secrets.ACCESS_TOKEN }}" | ||
ref: "main" | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.21.x | ||
run: echo "Bumped to version ${{ env.REVISION }}" | ||
|
||
- name: Config private packages | ||
run: git config --global url.https://${{ secrets.ACCESS_TOKEN }}@github.com/Drafteame.insteadOf https://github.com/Drafteame | ||
- name: Trim body to 125000 characters | ||
run: | | ||
if [ $(wc -c < body.md) -gt 125000 ]; then | ||
head -c 125000 body.md > body.md | ||
fi | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v6 | ||
- name: Release | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_RELEASE_WEBHOOK }} | ||
body_path: "body.md" | ||
tag_name: ${{ env.REVISION }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
make_latest: "true" |
This file was deleted.
Oops, something went wrong.
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,10 @@ | ||
#!/usr/bin/env sh | ||
|
||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
sh ./.husky/commit-msg-scripts/commitizen.sh | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "[husky] commit validation error" | ||
exit 1 | ||
fi |
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,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [ "$GIT_NV" = "1" ]; then | ||
echo "[commitizen] skipping commit message check" | ||
exit 0 | ||
fi | ||
|
||
echo "[commitizen] checking commit message with commitizen" | ||
|
||
cz check --commit-msg-file .git/COMMIT_EDITMSG | ||
|
||
# shellcheck disable=SC2181 | ||
if [ $? -ne 0 ]; then | ||
echo "[commitizen] found issues in commit message" | ||
exit 1 | ||
fi | ||
|
||
exit 0 |
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,16 @@ | ||
#!/usr/bin/env sh | ||
|
||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
MOD_VERSION="1.21" | ||
|
||
sh ./.husky/pre-commit-scripts/go-mod-tidy.sh && \ | ||
sh ./.husky/pre-commit-scripts/force-mod-version.sh "$MOD_VERSION" && \ | ||
sh ./.husky/pre-commit-scripts/goimports-reviser.sh && \ | ||
sh ./.husky/pre-commit-scripts/go-vet.sh && \ | ||
sh ./.husky/pre-commit-scripts/revive.sh | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "[husky] commit validation error" | ||
exit 1 | ||
fi |
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,55 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [ "$GIT_NV" = "1" ]; then | ||
echo "[force-mod-version] skipping go.mod version check" | ||
exit 0 | ||
fi | ||
|
||
echo "[force-mod-version] checking go.mod files" | ||
|
||
set -e -o pipefail | ||
|
||
version="1.21" | ||
if [ $# -gt 0 ]; then | ||
version="$1" | ||
fi | ||
|
||
|
||
function sed_replace() { | ||
local os | ||
os=$(uname) | ||
|
||
if [ "$os" = "Darwin" ]; then | ||
sed -i '' "$1" "$2" | ||
else | ||
sed -i "$1" "$2" | ||
fi | ||
} | ||
|
||
function update_go_version() { | ||
local file="$1" | ||
|
||
if grep -q "^toolchain go" "$file"; then | ||
echo "[force-mod-version] removing gotoolchain version from $file" | ||
sed_replace '/^toolchain go/d' "$file" | ||
fi | ||
|
||
if current_version=$(grep "^go [0-9]" "$file" | awk '{print $2}'); then | ||
if [ "$current_version" != "$version" ]; then | ||
echo "[force-mod-version] updating go version from $current_version to $version in $file" | ||
pattern="s|^go .*|go $version|g" | ||
sed_replace "$pattern" "$file" | ||
fi | ||
fi | ||
} | ||
|
||
# Find and process go.mod files | ||
go_mod_files=$(fd 'go.mod' --glob) | ||
if [ -n "$go_mod_files" ]; then | ||
for file in $go_mod_files; do | ||
update_go_version "$file" | ||
done | ||
fi | ||
|
||
git add --all | ||
exit 0 |
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,38 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [ "$GIT_NV" = "1" ]; then | ||
echo "[go-mod-tidy] skipping go.mod files check" | ||
exit 0 | ||
fi | ||
|
||
echo "[go-mod-tidy] checking go.mod files" | ||
|
||
function get_base_dir() { | ||
local dir | ||
|
||
local file="$1" | ||
dir=$(dirname "$file") | ||
|
||
echo "$dir" | ||
} | ||
|
||
# Find and process go.mod files | ||
go_mod_files=$(fd 'go.mod' --glob) | ||
if [ -n "$go_mod_files" ]; then | ||
for file in $go_mod_files; do | ||
echo "[go-mod-tidy] tidying $file" | ||
|
||
cd "$(get_base_dir "$file")" && go mod tidy -v | ||
|
||
# shellcheck disable=SC2181 | ||
if [ $? -ne 0 ]; then | ||
exit 2 | ||
fi | ||
|
||
# shellcheck disable=SC2164 | ||
cd - > /dev/null | ||
done | ||
fi | ||
|
||
git add --all | ||
exit 0 |
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,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [ "$GIT_NV" = "1" ]; then | ||
echo "[go-vet] skipping go files check" | ||
exit 0 | ||
fi | ||
|
||
echo "[go-vet] checking go files" | ||
|
||
go vet ./... | ||
|
||
# shellcheck disable=SC2181 | ||
if [ $? -ne 0 ]; then | ||
echo "[go-vet] found issues in go files" | ||
exit 1 | ||
fi | ||
|
||
exit 0 |
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,19 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [ "$GIT_NV" = "1" ]; then | ||
echo "[goimports-reviser] skipping goimports formatting" | ||
exit 0 | ||
fi | ||
|
||
echo "[goimports-reviser] formatting code" | ||
|
||
goimports-reviser -format ./... | ||
|
||
# shellcheck disable=SC2181 | ||
if [ $? -ne 0 ]; then | ||
echo "[goimports-reviser] found issues formatting go files" | ||
exit 1 | ||
fi | ||
|
||
git add --all | ||
exit 0 |
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,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [ "$GIT_NV" = "1" ]; then | ||
echo "[revive] skipping go files check" | ||
exit 0 | ||
fi | ||
|
||
echo "[revive] checking go files" | ||
|
||
revive -config=revive.toml -formatter=friendly ./... | ||
|
||
# shellcheck disable=SC2181 | ||
if [ $? -ne 0 ]; then | ||
echo "[revive] found issues in go files" | ||
exit 1 | ||
fi | ||
|
||
exit 0 |
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,2 +1,17 @@ | ||
inpackage: False | ||
dry-run: False | ||
all: true | ||
dir: '{{.InterfaceDir}}/mocks' | ||
outpkg: mocks | ||
recursive: false | ||
with-expecter: true | ||
|
||
exclude: | ||
- node_modules | ||
- vendor | ||
- .git | ||
- .husky | ||
- .github | ||
- .idea | ||
- .vscode | ||
|
||
packages: | ||
github.com/Drafteame/mgorepo/logger: {} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.