From 03fd12059d3922432ca6cad99bbe81ecae19135d Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Thu, 13 Jul 2023 11:07:02 -0400 Subject: [PATCH] feat(ci): add CD/CI pipelines - Enable Dependabot - Run build/test pipelines - Add GoReleaser release/nightly pipelines - Add lint pipelines --- .github/dependabot.yml | 29 ++++++++++++++++++++ .github/workflows/build.yml | 12 ++++++++ .github/workflows/goreleaser.yml | 24 ++++++++++++++++ .github/workflows/lint.yml | 21 ++++++++++++++ .github/workflows/nightly.yml | 14 ++++++++++ .gitignore | 1 + .golangci-soft.yml | 47 ++++++++++++++++++++++++++++++++ .golangci.yml | 29 ++++++++++++++++++++ .goreleaser.yml | 13 +++++++++ 9 files changed, 190 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/goreleaser.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/nightly.yml create mode 100644 .golangci-soft.yml create mode 100644 .golangci.yml create mode 100644 .goreleaser.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..3081cf0 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,29 @@ +version: 2 +updates: + - package-ecosystem: "gomod" + directory: "/" + schedule: + interval: "daily" + labels: + - "dependencies" + commit-message: + prefix: "feat" + include: "scope" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + labels: + - "dependencies" + commit-message: + prefix: "chore" + include: "scope" + - package-ecosystem: "docker" + directory: "/" + schedule: + interval: "daily" + labels: + - "dependencies" + commit-message: + prefix: "feat" + include: "scope" \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..20a7a22 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,12 @@ +name: build + +on: [push, pull_request] + +jobs: + build: + uses: charmbracelet/meta/.github/workflows/build.yml@main + + snapshot: + uses: charmbracelet/meta/.github/workflows/snapshot.yml@main + secrets: + goreleaser_key: ${{ secrets.GORELEASER_KEY }} diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml new file mode 100644 index 0000000..3ee8595 --- /dev/null +++ b/.github/workflows/goreleaser.yml @@ -0,0 +1,24 @@ +name: goreleaser + +on: + push: + tags: + - v*.*.* + +concurrency: + group: goreleaser + cancel-in-progress: true + +jobs: + goreleaser: + uses: charmbracelet/meta/.github/workflows/goreleaser.yml@main + secrets: + docker_username: ${{ secrets.DOCKERHUB_USERNAME }} + docker_token: ${{ secrets.DOCKERHUB_TOKEN }} + gh_pat: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + goreleaser_key: ${{ secrets.GORELEASER_KEY }} + fury_token: ${{ secrets.FURY_TOKEN }} + nfpm_gpg_key: ${{ secrets.NFPM_GPG_KEY }} + nfpm_passphrase: ${{ secrets.NFPM_PASSPHRASE }} + +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..5e96efe --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,21 @@ +name: lint +on: + push: + pull_request: + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v4 + with: + go-version: ^1 + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + # 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 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000..28f61f7 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,14 @@ +name: nightly + +on: + push: + branches: + - main + +jobs: + nightly: + uses: charmbracelet/meta/.github/workflows/nightly.yml@main + secrets: + docker_username: ${{ secrets.DOCKERHUB_USERNAME }} + docker_token: ${{ secrets.DOCKERHUB_TOKEN }} + goreleaser_key: ${{ secrets.GORELEASER_KEY }} diff --git a/.gitignore b/.gitignore index 49b5b77..c7a13fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.gif *.pdf +dist diff --git a/.golangci-soft.yml b/.golangci-soft.yml new file mode 100644 index 0000000..ef456e0 --- /dev/null +++ b/.golangci-soft.yml @@ -0,0 +1,47 @@ +run: + tests: false + +issues: + include: + - EXC0001 + - EXC0005 + - EXC0011 + - EXC0012 + - EXC0013 + + max-issues-per-linter: 0 + max-same-issues: 0 + +linters: + enable: + # - dupl + - exhaustive + # - exhaustivestruct + - goconst + - godot + - godox + - gomnd + - gomoddirectives + - goprintffuncname + - ifshort + # - lll + - misspell + - nakedret + - nestif + - noctx + - nolintlint + - prealloc + - wrapcheck + + # disable default linters, they are already enabled in .golangci.yml + disable: + - deadcode + - errcheck + - gosimple + - govet + - ineffassign + - staticcheck + - structcheck + - typecheck + - unused + - varcheck diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..a5a91d0 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,29 @@ +run: + tests: false + +issues: + include: + - EXC0001 + - EXC0005 + - EXC0011 + - EXC0012 + - EXC0013 + + max-issues-per-linter: 0 + max-same-issues: 0 + +linters: + enable: + - bodyclose + - exportloopref + - goimports + - gosec + - nilerr + - predeclared + - revive + - rowserrcheck + - sqlclosecheck + - tparallel + - unconvert + - unparam + - whitespace diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..3fab00c --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,13 @@ +includes: + - from_url: + url: charmbracelet/meta/main/goreleaser-simple.yaml + +variables: + main: "." + binary_name: pop + description: "Send emails from your terminal. 📬" + github_url: "https://github.com/charmbracelet/pop" + maintainer: "Maas Lalani " + brew_commit_author_name: "Maas Lalani" + brew_commit_author_email: "maas@charm.sh" +# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json