Skip to content

Commit

Permalink
ci: add goimports-reviser (#1606)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gallardot committed Jan 29, 2023
1 parent 4006ea8 commit 9aae0e3
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 7 deletions.
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

0 comments on commit 9aae0e3

Please sign in to comment.