refactor: remove useless code #3109
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
permissions: | |
contents: read | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: 🛡️ Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | |
with: | |
egress-policy: audit | |
disable-sudo: true | |
policy: test | |
- name: 🚚 Check out the repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: 🏗️ Set up Go | |
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 | |
with: | |
go-version: stable | |
- name: 📡 Run `go telemetry on` | |
run: | | |
go telemetry on | |
- name: 🧪 Run `go test` | |
run: | | |
go test -coverpkg=$(go list ./... | grep -v 'internal/mocks' | tr '\n' ',') -coverprofile=coverage.txt -race -v ./... | |
- name: ☂️ Report coverage rates to Codecov | |
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 | |
with: | |
fail_ci_if_error: true # default: false | |
file: ./coverage.txt | |
flags: unittests | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fuzz: | |
name: Fuzz | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
concurrency: | |
group: ${{ github.workflow }}-fuzz-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
FUZZTIME: "60s" | |
steps: | |
- name: 🛡️ Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | |
with: | |
egress-policy: audit | |
disable-sudo: true | |
policy: test.fuzz | |
- name: 🚚 Check out the repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: 🏗️ Set up Go | |
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 | |
with: | |
go-version: stable | |
- name: 🧪 Run `go test` | |
run: | | |
go test ./test/fuzzer -fuzztime ${{ env.FUZZTIME }} -fuzz FuzzParseList | |
go test ./test/fuzzer -fuzztime ${{ env.FUZZTIME }} -fuzz FuzzParseExpression | |
regenerate: | |
name: Regenerate | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: 🛡️ Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | |
with: | |
egress-policy: audit | |
disable-sudo: true | |
policy: test.regenerate | |
- name: 🚚 Check out the repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: 🏗️ Set up Go | |
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 | |
with: | |
go-version: stable | |
- name: 🧪 Run `go mod tidy` | |
run: | | |
go mod tidy | |
- name: 🔍 Check if any files are changed | |
run: | | |
if ! git diff --exit-code; then | |
echo "Please run 'go mod tidy'" | |
exit 1 | |
fi | |
- name: 🎭 Install GoMock | |
run: go install go.uber.org/mock/[email protected] | |
- name: 🧪 Run `go generate` | |
run: | | |
rm ./internal/mocks -rf | |
go generate ./... | |
- name: 🔍 Check if any files are changed | |
run: | | |
if ! git diff --exit-code; then | |
echo "Please run 'go gonerate ./...'" | |
exit 1 | |
fi |