diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5d219e8 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: +- package-ecosystem: github-actions + directory: / + schedule: + interval: daily +- package-ecosystem: gomod + directory: / + schedule: + interval: daily diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..273d7f7 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,8 @@ + diff --git a/.github/workflows/codeql-analysis.yaml b/.github/workflows/codeql-analysis.yaml new file mode 100644 index 0000000..8ed7396 --- /dev/null +++ b/.github/workflows/codeql-analysis.yaml @@ -0,0 +1,37 @@ +name: "CodeQL" +on: + push: + branches: + - main + pull_request: + # The branches below must be a subset of the branches above + branches: + - main + schedule: + - cron: '29 15 * * 1' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + language: + - go + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a + # config file. By default, queries listed here will override any + # specified in a config file. Prefix the list here with "+" to use + # these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/commitlint.yaml b/.github/workflows/commitlint.yaml new file mode 100644 index 0000000..112c681 --- /dev/null +++ b/.github/workflows/commitlint.yaml @@ -0,0 +1,13 @@ +name: Lint Commit Messages +on: pull_request + +jobs: + commitlint: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Lint Commits + uses: wagoid/commitlint-github-action@v2 diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml new file mode 100644 index 0000000..c435294 --- /dev/null +++ b/.github/workflows/coverage.yaml @@ -0,0 +1,29 @@ +name: Coverage +on: + push: + branches: + - main + +jobs: + coverage: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Configure git + run: | + git config --global user.name "$GITHUB_ACTOR" + git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" + - name: Set up go + uses: actions/setup-go@v2 + with: + go-version: "^1.16" + - name: Calculate coverage + run: go test -v -covermode=count -coverprofile=coverage.out + - name: Convert coverage to lcov + uses: jandelgado/gcov2lcov-action@v1.0.8 + - name: Coveralls + uses: coverallsapp/github-action@v1.1.2 + with: + github-token: ${{ secrets.github_token }} + path-to-lcov: coverage.lcov diff --git a/.github/workflows/golangci-lint.yaml b/.github/workflows/golangci-lint.yaml new file mode 100644 index 0000000..0cd11db --- /dev/null +++ b/.github/workflows/golangci-lint.yaml @@ -0,0 +1,14 @@ +name: golangci-lint +on: pull_request + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + version: latest diff --git a/.github/workflows/tag-release.yaml b/.github/workflows/tag-release.yaml new file mode 100644 index 0000000..ddcd67c --- /dev/null +++ b/.github/workflows/tag-release.yaml @@ -0,0 +1,43 @@ +name: Tag and Release + +on: + push: + branches: + - main + +jobs: + tag: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Configure Git + run: | + git config --global user.name "$GITHUB_ACTOR" + git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" + - name: Setup go + uses: actions/setup-go@v2 + with: + go-version: "^1.16" + - name: Install ccv + run: | + curl -sSL https://github.com/smlx/ccv/releases/download/v0.3.2/ccv_0.3.2_linux_amd64.tar.gz \ + | tar -xz -C /usr/local/bin ccv + - name: Bump tag if necessary + id: tag + run: | + if [ -z $(git tag -l $(ccv)) ]; then + git tag $(ccv) + git push --tags + echo "::set-output name=new::true" + fi + - name: Run GoReleaser + if: steps.tag.outputs.new == 'true' + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..3b71be6 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,19 @@ +name: Test Suite +on: pull_request + +jobs: + go-test: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Configure git + run: | + git config --global user.name "$GITHUB_ACTOR" + git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" + - name: Set up go + uses: actions/setup-go@v2 + with: + go-version: "^1.16" + - name: Run tests + run: go test -v . diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 0000000..252a9ad --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1,15 @@ +const Configuration = { + /* + * Resolve and load @commitlint/config-conventional from node_modules. + * Referenced packages must be installed + */ + extends: ['@commitlint/config-conventional'], + /* + * Any rules defined here will override rules from @commitlint/config-conventional + */ + rules: { + 'body-max-line-length': [1, 'always', 80], + }, +}; + +module.exports = Configuration;