From b9406f56f715ae7e6f9972962eb2d13c0e177b07 Mon Sep 17 00:00:00 2001 From: mzack Date: Tue, 19 Oct 2021 20:08:50 +0200 Subject: [PATCH 1/3] Updating github actions and release --- .../{ => ISSUE_TEMPLATE}/feature_request.md | 2 +- .github/ISSUE_TEMPLATE/issue-report.md | 26 ++++++++++ .github/dependabot.yml | 3 ++ .github/issue-report.md | 18 ------- .github/workflows/build-test.yml | 25 +++++++++ .github/workflows/build.yaml | 47 ----------------- .github/workflows/codeql-analysis.yml | 38 ++++++++++++++ .github/workflows/dockerhub-push.yml | 51 ++++++++++++++----- .github/workflows/lint-test.yml | 19 +++++++ .github/workflows/release-binary.yml | 26 ++++++++++ .github/workflows/release.yml | 28 ---------- .goreleaser.yml | 17 ++++--- Dockerfile | 9 ++-- 13 files changed, 188 insertions(+), 121 deletions(-) rename .github/{ => ISSUE_TEMPLATE}/feature_request.md (94%) create mode 100644 .github/ISSUE_TEMPLATE/issue-report.md delete mode 100644 .github/issue-report.md create mode 100644 .github/workflows/build-test.yml delete mode 100644 .github/workflows/build.yaml create mode 100644 .github/workflows/codeql-analysis.yml create mode 100644 .github/workflows/lint-test.yml create mode 100644 .github/workflows/release-binary.yml delete mode 100644 .github/workflows/release.yml diff --git a/.github/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md similarity index 94% rename from .github/feature_request.md rename to .github/ISSUE_TEMPLATE/feature_request.md index 5a71fc09..f3bde24c 100644 --- a/.github/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,7 +1,7 @@ --- name: Feature request about: Suggest an idea for this project -title: "[feature]" +title: "" labels: '' assignees: '' diff --git a/.github/ISSUE_TEMPLATE/issue-report.md b/.github/ISSUE_TEMPLATE/issue-report.md new file mode 100644 index 00000000..d3dddabe --- /dev/null +++ b/.github/ISSUE_TEMPLATE/issue-report.md @@ -0,0 +1,26 @@ +--- +name: Issue report +about: Create a report to help us improve +title: "" +labels: 'Type:+Bug' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**Environment details** +Please share the below details to help us quickly validate/replicate the issue. + +- `proxify -version` +- `go version` +- `uname -a` + + +**Error details** +Please copy-paste the error trace or details from terminal to help us quickly validate/replicate the issue. + +```bash + +``` \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 4d5617f2..938a100f 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -11,6 +11,7 @@ updates: directory: "/" schedule: interval: "weekly" + target-branch: "dev" commit-message: prefix: "chore" include: "scope" @@ -20,6 +21,7 @@ updates: directory: "/" schedule: interval: "weekly" + target-branch: "dev" commit-message: prefix: "chore" include: "scope" @@ -29,6 +31,7 @@ updates: directory: "/" schedule: interval: "weekly" + target-branch: "dev" commit-message: prefix: "chore" include: "scope" diff --git a/.github/issue-report.md b/.github/issue-report.md deleted file mode 100644 index 31293cfd..00000000 --- a/.github/issue-report.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Issue report -about: Create a report to help us improve -title: "[issue]" -labels: '' -assignees: '' - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**Proxify version** -Please share the version of the proxify you are running with `proxify -version` - - -**Screenshot of the error or bug** -please add the screenshot showing bug or issue you are facing. diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 00000000..cf7968b8 --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,25 @@ +name: 🔨 Build Test + +on: + push: + pull_request: + workflow_dispatch: + + +jobs: + build: + name: Test Builds + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-go@v2 + with: + go-version: 1.17 + + - name: Test + run: go test ./... + + - name: Build + run: go build . + working-directory: cmd/proxify/ diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml deleted file mode 100644 index e506f820..00000000 --- a/.github/workflows/build.yaml +++ /dev/null @@ -1,47 +0,0 @@ -name: Build -on: - push: - branches: - - master - pull_request: - -jobs: - golangci-lint: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Run golangci-lint - uses: golangci/golangci-lint-action@v2.5.2 - 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.31 - args: --timeout 5m - - # 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 - build: - name: Build - runs-on: ubuntu-latest - steps: - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.14 - - - name: Check out code - uses: actions/checkout@v2 - - - name: Test - run: go test . - working-directory: cmd/proxify/ - - - name: Build - run: go build . - working-directory: cmd/proxify/ diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 00000000..545cdea9 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,38 @@ +name: 🚨 CodeQL Analysis + +on: + workflow_dispatch: + pull_request: + branches: + - dev + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'go' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 \ No newline at end of file diff --git a/.github/workflows/dockerhub-push.yml b/.github/workflows/dockerhub-push.yml index 3c0e6633..a664db65 100644 --- a/.github/workflows/dockerhub-push.yml +++ b/.github/workflows/dockerhub-push.yml @@ -1,17 +1,40 @@ -# dockerhub-push pushes docker build to dockerhub automatically -# on the creation of a new release -name: Publish to Dockerhub on creation of a new release -on: - release: - types: [published] +name: 🌥 Docker Push + +on: + workflow_run: + workflows: ["🎉 Release Binary"] + types: + - completed + workflow_dispatch: + jobs: - build: + docker: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master - - name: Publish to Dockerhub Registry - uses: elgohr/Publish-Docker-Github-Action@master - with: - name: projectdiscovery/proxify - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} \ No newline at end of file + - name: Checkout + uses: actions/checkout@v2 + + - name: Get Github tag + id: meta + run: | + echo "::set-output name=tag::$(curl --silent "https://api.github.com/repos/projectdiscovery/proxify/releases/latest" | jq -r .tag_name)" + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + platforms: linux/amd64,linux/arm64,linux/arm + push: true + tags: projectdiscovery/proxify:latest,projectdiscovery/proxify:${{ steps.meta.outputs.tag }} \ No newline at end of file diff --git a/.github/workflows/lint-test.yml b/.github/workflows/lint-test.yml new file mode 100644 index 00000000..794d0739 --- /dev/null +++ b/.github/workflows/lint-test.yml @@ -0,0 +1,19 @@ +name: 🙏🏻 Lint Test +on: + push: + pull_request: + workflow_dispatch: + +jobs: + lint: + name: Lint Test + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Run golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + version: latest + args: --timeout 5m + working-directory: . \ No newline at end of file diff --git a/.github/workflows/release-binary.yml b/.github/workflows/release-binary.yml new file mode 100644 index 00000000..7cf8f995 --- /dev/null +++ b/.github/workflows/release-binary.yml @@ -0,0 +1,26 @@ +name: 🎉 Release Binary +on: + create: + tags: + - v* + workflow_dispatch: + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-go@v2 + with: + go-version: 1.17 + + - + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + name: "Create release on GitHub" + uses: goreleaser/goreleaser-action@v2 + with: + args: "release --rm-dist" + version: latest + workdir: . diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 70cb60a9..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Release -on: - create: - tags: - - v* - -jobs: - release: - runs-on: ubuntu-latest - steps: - - - name: "Check out code" - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: "Set up Go" - uses: actions/setup-go@v2 - with: - go-version: 1.14 - - - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - name: "Create release on GitHub" - uses: goreleaser/goreleaser-action@v2 - with: - args: "release --rm-dist" - version: latest \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml index 134db648..8d92f5a2 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,3 +1,7 @@ +before: + hooks: + - go mod tidy + builds: - binary: proxify main: cmd/proxify/proxify.go @@ -39,10 +43,9 @@ builds: id: mitmrelay archives: - - id: tgz - format: tar.gz - replacements: - darwin: macOS - format_overrides: - - goos: windows - format: zip \ No newline at end of file + - format: zip + replacements: + darwin: macOS + +checksum: + algorithm: sha256 diff --git a/Dockerfile b/Dockerfile index 57025efc..02248f3d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,9 @@ -# Base -FROM golang:1.17.1-alpine AS builder +FROM golang:1.17.2-alpine AS builder RUN apk add --no-cache git -RUN GO111MODULE=on go get -v github.com/projectdiscovery/proxify/cmd/proxify - -# Release -FROM alpine:latest +RUN go install -v github.com/projectdiscovery/proxify/cmd/proxify@latest +FROM alpine:3.14 RUN apk -U upgrade --no-cache \ && apk add --no-cache bind-tools ca-certificates COPY --from=builder /go/bin/proxify /usr/local/bin/ From 05b9fa01f7e9bf32091aa378c1de041a780b6fd3 Mon Sep 17 00:00:00 2001 From: sandeep Date: Wed, 20 Oct 2021 01:59:50 +0530 Subject: [PATCH 2/3] misc update --- .github/workflows/lint-test.yml | 1 + .github/workflows/release-binary.yml | 13 ++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/lint-test.yml b/.github/workflows/lint-test.yml index 794d0739..b777b2dc 100644 --- a/.github/workflows/lint-test.yml +++ b/.github/workflows/lint-test.yml @@ -11,6 +11,7 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 + - name: Run golangci-lint uses: golangci/golangci-lint-action@v2 with: diff --git a/.github/workflows/release-binary.yml b/.github/workflows/release-binary.yml index 7cf8f995..a86411a3 100644 --- a/.github/workflows/release-binary.yml +++ b/.github/workflows/release-binary.yml @@ -1,13 +1,14 @@ name: 🎉 Release Binary + on: create: - tags: - - v* workflow_dispatch: jobs: release: runs-on: ubuntu-latest + if: ${{ startsWith(github.ref, 'refs/tags/v') }} + steps: - uses: actions/checkout@v2 @@ -15,12 +16,10 @@ jobs: with: go-version: 1.17 - - - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - name: "Create release on GitHub" - uses: goreleaser/goreleaser-action@v2 + - uses: goreleaser/goreleaser-action@v2 with: args: "release --rm-dist" version: latest workdir: . + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file From 001323806e4135272b43bb1fd6dc623feb530129 Mon Sep 17 00:00:00 2001 From: sandeep Date: Wed, 20 Oct 2021 03:02:21 +0530 Subject: [PATCH 3/3] misc updates --- .github/ISSUE_TEMPLATE/config.yml | 14 ++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 22 ++++++++----- .github/ISSUE_TEMPLATE/issue-report.md | 40 ++++++++++++++--------- .github/PULL_REQUEST_TEMPLATE.md | 15 +++++++++ 4 files changed, 67 insertions(+), 24 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..d0dc17c8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,14 @@ +blank_issues_enabled: false + +contact_links: + - name: Ask an question / advise on using proxify + url: https://github.com/projectdiscovery/proxify/discussions/categories/q-a + about: Ask a question or request support for using proxify + + - name: Share idea / feature to discuss for proxify + url: https://github.com/projectdiscovery/proxify/discussions/categories/ideas + about: Share idea / feature to discuss for proxify + + - name: Connect with PD Team (Discord) + url: https://discord.gg/projectdiscovery + about: Connect with PD Team for direct communication \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index f3bde24c..2fc110d6 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,14 +1,18 @@ --- name: Feature request -about: Suggest an idea for this project -title: "" -labels: '' -assignees: '' - +about: Request feature to implement in this project +labels: 'Type: Enhancement' --- -**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 [...] + + +### Please describe your feature request: + -**Describe the solution you'd like** -A clear and concise description of what you want to happen. +### Describe the use case of this feature: + diff --git a/.github/ISSUE_TEMPLATE/issue-report.md b/.github/ISSUE_TEMPLATE/issue-report.md index d3dddabe..043bcb20 100644 --- a/.github/ISSUE_TEMPLATE/issue-report.md +++ b/.github/ISSUE_TEMPLATE/issue-report.md @@ -1,26 +1,36 @@ --- name: Issue report -about: Create a report to help us improve -title: "" -labels: 'Type:+Bug' -assignees: '' +about: Create a report to help us to improve the project +labels: 'Type: Bug' --- -**Describe the bug** -A clear and concise description of what the bug is. + -**Environment details** -Please share the below details to help us quickly validate/replicate the issue. + -- `proxify -version` -- `go version` -- `uname -a` +### Proxify version: + + + +### Current Behavior: + -**Error details** -Please copy-paste the error trace or details from terminal to help us quickly validate/replicate the issue. +### Expected Behavior: + -```bash +### Steps To Reproduce: + -``` \ No newline at end of file + +### Anything else: + \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..b360dd1e --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,15 @@ +## Proposed changes + + + + +## Checklist + + + +- [ ] Pull request is created against the [dev](https://github.com/projectdiscovery/proxify/tree/dev) branch +- [ ] All checks passed (lint, unit/integration/regression tests etc.) with my changes +- [ ] I have added tests that prove my fix is effective or that my feature works +- [ ] I have added necessary documentation (if appropriate) \ No newline at end of file