-
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.
- Loading branch information
Showing
98 changed files
with
12,865 additions
and
8,602 deletions.
There are no files selected for viewing
159 changes: 76 additions & 83 deletions
159
.github/workflows/go.yml → .github/workflows/github-action.yml
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,83 +1,76 @@ | ||
name: Run Tests | ||
on: | ||
push: | ||
branches: ["master"] | ||
pull_request: | ||
branches: ["master"] | ||
permissions: | ||
contents: read | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version-file: go.mod | ||
- uses: golangci/golangci-lint-action@v3 | ||
continue-on-error: true | ||
with: | ||
args: --verbose --disable errcheck | ||
test: | ||
needs: lint | ||
strategy: | ||
max-parallel: 2 | ||
matrix: | ||
os: [macos, ubuntu] | ||
go: ["1.18"] | ||
include: | ||
- os: macos | ||
gopath: /Users/runner/go | ||
gocache: /Users/runner/Library/Caches/go-build | ||
- os: ubuntu | ||
gopath: /home/runner/go | ||
gocache: /home/runner/.cache/go-build | ||
name: ${{ matrix.os }} @ Go ${{ matrix.go }} | ||
runs-on: ${{ matrix.os }}-latest | ||
env: | ||
GO111MODULE: off | ||
GOPATH: ${{ matrix.gopath }}:${{ github.workspace }} | ||
CGO_ENABLED: 1 | ||
WORKDIR: src/github.com/eudore/eudore/ | ||
PACKAGES: github.com/eudore/eudore,github.com/eudore/eudore/middleware | ||
defaults: | ||
run: | ||
working-directory: ${{ env.WORKDIR }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
path: ${{ env.WORKDIR }} | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
- uses: actions/cache@v3 | ||
with: | ||
key: ${{ runner.os }}-go-${{ hashFiles('src/github.com/eudore/eudore/go.mod') }} | ||
restore-keys: ${{ runner.os }}-go- | ||
path: | | ||
${{ matrix.gopath }} | ||
${{ matrix.gocache }} | ||
- name: Run Debug | ||
run: rm -f _example/xxxlogger_test.go | ||
- name: Run Go Get | ||
run: for pkg in $(go list -json _example/*_test.go | jq -r '.XTestImports[]' | grep -E "github|monkey" | grep -v eudore); do go get -v $pkg; done | ||
- name: Run Tests | ||
run: set -o pipefail;go test -v -timeout=1m -race -cover -coverprofile=coverage.out -coverpkg='${{ env.PACKAGES }}' _example/*_test.go | tee output; | ||
- name: Run Notice | ||
if: ${{ strategy.job-index == 0 }} | ||
run: 'echo "::notice::$(tail -3 output | grep "coverage: ")"' | ||
- name: Run Coverage | ||
if: ${{ strategy.job-index == 0 }} | ||
run: go tool cover -html coverage.out -o coverage.html | ||
- uses: actions/upload-artifact@v3 | ||
if: ${{ strategy.job-index == 0 }} | ||
with: | ||
name: Coverage-eudore-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.go }} | ||
path: ${{ env.WORKDIR }}/coverage.html | ||
- uses: codecov/codecov-action@v3 | ||
if: ${{ strategy.job-index == 0xf }} | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: ${{ env.WORKDIR }}/coverage.out | ||
flags: ${{ matrix.os }},go-${{ matrix.go }} | ||
verbose: true | ||
name: Run Tests | ||
on: | ||
push: | ||
branches: ["master"] | ||
pull_request: | ||
branches: ["master"] | ||
permissions: | ||
contents: read | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version-file: go.mod | ||
- uses: golangci/golangci-lint-action@v3 | ||
continue-on-error: true | ||
with: | ||
args: --verbose -c .github/workflows/golang-lint.yml | ||
test: | ||
strategy: | ||
max-parallel: 2 | ||
matrix: | ||
os: [macos, ubuntu] | ||
go: ["1.18"] | ||
include: | ||
- os: macos | ||
gopath: /Users/runner/go | ||
gocache: /Users/runner/Library/Caches/go-build | ||
- os: ubuntu | ||
gopath: /home/runner/go | ||
gocache: /home/runner/.cache/go-build | ||
name: ${{ matrix.os }} @ Go ${{ matrix.go }} | ||
runs-on: ${{ matrix.os }}-latest | ||
env: | ||
GO111MODULE: off | ||
GOPATH: ${{ matrix.gopath }}:${{ github.workspace }} | ||
CGO_ENABLED: 1 | ||
WORKDIR: src/github.com/eudore/eudore/ | ||
PACKAGES: github.com/eudore/eudore,github.com/eudore/eudore/middleware | ||
defaults: | ||
run: | ||
working-directory: ${{ env.WORKDIR }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
path: ${{ env.WORKDIR }} | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
- uses: actions/cache@v3 | ||
with: | ||
key: ${{ runner.os }}-go-${{ hashFiles('src/github.com/eudore/eudore/go.mod') }} | ||
restore-keys: ${{ runner.os }}-go- | ||
path: | | ||
${{ matrix.gopath }} | ||
${{ matrix.gocache }} | ||
- name: Run Debug | ||
run: rm -f _example/logger_test.go | ||
- name: Run Go Get | ||
run: for pkg in $(go list -json _example/*_test.go | jq -r '.XTestImports[]' | grep -E "github|monkey" | grep -v eudore); do go get -v $pkg; done | ||
- name: Run Tests | ||
run: go test -v -timeout=1m -race -cover -coverprofile=coverage.out -coverpkg='${{ env.PACKAGES }}' _example/*_test.go | tee output | ||
- name: Run Notice | ||
if: ${{ strategy.job-index == 0 }} | ||
run: | | ||
'echo "::notice::$(tail -3 output | grep "coverage: ")"' | ||
- name: Run Coverage | ||
if: ${{ strategy.job-index == 0 }} | ||
run: go tool cover -html coverage.out -o coverage.html | ||
- uses: actions/upload-artifact@v3 | ||
if: ${{ strategy.job-index == 0 }} | ||
with: | ||
name: Coverage-eudore-${{ github.ref_name }}-${{ matrix.os }}-${{ matrix.go }} | ||
path: ${{ env.WORKDIR }}/coverage.html |
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,59 @@ | ||
run: | ||
timeout: 2m | ||
skip-dirs: | ||
- database | ||
- database2 | ||
skip-files: | ||
- protobuf.go | ||
- middleware/admin.go | ||
- middleware/dump.go | ||
issues: | ||
max-same-issues: 10 | ||
linters: | ||
enable-all: true | ||
disable: | ||
- golint | ||
- deadcode | ||
- nosnakecase | ||
- ifshort | ||
- scopelint | ||
- maligned | ||
- structcheck | ||
- exhaustivestruct | ||
- varcheck | ||
- interfacer | ||
- errcheck | ||
- varnamelen | ||
- wrapcheck | ||
- nlreturn | ||
- ireturn | ||
- interfacebloat | ||
- gochecknoglobals | ||
- nonamedreturns | ||
- forcetypeassert | ||
- exhaustruct | ||
- lll | ||
- gosec | ||
- wsl | ||
- containedctx | ||
- exhaustive | ||
- contextcheck | ||
- tagliatelle | ||
- gomnd | ||
- goerr113 | ||
- nestif | ||
- gocognit | ||
- tagalign | ||
linters-settings: | ||
gocyclo: | ||
min-complexity: 15 | ||
cyclop: | ||
max-complexity: 15 | ||
depguard: | ||
rules: | ||
main: | ||
allow: | ||
- $gostd | ||
- github.com/eudore/eudore | ||
funlen: | ||
statements: 50 |
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 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.