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

ci: add goimports-reviser #1606

Merged
merged 3 commits into from
Jan 29, 2023
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: 77 additions & 0 deletions .github/workflows/goimports-reviser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
name: goimports-reviser

on:
push:
branches:
- master
pull_request:
branches:
- master
- v1.6.0
type: [review_requested, ready_for_review]
jobs:
changes:
runs-on: ubuntu-latest
outputs:
docs: ${{ steps.filter.outputs.docs }}
go: ${{ steps.filter.outputs.go }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- uses: ./.github/actions/paths-filter
id: filter
with:
token: ${{ secrets.GITHUB_TOKEN }}
filters: |
docs:
- 'docs/**/*'
- '*.md'
go:
- '*.go'
- '**/*.go'
- 'go.mod'
- 'go.sum'
- 'Makefile'
- 'Dockerfile'
- 'test/e2e/**/*'
- 'conf/**'
- 'utils/**'
- ".github/**"
goimports-reviser:
needs: changes
if: |
(needs.changes.outputs.go == 'true')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Go Env
uses: actions/setup-go@v3
with:
go-version: "1.19"
- name: Make update-gofmt
working-directory: ./
run: |
make update-gofmt
echo "*** Please make update-gofmt before creating a PR ***"
git diff --quiet -- . || (git diff | cat && false)
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ package plugins
import (
"net/http"

"github.com/incubator4/go-resty-expr/expr"

"github.com/apache/apisix-ingress-controller/pkg/providers/ingress/translation/annotations"
apisixv1 "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"

"github.com/incubator4/go-resty-expr/expr"
)

type HttpMethod struct{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ import (
"net/http"
"testing"

"github.com/incubator4/go-resty-expr/expr"
"github.com/stretchr/testify/assert"

"github.com/apache/apisix-ingress-controller/pkg/providers/ingress/translation/annotations"
apisixv1 "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"

"github.com/incubator4/go-resty-expr/expr"
)

// annotations:
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/suite-chore/admin_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ package chore
import (
"context"

v1 "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"
"github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"

v1 "github.com/apache/apisix-ingress-controller/pkg/types/apisix/v1"
"github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
)

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/suite-features/external-sd.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import (
"os"
"time"

"github.com/apache/apisix-ingress-controller/pkg/config"
"github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"

"github.com/apache/apisix-ingress-controller/pkg/config"
"github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
)

Expand Down
3 changes: 2 additions & 1 deletion test/e2e/suite-plugins/suite-plugins-general/secret_ref.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ package plugins

import (
"fmt"
"net/http"

ginkgo "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert"
"net/http"

"github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
)
Expand Down