Skip to content

Commit

Permalink
Merge pull request #79 from gofiber/ci-lint-updates
Browse files Browse the repository at this point in the history
Improve Unit-Tests Coverage and CI Workflows
  • Loading branch information
ReneWerner87 authored Apr 11, 2024
2 parents 94b19de + fe1c286 commit 5c19157
Show file tree
Hide file tree
Showing 23 changed files with 1,025 additions and 382 deletions.
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

0 comments on commit 5c19157

Please sign in to comment.