-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
223 changed files
with
41,726 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# Copyright (c) 2024 Six After, Inc | ||
# | ||
# This source code is licensed under the Apache 2.0 License found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
# Ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions | ||
name: ci | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
push: | ||
branches: | ||
- main | ||
|
||
pull_request: | ||
branches: | ||
- main | ||
|
||
paths-ignore: | ||
- 'CHANGELOG/**' | ||
- 'CODEOWNERS' | ||
- 'docs/**' | ||
- 'LICENSE' | ||
- '**/*.md' | ||
|
||
jobs: | ||
ci: | ||
runs-on: ubuntu-latest | ||
env: | ||
flags: "" | ||
steps: | ||
- name: Preamble | ||
run: | | ||
whoami | ||
echo github ref $GITHUB_REF | ||
echo workflow $GITHUB_WORKFLOW | ||
echo home $HOME | ||
echo event name $GITHUB_EVENT_NAME | ||
echo workspace $GITHUB_WORKSPACE | ||
df -h | ||
sudo DEBIAN_FRONTEND=noninteractive apt-get update | ||
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common ca-certificates gnupg-agent curl build-essential make | ||
# Ref: https://github.com/actions/setup-go | ||
- name: Install Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ">= 1.23" | ||
|
||
# Ref: https://github.com/actions/checkout | ||
- name: Checkout Source | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# Ref: https://github.com/golangci/golangci-lint-action | ||
- name: Lint | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
args: --timeout=30m --config=.golangci.yaml --issues-exit-code=0 | ||
|
||
- name: Test | ||
run: | | ||
make test | ||
- name: Cover | ||
run: | | ||
make cover | ||
- name: Analyze | ||
run: | | ||
make analyze | ||
# Ref: https://github.com/actions/cache | ||
- name: Cache SonarCloud Packages | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.sonar/cache | ||
key: ${{ runner.os }}-sonar | ||
restore-keys: ${{ runner.os }}-sonar- | ||
|
||
# Ref: https://github.com/SonarSource/sonarcloud-github-action | ||
- name: Scan with SonarCloud | ||
uses: sonarsource/sonarcloud-github-action@master | ||
with: | ||
projectBaseDir: ./ | ||
env: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
GITHUB_USER: ${{ github.actor }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Copyright (c) 2024 Six After, Inc | ||
# | ||
# This source code is licensed under the Apache 2.0 License found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
# Ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions | ||
name: release | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
|
||
permissions: | ||
contents: write | ||
id-token: write | ||
packages: write | ||
pull-requests: read | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
env: | ||
flags: "" | ||
steps: | ||
- name: "Preamble" | ||
run: | | ||
whoami | ||
echo github ref $GITHUB_REF | ||
echo workflow $GITHUB_WORKFLOW | ||
echo home $HOME | ||
echo event name $GITHUB_EVENT_NAME | ||
echo workspace $GITHUB_WORKSPACE | ||
df -h | ||
sudo DEBIAN_FRONTEND=noninteractive apt-get update | ||
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common ca-certificates gnupg-agent curl build-essential make | ||
# Ref: https://github.com/actions/setup-go | ||
- name: "Install Go" | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ">= 1.23" | ||
|
||
# Ref: https://github.com/actions/checkout | ||
- name: "Checkout Source" | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: "Compute Release Flags" | ||
if: ${{ !startsWith(github.ref, 'refs/tags/v') }} | ||
run: echo "flags=--snapshot" >> $GITHUB_ENV | ||
|
||
- name: Get Commit Hash | ||
id: get_commit | ||
run: | | ||
echo "X_BUILD_COMMIT=$(git rev-parse HEAD 2> /dev/null || echo 'unknown')" >> $GITHUB_ENV | ||
# Ref: https://github.com/goreleaser/goreleaser-action | ||
- name: "Release" | ||
uses: goreleaser/goreleaser-action@v6 | ||
with: | ||
version: latest | ||
args: release --clean ${{ env.flags }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
X_BUILD_COMMIT: ${{ env.X_BUILD_COMMIT }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,10 @@ go.work.sum | |
|
||
# env file | ||
.env | ||
|
||
.idea/ | ||
.DS_Store | ||
|
||
dist/ | ||
|
||
out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Options for analysis running. | ||
run: | ||
# The default concurrency value is the number of available CPU. | ||
#concurrency: 4 | ||
# Timeout for analysis, e.g. 30s, 5m. | ||
# Default: 1m | ||
timeout: 2m | ||
# Exit code when at least one issue was found. | ||
# Default: 1 | ||
issues-exit-code: 0 | ||
# Include test files or not. | ||
# Default: true | ||
tests: false | ||
# List of build tags, all linters use it. | ||
# Default: []. | ||
build-tags: [] | ||
|
||
# Exclude certain directories from linting | ||
exclude-dirs: | ||
- "vendor" | ||
- "third_party" | ||
- "generated" | ||
|
||
# Which dirs to skip: issues from them won't be reported. | ||
# Can use regexp here: `generated.*`, regexp is applied on full path, | ||
# including the path prefix if one is set. | ||
# Default value is empty list, | ||
# but default dirs are skipped independently of this option's value (see skip-dirs-use-default). | ||
# "/" will be replaced by current OS file path separator to properly work on Windows. | ||
skip-dirs: [] | ||
# Enables skipping of directories: | ||
# - vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ | ||
# Default: true | ||
skip-dirs-use-default: true | ||
# Which files to skip: they will be analyzed, but issues from them won't be reported. | ||
# Default value is empty list, | ||
# but there is no need to include all autogenerated files, | ||
# we confidently recognize autogenerated files. | ||
# If it's not please let us know. | ||
# "/" will be replaced by current OS file path separator to properly work on Windows. | ||
skip-files: [] | ||
# If set we pass it to "go list -mod={option}". From "go help modules": | ||
# If invoked with -mod=readonly, the go command is disallowed from the implicit | ||
# automatic updating of go.mod described above. Instead, it fails when any changes | ||
# to go.mod are needed. This setting is most useful to check that go.mod does | ||
# not need updates, such as in a continuous integration and testing system. | ||
# If invoked with -mod=vendor, the go command assumes that the vendor | ||
# directory holds the correct copies of dependencies and ignores | ||
# the dependency descriptions in go.mod. | ||
# | ||
# Allowed values: readonly|vendor|mod | ||
# By default, it isn't set. | ||
modules-download-mode: readonly | ||
# Allow multiple parallel golangci-lint instances running. | ||
# If false (default) - golangci-lint acquires file lock on start. | ||
allow-parallel-runners: false | ||
|
||
output: | ||
sort-results: true | ||
|
||
linters-settings: | ||
cyclop: | ||
package-average: 20.0 | ||
|
||
funlen: | ||
lines: 500 | ||
statements: 350 | ||
|
||
govet: | ||
enable-all: true | ||
|
||
makezero: | ||
always: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json | ||
# vim: set ts=2 sw=2 tw=0 fo=jcroql | ||
version: 2 | ||
|
||
snapshot: | ||
version_template: "{{ incpatch .Version }}-alpha" | ||
|
||
# Ref: https://goreleaser.com/customization/builds/ | ||
project_name: nanoid | ||
|
||
# Ref: https://goreleaser.com/customization/changelog/ | ||
changelog: | ||
# Sorts the changelog by the commit's messages. | ||
# Could either be asc, desc or empty | ||
# Empty means 'no sorting', it'll use the output of `git log` as is. | ||
sort: asc | ||
|
||
# Changelog generation implementation to use. | ||
# | ||
# Valid options are: | ||
# - `git`: uses `git log`; | ||
# - `github`: uses the compare GitHub API, appending the author username to the changelog. | ||
# - `gitlab`: uses the compare GitLab API, appending the author name and email to the changelog (requires a personal access token). | ||
# - `gitea`: uses the compare Gitea API, appending the author username to the changelog. | ||
# - `github-native`: uses the GitHub release notes generation API, disables the groups feature. | ||
# | ||
# Default: 'git'. | ||
use: github | ||
|
||
# Max commit hash length to use in the changelog. | ||
# | ||
# 0: use whatever the changelog implementation gives you | ||
# -1: remove the commit hash from the changelog | ||
# any other number: max length. | ||
abbrev: 0 | ||
|
||
filters: | ||
# Commit messages matching the regexp listed here will be the only ones | ||
# added to the changelog | ||
# | ||
# If include is not-empty, exclude will be ignored. | ||
# | ||
# Matches are performed against the first line of the commit message only, | ||
# prefixed with the commit SHA1, usually in the form of | ||
# `<abbrev-commit>[:] <title-commit>`. | ||
include: | ||
- "(?i)^feature:" | ||
- "(?i)^defect:" | ||
- "(?i)^debt:" | ||
- "(?i)^risk:" | ||
|
||
# Group commits messages by given regex and title. | ||
# Order value defines the order of the groups. | ||
# Providing no regex means all commits will be grouped under the default group. | ||
# | ||
# Matches are performed against the first line of the commit message only, | ||
# prefixed with the commit SHA1, usually in the form of | ||
# `<abbrev-commit>[:] <title-commit>`. | ||
# Groups are disabled when using github-native, as it already groups things by itself. | ||
# Regex use RE2 syntax as defined here: https://github.com/google/re2/wiki/Syntax. | ||
groups: | ||
- title: "🎉 Features" | ||
regexp: '(?i)^.*?feature(\([[:word:]]+\))??!?:.+$' | ||
order: 0 | ||
- title: "🐛 Defects" | ||
regexp: '(?i)^.*?defect(\([[:word:]]+\))??!?:.+$' | ||
order: 1 | ||
- title: "🛠 Technical Debt" | ||
regexp: '(?i)^.*?debt(\([[:word:]]+\))??!?:.+$' | ||
order: 1 | ||
- title: "🚀 Technical Risk" | ||
regexp: '(?i)^.*?risk(\([[:word:]]+\))??!?:.+$' | ||
order: 1 | ||
- title: Others | ||
order: 999 | ||
|
||
sboms: | ||
- artifacts: archive | ||
|
||
builds: | ||
- main: main.go | ||
binary: nanoid | ||
goos: | ||
- linux | ||
- darwin | ||
- windows | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
flags: | ||
- -trimpath | ||
- -ldflags=-s -w \ | ||
-X github.com/sixafter/nanoid-cli/cmd.version={{ .Version }} \ | ||
-X github.com/sixafter/nanoid-cli/cmd.buildCommit={{ .Env.X_BUILD_COMMIT }} | ||
archives: | ||
- format: tar.gz | ||
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" | ||
files: | ||
- LICENSE | ||
- format: zip | ||
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" | ||
files: | ||
- LICENSE | ||
|
||
release: | ||
github: | ||
owner: sixafter | ||
name: nanoid-cli | ||
name_template: 'v{{ .Version }}' | ||
footer: | | ||
**Full Changelog**: [https://github.com/sixafter/nanoid-cli/tree/main/CHANGELOG/CHANGELOG-1.x](https://github.com/sixafter/nanoid-cli/tree/main/CHANGELOG/CHANGELOG-1.x.md) | ||
Oops, something went wrong.