From 8761d948ba5f492ecc40c060298f7db04fecbd9e Mon Sep 17 00:00:00 2001 From: Juan Calderon-Perez <835733+gaby@users.noreply.github.com> Date: Sat, 2 Sep 2023 01:41:54 -0400 Subject: [PATCH] Rollback changes to go.mod file (#2614) * Rollback changes to go.mod file * Format workflow files with prettier, use go1.20 for go.mod file --- .github/workflows/auto-labeler.yml | 26 ++++---- .github/workflows/benchmark.yml | 70 +++++++++++---------- .github/workflows/codeql-analysis.yml | 88 +++++++++++++-------------- .github/workflows/linter.yml | 5 +- .github/workflows/release-drafter.yml | 40 ++++++------ .github/workflows/sync-docs.yml | 12 ++-- .github/workflows/test.yml | 39 ++++++------ .github/workflows/vulncheck.yml | 53 ++++++++-------- go.mod | 2 +- 9 files changed, 175 insertions(+), 160 deletions(-) diff --git a/.github/workflows/auto-labeler.yml b/.github/workflows/auto-labeler.yml index ef7299117e..3a18ed8aaa 100644 --- a/.github/workflows/auto-labeler.yml +++ b/.github/workflows/auto-labeler.yml @@ -1,21 +1,23 @@ name: Auto labeler + on: - issues: - types: [ opened, edited, milestoned ] - pull_request_target: - types: [ opened ] + issues: + types: [opened, edited, milestoned] + pull_request_target: + types: [opened] permissions: contents: read issues: write pull-requests: write statuses: write checks: write + jobs: - labeler: - runs-on: ubuntu-latest - steps: - - name: Check Labels - id: labeler - uses: fuxingloh/multi-labeler@v2 - with: - github-token: ${{secrets.GITHUB_TOKEN}} + labeler: + runs-on: ubuntu-latest + steps: + - name: Check Labels + id: labeler + uses: fuxingloh/multi-labeler@v2 + with: + github-token: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index add4ed5d28..bfe625a86e 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -4,42 +4,48 @@ on: - master - main paths: - - '**' - - '!docs/**' - - '!**.md' + - "**" + - "!docs/**" + - "!**.md" pull_request: paths: - - '**' - - '!docs/**' - - '!**.md' + - "**" + - "!docs/**" + - "!**.md" + name: Benchmark jobs: Compare: runs-on: ubuntu-latest steps: - - name: Install Go - uses: actions/setup-go@v4 - with: - go-version: 1.21.x - - name: Fetch Repository - uses: actions/checkout@v3 - - name: Run Benchmark - run: set -o pipefail; go test ./... -benchmem -run=^$ -bench . | tee output.txt - - name: Get Previous Benchmark Results - uses: actions/cache@v3 - with: - path: ./cache - key: ${{ runner.os }}-benchmark - - name: Save Benchmark Results - uses: benchmark-action/github-action-benchmark@v1.16.2 - 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: Fetch Repository + uses: actions/checkout@v3 + + - name: Install Go + uses: actions/setup-go@v4 + with: + # NOTE: Keep this in sync with the version from go.mod + go-version: "1.20.x" + + - name: Run Benchmark + run: set -o pipefail; go test ./... -benchmem -run=^$ -bench . | tee output.txt + + - name: Get Previous Benchmark Results + uses: actions/cache@v3 + with: + path: ./cache + key: ${{ runner.os }}-benchmark + + - name: Save Benchmark Results + uses: benchmark-action/github-action-benchmark@v1.16.2 + 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' }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b2a35a1ac6..d48c53bff5 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -6,16 +6,16 @@ on: - master - main paths: - - '**' - - '!docs/**' - - '!**.md' + - "**" + - "!docs/**" + - "!**.md" pull_request: paths: - - '**' - - '!docs/**' - - '!**.md' + - "**" + - "!docs/**" + - "!**.md" schedule: - - cron: '0 3 * * 6' + - cron: "0 3 * * 6" jobs: analyse: @@ -23,40 +23,40 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - # We must fetch at least the immediate parents so that if this is - # a pull request then we can checkout the head. - fetch-depth: 2 - - # If this run was triggered by a pull request event, then checkout - # the head of the pull request instead of the merge commit. - - run: git checkout HEAD^2 - if: ${{ github.event_name == 'pull_request' }} - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - # Override language selection by uncommenting this and choosing your languages - with: - languages: go - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + - name: Checkout repository + uses: actions/checkout@v3 + with: + # We must fetch at least the immediate parents so that if this is + # a pull request then we can checkout the head. + fetch-depth: 2 + + # If this run was triggered by a pull request event, then checkout + # the head of the pull request instead of the merge commit. + - run: git checkout HEAD^2 + if: ${{ github.event_name == 'pull_request' }} + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + # Override language selection by uncommenting this and choosing your languages + with: + languages: go + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 5eccb9efa4..f9a7d0e3f0 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -9,16 +9,19 @@ on: pull_request: permissions: contents: read + jobs: golangci: name: lint runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 with: # NOTE: Keep this in sync with the version from go.mod - go-version: 1.21.x + go-version: "1.20.x" + - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index f4a5cea982..cedaab432f 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -1,26 +1,26 @@ name: Release Drafter on: - push: - # branches to consider in the event; optional, defaults to all - branches: - - master - - main + push: + # branches to consider in the event; optional, defaults to all + branches: + - master + - main jobs: - update_release_draft: - runs-on: ubuntu-latest - steps: - # (Optional) GitHub Enterprise requires GHE_HOST variable set - #- name: Set GHE_HOST - # run: | - # echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV + update_release_draft: + runs-on: ubuntu-latest + steps: + # (Optional) GitHub Enterprise requires GHE_HOST variable set + #- name: Set GHE_HOST + # run: | + # echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV - # Drafts your next Release notes as Pull Requests are merged into "master" - - uses: release-drafter/release-drafter@v5 - # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml - # with: - # config-name: my-config.yml - # disable-autolabeler: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Drafts your next Release notes as Pull Requests are merged into "master" + - uses: release-drafter/release-drafter@v5 + # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml + # with: + # config-name: my-config.yml + # disable-autolabeler: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/sync-docs.yml b/.github/workflows/sync-docs.yml index c7f895de6a..c662956754 100644 --- a/.github/workflows/sync-docs.yml +++ b/.github/workflows/sync-docs.yml @@ -1,4 +1,4 @@ -name: 'Sync docs' +name: "Sync docs" on: push: @@ -6,9 +6,9 @@ on: - master - main paths: - - 'docs/**' + - "docs/**" release: - types: [ published ] + types: [published] jobs: sync-docs: @@ -19,13 +19,11 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha }} fetch-depth: 2 + - name: Setup Node.js environment uses: actions/setup-node@v3 with: - node-version: '18' - - - name: Install JQ - run: sudo apt-get install jq + node-version: "18" - name: Sync docs run: ./.github/scripts/sync_docs.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7efb0bddc5..5ad7a7c20b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,14 +4,15 @@ on: - master - main paths: - - '**' - - '!docs/**' - - '!**.md' + - "**" + - "!docs/**" + - "!**.md" pull_request: paths: - - '**' - - '!docs/**' - - '!**.md' + - "**" + - "!docs/**" + - "!**.md" + name: Test jobs: Build: @@ -21,15 +22,17 @@ jobs: platform: [ubuntu-latest, windows-latest, macos-latest] runs-on: ${{ matrix.platform }} steps: - - name: Fetch Repository - uses: actions/checkout@v3 - - name: Install Go - uses: actions/setup-go@v4 - with: - go-version: ${{ matrix.go-version }} - - name: Run Test - uses: nick-fields/retry@v2 - with: - max_attempts: 3 - timeout_minutes: 15 - command: go test ./... -v -race -count=1 + - name: Fetch Repository + uses: actions/checkout@v3 + + - name: Install Go + uses: actions/setup-go@v4 + with: + go-version: ${{ matrix.go-version }} + + - name: Run Test + uses: nick-fields/retry@v2 + with: + max_attempts: 3 + timeout_minutes: 15 + command: go test ./... -v -race -count=1 diff --git a/.github/workflows/vulncheck.yml b/.github/workflows/vulncheck.yml index 4c13423020..99dc59e499 100644 --- a/.github/workflows/vulncheck.yml +++ b/.github/workflows/vulncheck.yml @@ -1,19 +1,19 @@ name: Run govulncheck on: - push: - branches: - - master - - main - paths: - - '**' - - '!docs/**' - - '!**.md' - pull_request: - paths: - - '**' - - '!docs/**' - - '!**.md' + push: + branches: + - master + - main + paths: + - "**" + - "!docs/**" + - "!**.md" + pull_request: + paths: + - "**" + - "!docs/**" + - "!**.md" jobs: govulncheck-check: @@ -21,15 +21,18 @@ jobs: env: GO111MODULE: on steps: - - name: Fetch Repository - uses: actions/checkout@v3 - - name: Install Go - uses: actions/setup-go@v4 - with: - go-version: 'stable' - check-latest: true - cache: false - - name: Install Govulncheck - run: go install golang.org/x/vuln/cmd/govulncheck@latest - - name: Run Govulncheck - run: govulncheck ./... \ No newline at end of file + - name: Fetch Repository + uses: actions/checkout@v3 + + - name: Install Go + uses: actions/setup-go@v4 + with: + go-version: "stable" + check-latest: true + cache: false + + - name: Install Govulncheck + run: go install golang.org/x/vuln/cmd/govulncheck@latest + + - name: Run Govulncheck + run: govulncheck ./... diff --git a/go.mod b/go.mod index a35de3e1e5..90b0a0321e 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/gofiber/fiber/v2 -go 1.21 +go 1.20 require ( github.com/google/uuid v1.3.1