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

Add GitHub workflows 'lint' and 'build' #98

Conversation

jihoon-seo
Copy link
Member

@jihoon-seo jihoon-seo commented Jan 5, 2021

  • (이 PR의 Reviewers 로 @hermitkim1 님도 추가하려고 했는데, 추가가 안 되네요.. :( )
    image

  • GitHub workflows 'lint' and 'build' YAML files by @hermitkim1

  • GitHub Lint action 실행 시 내부적으로 golangci-lint 가 실행되는데, --out-format=github-actions 옵션이 붙어서 실행되어,
    GitHub 웹 인터페이스에서는 어느 파일의 어느 라인이 문제인지 알 수가 없습니다. [링크]
    image

    • 시도 1: 개발 VM에 golint 를 설치하고 실행하여 표시되는 사항들을 모두 수정했으나, GitHub Lint action 의 golangci-lint 는 여전히 에러가 1개 있다고 표시했습니다.
    • 시도 2: 개발 VM에 golangci-lint 를 설치하고 실행하여 표시되는 사항들을 모두 수정했더니, GitHub Lint action 도 통과했습니다.
    • 추가 시도: GitHub Lint action 실행 시 --out-format=github-actions 옵션을 뺄 수 있을까 했는데, lint-on-push.yml 파일에는 해당 구문이 없습니다.

@jihoon-seo
Copy link
Member Author

jihoon-seo commented Jan 5, 2021

PR 을 올리고 나서 보니, CamelCase 에서 대소문자 일관성이 떨어지는 부분이 있습니다.

  • "Cb"
    • CbOperatorMode
  • "CB"
    • CBK8sNamespace
    • CBHelmReleaseName

=> 수정했습니다.
CamelCase 수정하는 commit 을 작성하고 (Fix lint errors (2nd commit))
이전 commit (Fix lint errors) 에 squash 하고
force-push 했습니다.

@jihoon-seo jihoon-seo force-pushed the 210104-Add-GitHub-workflows-lint-and-build branch from fad28ba to f7dd95b Compare January 5, 2021 05:09
@yunkon-kim
Copy link
Member

@jihoon-seo

빠르게 적용하고 계시네요 ㅎㅎ

감사하면서도 아직 미흡한 부분으로 인한 에러로 죄송하기도 합니다. ㅠㅠ
(현재로서는 cloud-barista/cb-operator에 바로 적용하시기 보다 Fork하여 테스트 해보시는것을 추천 드립니다.)

말씀하신 에러에 대한 파일명과 라인번호 표기는 꼭 필요한 사항입니다.

저도 테스트시 Staticcheck's Checks를 참고하여 "시도 2"와 같은 방법으로 해결한 후 진행하지 못하고 있던 부분 입니다.

이슈로 등록하였고요. 업데이트 하도록 하겠습니다.

@yunkon-kim
Copy link
Member

참고로, golangci-lint-action의 이슈 #119에서 :: Syntax를 활용하여 파일명과 라인번호를 기재하였고, 이로 이 github actions에서 정보를 보여주고 있지 않다고 합니다.

@seokho-son
Copy link
Member

@cloud-barista/cb-operator-maintainer 팀을 만들고
cb-operator 저장소 maintainer 권한을 추가하였습니다.
(https://github.com/orgs/cloud-barista/teams/cb-operator-maintainer , @hermitkim1 환영 합니다..^^)

Copy link
Member

@yunkon-kim yunkon-kim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lint-on-push.yml 수행 시 에러에 대한 "파일명"과 "라인번호" 미출력 문제 해결 방안

현재는 steps 부분을 아래와 같이 수정하시면 파일명과 라인번호 확인 하실 수 있습니다.

CB-Larva에서 테스트 완료 하였고요.

GitHub Actions와 golangci-lint에서 관련 이슈를 얼른 해결하기를 바래봅니다. 😄

변경안

    steps:
    - name: Checkout source code
      uses: actions/checkout@v2
    
    - name: Install golangci-lint
      run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.34.1      
    
    - name: Run golangci-lint
      run: $(go env GOPATH)/bin/golangci-lint run

옵션도 적용 가능합니다. 옵션은 여기를 참고 바랍니다.

예)

  • $(go env GOPATH)/bin/golangci-lint run --skip-dirs poc-cb-net/archive
  • $(go env GOPATH)/bin/golangci-lint run --out-format=line-number

변경전

    steps:
    - uses: actions/checkout@v2
    - name: golangci-lint
      uses: golangci/golangci-lint-action@v2
      with:
        # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
        version: v1.29

        # Add args to skip dirs
        #args: --skip-dirs mypath

        # Optional: working directory, useful for monorepos
        # working-directory: somedir

        # Optional: golangci-lint command line arguments.
        # args: --issues-exit-code=0

        # Optional: show only new issues if it's a pull request. The default value is `false`.
        # only-new-issues: true 

@jihoon-seo
Copy link
Member Author

@hermitkim1 알려주신 대로 수정했습니다. 감사합니다!

@seokho-son
Copy link
Member

LGTM

@seokho-son seokho-son merged commit 7a3ea6d into cloud-barista:master Jan 7, 2021
@jihoon-seo jihoon-seo deleted the 210104-Add-GitHub-workflows-lint-and-build branch January 7, 2021 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants