From 586b06a3c23c5d9fc7a7eb27ace559c2cdb72fcb Mon Sep 17 00:00:00 2001 From: Ravi Suhag Date: Fri, 1 Nov 2024 21:08:50 +0530 Subject: [PATCH 1/2] build: fix build go version --- .github/ISSUE_TEMPLATE/feature_request.md | 20 ------------ .github/SECURITY.md | 13 ++++++++ .github/workflows/lint.yaml | 29 +++++++++++++++++ .github/workflows/test.yaml | 22 +++++++++++++ .github/workflows/verify.yaml | 38 ----------------------- term/brew.go | 26 +++++++++++++--- 6 files changed, 85 insertions(+), 63 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/SECURITY.md create mode 100644 .github/workflows/lint.yaml create mode 100644 .github/workflows/test.yaml delete mode 100644 .github/workflows/verify.yaml diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index bbcbbe7..0000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 0000000..6009858 --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,13 @@ +Raystack takes the security of our software products and services seriously. + +If you believe you have found a security vulnerability in this project, you can report it to us directly using [private vulnerability reporting][]. + +- Include a description of your investigation of this project's codebase and why you believe an exploit is possible. +- POCs and links to code are greatly encouraged. +- Such reports are not eligible for a bounty reward. + +**Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.** + +Thanks for helping make GitHub safe for everyone. + +[private vulnerability reporting]: https://github.com/raystack/meteor/security/advisories \ No newline at end of file diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..210c7c6 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,29 @@ +name: Lint +on: + push: + paths: + - "**.go" + - go.mod + - go.sum + pull_request: + paths: + - "**.go" + - go.mod + - go.sum + +jobs: + checks: + runs-on: ubuntu-latest + steps: + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: "go.mod" + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Run linter + uses: golangci/golangci-lint-action@v6 + with: + version: v1.60 \ No newline at end of file diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..a4aaceb --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,22 @@ +name: Test + +on: + push: + branches: + - main + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: "go.mod" + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Run unit tests + run: make test diff --git a/.github/workflows/verify.yaml b/.github/workflows/verify.yaml deleted file mode 100644 index d655ccb..0000000 --- a/.github/workflows/verify.yaml +++ /dev/null @@ -1,38 +0,0 @@ -name: verify - -on: - push: - branches: - - main - pull_request: - workflow_dispatch: - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - name: Setup Go - uses: actions/setup-go@v4 - with: - go-version: "1.20" - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Run linter - uses: golangci/golangci-lint-action@v3 - with: - version: v1.53 - test: - runs-on: ubuntu-latest - steps: - - name: Setup Go - uses: actions/setup-go@v4 - with: - go-version: "1.20" - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Run unit tests - run: make test diff --git a/term/brew.go b/term/brew.go index 45826c0..fa73adc 100644 --- a/term/brew.go +++ b/term/brew.go @@ -6,9 +6,18 @@ import ( "strings" ) -// IsUnderHomebrew checks whether the given binary is under the homebrew path. -func IsUnderHomebrew(binpath string) bool { - if binpath == "" { +// IsUnderHomebrew checks if a given binary path is managed under the Homebrew path. +// +// This function is useful to verify if a binary is installed via Homebrew +// by comparing its location to the Homebrew binary directory. +// +// Parameters: +// - path: The path of the binary to check. +// +// Returns: +// - A boolean value indicating whether the binary is located under the Homebrew path. +func IsUnderHomebrew(path string) bool { + if path == "" { return false } @@ -23,10 +32,17 @@ func IsUnderHomebrew(binpath string) bool { } brewBinPrefix := filepath.Join(strings.TrimSpace(string(brewPrefixBytes)), "bin") + string(filepath.Separator) - return strings.HasPrefix(binpath, brewBinPrefix) + return strings.HasPrefix(path, brewBinPrefix) } -// HasHomebrew check whether the user has installed brew +// HasHomebrew checks if Homebrew is installed on the user's system. +// +// This function determines the presence of Homebrew by looking for the "brew" +// executable in the system's PATH. It is useful to ensure Homebrew dependencies +// can be managed before executing related commands. +// +// Returns: +// - A boolean value indicating whether Homebrew is installed. func HasHomebrew() bool { _, err := exec.LookPath("brew") return err == nil From fa0882f306582c112d1fc9510c03ee8ed66d354d Mon Sep 17 00:00:00 2001 From: Ravi Suhag Date: Fri, 1 Nov 2024 21:10:50 +0530 Subject: [PATCH 2/2] chore: fix checkout order --- .github/workflows/lint.yaml | 8 ++++---- .github/workflows/test.yaml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 210c7c6..5cef9d4 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -15,14 +15,14 @@ jobs: checks: runs-on: ubuntu-latest steps: - - name: Setup Go - uses: actions/setup-go@v5 - with: - go-version-file: "go.mod" - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: "go.mod" - name: Run linter uses: golangci/golangci-lint-action@v6 with: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a4aaceb..4be296a 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -10,13 +10,13 @@ jobs: test: runs-on: ubuntu-latest steps: - - name: Setup Go - uses: actions/setup-go@v5 - with: - go-version-file: "go.mod" - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: "go.mod" - name: Run unit tests run: make test