Skip to content

Merge pull request #6181 from Algo-devops-service/relstable3.27.0-rem… #13739

Merge pull request #6181 from Algo-devops-service/relstable3.27.0-rem…

Merge pull request #6181 from Algo-devops-service/relstable3.27.0-rem… #13739

Workflow file for this run

name: "ReviewDog workflow"
env:
GOLANGCI_LINT_VERSION: "v1.62.0"
on:
push:
branches:
- master
pull_request:
jobs:
# Blocking Errors Section
reviewdog-errors:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
fetch-depth: 0 # required for new-from-rev option in .golangci.yml
# move go out of the way temporarily to avoid "go list ./..." from installing modules
- name: Make libsodium.a
run: sudo mv /usr/bin/go /usr/bin/go.bak && make crypto/libs/linux/amd64/lib/libsodium.a && sudo mv /usr/bin/go.bak /usr/bin/go
- name: reviewdog-golangci-lint
uses: reviewdog/[email protected]
with:
go_version_file: go.mod
golangci_lint_version: ${{ env.GOLANGCI_LINT_VERSION }}
golangci_lint_flags: "-c .golangci.yml --allow-parallel-runners"
reporter: "github-pr-check"
tool_name: "Lint Errors"
level: "error"
fail_on_error: true
filter_mode: "nofilter"
# Non-Blocking Warnings Section
reviewdog-warnings:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
fetch-depth: 0 # required for new-from-rev option in .golangci.yml
# move go out of the way temporarily to avoid "go list ./..." from installing modules
- name: Make libsodium.a
run: sudo mv /usr/bin/go /usr/bin/go.bak && make crypto/libs/linux/amd64/lib/libsodium.a && sudo mv /usr/bin/go.bak /usr/bin/go
- name: Add bin to PATH
run: |
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
echo "$RUNNER_WORKSPACE/$(basename $GITHUB_REPOSITORY)/bin" >> $GITHUB_PATH
- name: Determine Go version
id: go_version
run: echo "GO_VERSION=$(./scripts/get_golang_version.sh)" >> $GITHUB_ENV
- name: Install specific golang
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Create folders for golangci-lint
run: mkdir -p cicdtmp/golangci-lint
- name: Check if custom golangci-lint is already built
id: cache-golangci-lint
uses: actions/[email protected]
with:
path: cicdtmp/golangci-lint/golangci-lint-cgo
key: cicd-golangci-lint-cgo-v0.0.3-${{ env.GO_VERSION }}-${{ env.GOLANGCI_LINT_VERSION }}
- name: Build custom golangci-lint with CGO_ENABLED
if: steps.cache-golangci-lint.outputs.cache-hit != 'true'
run: |
cd cicdtmp/golangci-lint
git clone https://github.com/golangci/golangci-lint.git .
git checkout tags/${GOLANGCI_LINT_VERSION}
CGO_ENABLED=true go build -trimpath -o golangci-lint-cgo ./cmd/golangci-lint
./golangci-lint-cgo --version
cd ../../
- name: Install reviewdog
run: |
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/v0.20.2/install.sh | sh -s -- v0.20.2
reviewdog --version
- name: Build custom linters
run: |
cd cmd/partitiontest_linter/
CGO_ENABLED=true go build -buildmode=plugin -trimpath plugin/plugin.go
cd ../../
ls -la cmd/partitiontest_linter/
- name: Run golangci-lint with reviewdog
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -e
./cicdtmp/golangci-lint/golangci-lint-cgo run \
--out-format line-number \
-c .golangci-warnings.yml \
--issues-exit-code 0 \
--allow-parallel-runners > temp_golangci-lint-cgo.txt
cat temp_golangci-lint-cgo.txt | reviewdog \
-f=golangci-lint \
-name="Lint Warnings" \
-reporter=github-pr-check \
-filter-mode=added \
-fail-on-error=true \
-level=warning
- name: Slack Notification
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
run: |
curl -X POST --data-urlencode "payload={\"text\": \"Reviewdog failed. ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} \"}" $SLACK_WEBHOOK
if: ${{ failure() && (contains(github.ref_name, 'rel/nightly') || contains(github.ref_name, 'rel/beta') || contains(github.ref_name, 'rel/stable') || contains(github.ref_name, 'master')) }}
reviewdog-shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: shellcheck
uses: reviewdog/action-shellcheck@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: "github-pr-check"
shellcheck_flags: "-e SC2034,SC2046,SC2053,SC2207,SC2145 -S warning"
fail_on_error: true
path: |
test/scripts/e2e_subs