-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from doziestar/feat/auth-test
Feat: Adding test to auth
- Loading branch information
Showing
139 changed files
with
12,693 additions
and
1,741 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,21 @@ | ||
{ | ||
"editor.formatOnSave": true, | ||
"plugins": [ | ||
{ | ||
"type": "add", | ||
"pluginName": "fleet.ai" | ||
}, | ||
{ | ||
"type": "add", | ||
"pluginName": "fleet.go.ai" | ||
}, | ||
{ | ||
"type": "add", | ||
"pluginName": "fleet.python.ai" | ||
}, | ||
{ | ||
"type": "add", | ||
"pluginName": "fleet.rust.ai" | ||
} | ||
] | ||
} |
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,134 @@ | ||
name: Go CI/CD | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.22" | ||
- name: Verify workspace | ||
run: go work sync | ||
- name: Check formatting | ||
run: | | ||
all_formatted=true | ||
for dir in $(go work edit -json | jq -r '.Use[].DiskPath'); do | ||
echo "Checking formatting in $dir" | ||
if [ -n "$(gofmt -s -l $dir)" ]; then | ||
echo "Formatting issues in $dir:" | ||
gofmt -s -l $dir | ||
all_formatted=false | ||
else | ||
echo "No formatting issues in $dir" | ||
fi | ||
done | ||
if [ "$all_formatted" = false ]; then | ||
echo "Formatting errors found. Please run 'go fmt ./...' in each module to fix." | ||
exit 1 | ||
fi | ||
- name: Run go vet | ||
run: | | ||
for dir in $(go work edit -json | jq -r '.Use[].DiskPath'); do | ||
echo "Running go vet in $dir" | ||
go vet ./$dir/... | ||
done | ||
# - name: Run goimports | ||
# run: | | ||
# for dir in $(go work edit -json | jq -r '.Use[].DiskPath'); do | ||
# echo "Running goimports in $dir" | ||
# goimports -l $dir | ||
# done | ||
|
||
# - name: Run gocyclo | ||
# run: | | ||
# for dir in $(go work edit -json | jq -r '.Use[].DiskPath'); do | ||
# echo "Running gocyclo in $dir" | ||
# gocyclo -over 15 $dir | ||
# done | ||
|
||
# - name: Static check | ||
# run: | | ||
# for dir in $(go work edit -json | jq -r '.Use[].DiskPath'); do | ||
# echo "Running staticcheck in $dir" | ||
# staticcheck $dir | ||
# done | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.22" | ||
- name: Run tests | ||
run: | | ||
go work use . | ||
for dir in $(go work edit -json | jq -r '.Use[].DiskPath'); do | ||
echo "Running tests in $dir" | ||
go test -v -race -coverprofile=$dir/coverage.txt -covermode=atomic ./$dir/... | ||
done | ||
- name: Combine coverage | ||
run: | | ||
echo "mode: atomic" > coverage.txt | ||
for dir in $(go work edit -json | jq -r '.Use[].DiskPath'); do | ||
if [ -f $dir/coverage.txt ]; then | ||
tail -n +2 $dir/coverage.txt >> coverage.txt | ||
fi | ||
done | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
file: ./coverage.txt | ||
- name: Upload coverage artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: coverage | ||
path: coverage.txt | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.22" | ||
- name: Build | ||
run: | | ||
for dir in $(go work edit -json | jq -r '.Use[].DiskPath'); do | ||
echo "Building in $dir" | ||
go build -v ./$dir/... | ||
done | ||
deploy-coverage: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Download coverage artifact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: coverage | ||
- name: Generate coverage HTML | ||
run: | | ||
go tool cover -html=coverage.txt -o coverage.html | ||
- name: Deploy to GitHub Pages | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.TOKEN }} | ||
publish_dir: . | ||
publish_branch: gh-pages | ||
keep_files: true | ||
user_name: "github-actions[bot]" | ||
user_email: "github-actions[bot]@users.noreply.github.com" | ||
commit_message: "Deploy coverage report to GitHub Pages" |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,52 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
args: [--allow-multiple-documents] | ||
# - id: check-added-large-files | ||
# args: [--maxkb=1000] | ||
|
||
# - repo: https://github.com/golangci/golangci-lint | ||
# rev: v1.54.2 | ||
# hooks: | ||
# - id: golangci-lint | ||
|
||
- repo: https://github.com/dnephin/pre-commit-golang | ||
rev: v0.5.1 | ||
hooks: | ||
- id: go-fmt | ||
# - id: go-vet | ||
# files: \.go$ | ||
# exclude: ^datavinci/ | ||
- id: go-imports | ||
- id: go-cyclo | ||
# args: [-over=15] | ||
- id: validate-toml | ||
- id: no-go-testing | ||
# - id: go-critic | ||
# args: [--disable=sloppyTypeAssert] | ||
- id: go-unit-tests | ||
- id: go-build | ||
- id: go-mod-tidy | ||
|
||
# - repo: https://github.com/pre-commit/mirrors-prettier | ||
# rev: v3.0.3 | ||
# hooks: | ||
# - id: prettier | ||
# types_or: [javascript, jsx, ts, tsx, json] | ||
# files: ^web/ | ||
|
||
# - repo: https://github.com/pre-commit/mirrors-eslint | ||
# rev: v8.49.0 | ||
# hooks: | ||
# - id: eslint | ||
# files: ^web/.*\.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx in web folder | ||
# types: [file] | ||
# additional_dependencies: | ||
# - eslint@9.6.0 | ||
# - typescript@5.2.2 | ||
# - "@typescript-eslint/parser@6.7.0" | ||
# - "@typescript-eslint/eslint-plugin@6.7.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
Oops, something went wrong.