Skip to content

Commit

Permalink
More changes
Browse files Browse the repository at this point in the history
  • Loading branch information
benc-uk committed Dec 20, 2023
1 parent 3e0444f commit fec1855
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 542 deletions.
10 changes: 1 addition & 9 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,7 @@ jobs:
make lint
- name: "Run all unit tests"
run: make test-reports

# Very optional - upload of test results
- name: "Upload test reports to Azure"
if: ${{ success() || failure() }}
run: |
az storage blob upload-batch --account-name $STORAGE_ACCT_NAME --account-key "${{ secrets.STORAGE_KEY }}" \
--source ./output --destination \$web/${{ github.run_id }} --no-progress > /dev/null
echo -e "📜🌍 Test reports uploaded and viewable here - https://$STORAGE_ACCT_NAME.z6.web.core.windows.net/${{ github.run_id }}/"
run: make test

# ===== Build container images ======
build-images:
Expand Down
30 changes: 13 additions & 17 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
# =================================================================
# An opinionated config for linting Go code with golangci-lint
# See https://golangci-lint.run/usage/linters
# See https://golangci-lint.run/usage/linters
# =================================================================

linters:
enable:
- revive # Replacement for golint
- gofmt # Runs gofmt as part of the linter
#- gosec # Find security issues
- wsl # Whitespace style enforcer, a matter of taste
- stylecheck # A few Go style rules
- nosnakecase # We are not writing Python here
- misspell # Find misspelled words
- cyclop # Find cyclomatic complexity
- gocyclo # Also find cyclomatic complexity
- bodyclose # Check for HTTP body close errors
- nilerr # Find bad nil/err handling
- nilnil # Also find bad nil/err handling
#- tagliatelle # Find badly named struct tags
#- gomnd # Find magic numbers, enable at your peril
- revive # Replacement for golint
- gofmt # Runs gofmt as part of the linter
- wsl # Whitespace style enforcer, a matter of taste
- stylecheck # A few Go style rules
- misspell # Find misspelled words
- cyclop # Find cyclomatic complexity
- gocyclo # Also find cyclomatic complexity
- bodyclose # Check for HTTP body close errors
- nilerr # Find bad nil/err handling
- nilnil # Also find bad nil/err handling

linters-settings:
misspell:
Expand All @@ -33,7 +29,7 @@ linters-settings:
yaml: goCamel

revive:
severity: error
severity: error
enable-all-rules: false
confidence: 0.5
rules:
Expand All @@ -42,4 +38,4 @@ linters-settings:
# And https://golangci-lint.run/usage/linters/#revive
- name: line-length-limit
severity: error
arguments: [160]
arguments: [160]
10 changes: 0 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,6 @@ test: ## 🎯 Unit tests for services and snapshot tests for SPA frontend
go test -v -count=1 ./$(SERVICE_DIR)/...
@cd $(FRONTEND_DIR); NODE_ENV=test npm run test -- --ci

test-reports: $(FRONTEND_DIR)/node_modules ## 📜 Unit tests with coverage and test reports (deprecated)
@rm -rf $(OUTPUT_DIR) && mkdir -p $(OUTPUT_DIR)
@which gotestsum || go install gotest.tools/gotestsum
gotestsum --junitfile $(OUTPUT_DIR)/unit-tests.xml ./$(SERVICE_DIR)/... --coverprofile $(OUTPUT_DIR)/coverage
cd $(FRONTEND_DIR); NODE_ENV=test npm run test -- --ci
./$(FRONTEND_DIR)/node_modules/.bin/xunit-viewer -r $(OUTPUT_DIR)/unit-tests.xml -o $(OUTPUT_DIR)/unit-tests.html
./$(FRONTEND_DIR)/node_modules/.bin/xunit-viewer -r $(OUTPUT_DIR)/unit-tests-frontend.xml -o $(OUTPUT_DIR)/unit-tests-frontend.html
go tool cover -html=$(OUTPUT_DIR)/coverage -o $(OUTPUT_DIR)/cover.html
cp testing/reports.html $(OUTPUT_DIR)/index.html

bundle: $(FRONTEND_DIR)/node_modules ## 💻 Build and bundle the frontend Vue SPA
cd $(FRONTEND_DIR); npm run build
cd $(SERVICE_DIR)/frontend-host; go build
Expand Down
2 changes: 1 addition & 1 deletion cmd/cart/impl/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func makeID(length int) string {
id := ""
possible := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"

rand.Seed(time.Now().UnixNano())
rand.New(rand.NewSource(time.Now().UnixNano()))

for i := 0; i < length; i++ {
id += string(possible[rand.Intn(len(possible)-1)])
Expand Down
Loading

0 comments on commit fec1855

Please sign in to comment.