Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Unit-Tests Coverage and CI Workflows #79

Merged
merged 2 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 37 additions & 40 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,50 @@ name: Benchmark
on:
push:
branches:
- "master"
- "main"
paths-ignore:
- "**.md"
- LICENSE
- ".github/ISSUE_TEMPLATE/*.yml"
- ".github/dependabot.yml"
- master
- main
paths:
- "**"
- "!docs/**"
- "!**.md"
pull_request:
branches:
- "*"
paths-ignore:
- "**.md"
- LICENSE
- ".github/ISSUE_TEMPLATE/*.yml"
- ".github/dependabot.yml"
paths:
- "**"
- "!docs/**"
- "!**.md"

jobs:
Compare:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.20.x
- name: Fetch Repository
uses: actions/checkout@v4

- name: Fetch Repository
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
# NOTE: Keep this in sync with the version from go.mod
go-version: "1.21.x"

- name: Run Benchmark
run: set -o pipefail; go test ./... -benchmem -run=^$ -bench . | tee output.txt
- name: Run Benchmark
run: set -o pipefail; go test ./... -benchmem -run=^$ -bench . | tee output.txt

- name: Get Previous Benchmark Results
uses: actions/cache@v4
with:
path: ./cache
key: ${{ runner.os }}-benchmark
- name: Get Previous Benchmark Results
uses: actions/cache@v4
with:
path: ./cache
key: ${{ runner.os }}-benchmark

- name: Save Benchmark Results
uses: benchmark-action/github-action-benchmark@v1
with:
tool: 'go'
output-file-path: output.txt
github-token: ${{ secrets.BENCHMARK_TOKEN }}
benchmark-data-dir-path: 'benchmarks'
fail-on-alert: true
comment-on-alert: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
# Enable Job Summary for PRs - deactivated because of issues
#summary-always: ${{ github.event_name != 'push' && github.event_name != 'workflow_dispatch' }}
auto-push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
save-data-file: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
- name: Save Benchmark Results
uses: benchmark-action/github-action-benchmark@v1
with:
tool: 'go'
output-file-path: output.txt
github-token: ${{ secrets.BENCHMARK_TOKEN }}
benchmark-data-dir-path: 'benchmarks'
fail-on-alert: true
comment-on-alert: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
# Enable Job Summary for PRs - deactivated because of issues
#summary-always: ${{ github.event_name != 'push' && github.event_name != 'workflow_dispatch' }}
auto-push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
save-data-file: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
53 changes: 32 additions & 21 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,43 @@
name: Golangci Lint Check
name: golangci-lint

on:
push:
branches:
- "master"
- "main"
paths-ignore:
- "**.md"
- LICENSE
- ".github/ISSUE_TEMPLATE/*.yml"
- ".github/dependabot.yml"
- master
- main
paths:
- "**"
- "!docs/**"
- "!**.md"
pull_request:
branches:
- "*"
paths-ignore:
- "**.md"
- LICENSE
- ".github/ISSUE_TEMPLATE/*.yml"
- ".github/dependabot.yml"
paths:
- "**"
- "!docs/**"
- "!**.md"

permissions:
# Required: allow read access to the content for analysis.
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
pull-requests: read
# Optional: Allow write access to checks to allow the action to annotate code in the PR.
checks: write

jobs:
Golint:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- name: Fetch Repository
uses: actions/checkout@v4
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
# NOTE: Keep this in sync with the version from go.mod
go-version: "1.21.x"
cache: false

- name: Run Golint
uses: reviewdog/action-golangci-lint@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
golangci_lint_flags: "--tests=false"
# NOTE: Keep this in sync with the version from .golangci.yml
version: v1.57.1
42 changes: 0 additions & 42 deletions .github/workflows/security.yml

This file was deleted.

25 changes: 18 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
Build:
strategy:
matrix:
go-version: [1.20.x, 1.21.x, 1.22.x]
platform: [ubuntu-latest, windows-latest, macos-latest]
go-version: [1.21.x, 1.22.x]
platform: [ubuntu-latest, windows-latest, macos-latest, macos-14]
runs-on: ${{ matrix.platform }}
steps:
- name: Fetch Repository
Expand All @@ -30,9 +30,20 @@ jobs:
with:
go-version: ${{ matrix.go-version }}

- name: Run Test
uses: nick-fields/retry@v3
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest

- name: Test
run: gotestsum -f testname -- ./... -race -count=1 -shuffle=on

- name: Test
run: gotestsum -f testname -- ./... -race -count=1 -coverprofile=coverage.txt -covermode=atomic -shuffle=on

- name: Upload coverage reports to Codecov
if: ${{ matrix.platform == 'ubuntu-latest' && matrix.go-version == '1.22.x' }}
uses: codecov/codecov-action@v4.1.1
with:
max_attempts: 3
timeout_minutes: 15
command: go test ./... -v -race -count=1
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
flags: unittests
slug: gofiber/utils
38 changes: 0 additions & 38 deletions .github/workflows/vulncheck.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
coverage.html

# IDE files
.vscode
Expand Down
Loading
Loading