diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 04cd03d..cd8106e 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -2,95 +2,147 @@ name: Go on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] jobs: - build: name: Build runs-on: ubuntu-latest steps: - - - name: Set up Go 1.x - uses: actions/setup-go@v2 - with: - go-version: ^1.17 - id: go - - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - - name: Build - run: go build -race -v ./... - - - name: Test - run: go test -race -cover -coverprofile ./coverage.out ./... - - - name: Coverage - id: coverage - run: | - go tool cover -func ./coverage.out | tee -a coverage.txt - echo "COVERAGE_CONTENT<> $GITHUB_ENV - cat coverage.txt >> $GITHUB_ENV - echo "EOF" >> $GITHUB_ENV - - - - uses: actions/github-script@v4 - if: github.event_name == 'pull_request' - env: - COVERAGE_CONTENT: "${{ env.COVERAGE_CONTENT }}" - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const output = `Code Coverage\n - \`\`\`\n - ${process.env.COVERAGE_CONTENT} - \`\`\` - - *Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Workflow: \`${{ github.workflow }}\`*`; - - const response = await github.issues.listComments({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - }); - - var comments = response.data; - - console.log(comments); - - if (comments.length > 0) { - comments = comments.filter(comment => comment.body.includes('Code Coverage') && comment.user.type === 'Bot'); - } - - if (comments.length > 0) { - const comment = comments.shift(); - - github.issues.updateComment({ - issue_number: context.issue.number, + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: ^1.17 + id: go + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Build + run: go build -race -v ./... + + - name: Test + run: go test -race -cover -coverprofile ./coverage.out ./... + + - name: Coverage + id: coverage + run: | + go tool cover -func ./coverage.out | tee -a coverage.txt + echo "COVERAGE_CONTENT<> $GITHUB_ENV + cat coverage.txt >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + + - uses: actions/github-script@v4 + if: github.event_name == 'pull_request' + env: + COVERAGE_CONTENT: "${{ env.COVERAGE_CONTENT }}" + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const output = `Code Coverage\n + \`\`\`\n + ${process.env.COVERAGE_CONTENT} + \`\`\` + + *Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Workflow: \`${{ github.workflow }}\`*`; + + const response = await github.issues.listComments({ owner: context.repo.owner, repo: context.repo.repo, - comment_id: comment.id, - body: output - }) - } else { - github.issues.createComment({ issue_number: context.issue.number, + }); + + var comments = response.data; + + console.log(comments); + + if (comments.length > 0) { + comments = comments.filter(comment => comment.body.includes('Code Coverage') && comment.user.type === 'Bot'); + } + + if (comments.length > 0) { + const comment = comments.shift(); + + github.issues.updateComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: comment.id, + body: output + }) + } else { + github.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: output + }) + } + + - name: Benchmark + id: benchmark + run: | + go test -benchmem -bench . | tee -a benchmark.txt + echo "BENCHMARK_CONTENT<> $GITHUB_ENV + cat benchmark.txt >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + + - uses: actions/github-script@v4 + if: github.event_name == 'pull_request' + env: + BENCHMARK_CONTENT: "${{ env.BENCHMARK_CONTENT }}" + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const output = `Benchmark\n + \`\`\`\n + ${process.env.BENCHMARK_CONTENT} + \`\`\` + + *Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Workflow: \`${{ github.workflow }}\`*`; + + const response = await github.issues.listComments({ owner: context.repo.owner, repo: context.repo.repo, - body: output - }) - } - - - name: Run golangci-lint - uses: golangci/golangci-lint-action@v2 - with: - version: v1.41.1 - skip-pkg-cache: true - - - name: Coveralls - uses: shogo82148/actions-goveralls@v1 - with: - path-to-profile: coverage.out + issue_number: context.issue.number, + }); + + var comments = response.data; + + console.log(comments); + + if (comments.length > 0) { + comments = comments.filter(comment => comment.body.includes('Benchmark') && comment.user.type === 'Bot'); + } + + if (comments.length > 0) { + const comment = comments.shift(); + + github.issues.updateComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: comment.id, + body: output + }) + } else { + github.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: output + }) + } + + - name: Run golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + version: v1.55.2 + skip-pkg-cache: true + + - name: Coveralls + uses: shogo82148/actions-goveralls@v1 + with: + path-to-profile: coverage.out diff --git a/.vscode/configurationCache.log b/.vscode/configurationCache.log new file mode 100644 index 0000000..e8ff273 --- /dev/null +++ b/.vscode/configurationCache.log @@ -0,0 +1 @@ +{"buildTargets":[".PHONY","all","clean","cover","coverage.out","lint","release","test","travis"],"launchTargets":[],"customConfigurationProvider":{"workspaceBrowse":{"browsePath":[],"compilerArgs":[]},"fileIndex":[]}} \ No newline at end of file diff --git a/.vscode/dryrun.log b/.vscode/dryrun.log new file mode 100644 index 0000000..00fb8fe --- /dev/null +++ b/.vscode/dryrun.log @@ -0,0 +1,13 @@ +make --dry-run --always-make --keep-going --print-directory +make: Entering directory `/Users/euskadi31/Projects/Github/hyperscale-stack/inputfilter' +echo "Release v" +git pull +git checkout master +git pull +git checkout develop +git flow release start +git flow release finish -p -m "Release v" +git checkout develop +echo "Release v finished." +make: Leaving directory `/Users/euskadi31/Projects/Github/hyperscale-stack/inputfilter' + diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..b674bd0 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "makefile.extensionOutputFolder": "./.vscode" +} diff --git a/.vscode/targets.log b/.vscode/targets.log new file mode 100644 index 0000000..ffa0407 --- /dev/null +++ b/.vscode/targets.log @@ -0,0 +1,389 @@ +make all --print-data-base --no-builtin-variables --no-builtin-rules --question +# GNU Make 3.81 +# Copyright (C) 2006 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. +# There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# This program built for i386-apple-darwin11.3.0 + + +# Make data base, printed on Wed Jun 15 23:30:51 2022 + +# Variables + +# automatic + ./coverage.out + @rm ./coverage.out.tmp + + +# files hash-table stats: +# Load=16/1024=2%, Rehash=0, Collisions=2/43=5% +# VPATH Search Paths + +# No `vpath' search paths. + +# No general (`VPATH' variable) search path. + +# # of strings in strcache: 1 +# # of strcache buffers: 1 +# strcache size: total = 4096 / max = 4096 / min = 4096 / avg = 4096 +# strcache free: total = 4087 / max = 4087 / min = 4087 / avg = 4087 + +# Finished Make data base on Wed Jun 15 23:30:51 2022 + + diff --git a/cmd/demo/main.go b/cmd/demo/main.go new file mode 100644 index 0000000..7905807 --- /dev/null +++ b/cmd/demo/main.go @@ -0,0 +1,5 @@ +package main + +func main() { + +}