Skip to content

Commit

Permalink
feature: Added support for Go standard interfaces and CodeQL scanning. (
Browse files Browse the repository at this point in the history
#34)

- Added support for `fmt.Stringer`: Provides a string representation of the ID type.
- Added support for `encoding.TextMarshaler`: Supports marshaling ID into a text-based representation.
- Added support for `encoding.TextUnmarshaler`: Supports unmarshaling ID from a text-based representation.
- Added support for `encoding.BinaryMarshaler`: Supports marshaling ID into a binary representation.
- Added support for `encoding.BinaryUnmarshaler`: Supports unmarshaling ID from a binary representation.
- Added `DefaultRandReader` to provide a default random reader for generating IDs.
- Added `EmptyID` to provide an empty ID constant.
- Added support for CodeQL analysis when pushing to the `main` branch.
  • Loading branch information
mprimeaux authored Nov 15, 2024
1 parent b5d02b8 commit 5dc4028
Show file tree
Hide file tree
Showing 7 changed files with 511 additions and 102 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ jobs:
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/actions/setup-go
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

# Ref: https://github.com/golangci/golangci-lint-action
- name: Lint
uses: golangci/golangci-lint-action@v6
Expand Down
81 changes: 81 additions & 0 deletions .github/workflows/codeql-analysis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
name: "CodeQL Analysis"

permissions:
contents: read

on:
workflow_dispatch:

push:
branches:
- main

paths-ignore:
- 'CHANGELOG/**'
- 'CODEOWNERS'
- 'docs/**'
- 'LICENSE'
- '**/*.md'

schedule:
# * * * * * <command to execute>
# | | | | |
# | | | | day of the week (0–6) (Sunday to Saturday;
# | | | month (1–12) 7 is also Sunday on some systems)
# | | day of the month (1–31)
# | hour (0–23)
# minute (0–59)
- cron: '0 0 * * 3'

jobs:
analyze:
runs-on: ubuntu-latest

strategy:
matrix:
include:
- language: go

permissions:
security-events: write

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/checkout
- name: Checkout Source
uses: actions/checkout@v4
with:
fetch-depth: 0

# Ref: https://github.com/actions/setup-go
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

# Ref: https://github.com/github/codeql-action
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}

- name: Autobuild
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
12 changes: 6 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ jobs:
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/actions/setup-go
- name: "Install Go"
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: "Compute Release Flags"
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: echo "flags=--snapshot" >> $GITHUB_ENV
Expand Down
24 changes: 23 additions & 1 deletion CHANGELOG/CHANGELOG-1.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
### Security

---
## [1.18.0] - 2024-NOV-15

### Added
- **FEATURE**: Added support for `fmt.Stringer`: Provides a string representation of the ID type.
- **FEATURE**: Added support for `encoding.TextMarshaler`: Supports marshaling ID into a text-based representation.
- **FEATURE**: Added support for `encoding.TextUnmarshaler`: Supports unmarshaling ID from a text-based representation.
- **FEATURE**: Added support for `encoding.BinaryMarshaler`: Supports marshaling ID into a binary representation.
- **FEATURE**: Added support for `encoding.BinaryUnmarshaler`: Supports unmarshaling ID from a binary representation.
- **FEATURE**: Added `DefaultRandReader` to provide a default random reader for generating IDs.
- **FEATURE**: Added `EmptyID` to provide an empty ID constant.
- **RISK**: Added support for CodeQL analysis when pushing to the `main` branch.

### Changed
### Deprecated
### Removed
### Fixed
- **DEFECT:** Addressed various documentation issues.

### Security

---
## [1.17.3] - 2024-NOV-14

Expand Down Expand Up @@ -409,7 +430,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
### Security

[Unreleased]: https://github.com/sixafter/nanoid/compare/v1.17.3..HEAD
[Unreleased]: https://github.com/sixafter/nanoid/compare/v1.18.0..HEAD
[1.18.0]: https://github.com/sixafter/nanoid/compare/v1.17.3...v1.18.0
[1.17.3]: https://github.com/sixafter/nanoid/compare/v1.17.2...v1.17.3
[1.17.2]: https://github.com/sixafter/nanoid/compare/v1.17.1...v1.17.2
[1.17.1]: https://github.com/sixafter/nanoid/compare/v1.17.0...v1.17.1
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ bench: ## Execute benchmark tests

.PHONY: clean
clean: ## Remove previous build
$(GO_CLEAN)
$(GO_CLEAN) ./...

.PHONY: cover
cover: ## Generate global code coverage report
Expand Down
Loading

0 comments on commit 5dc4028

Please sign in to comment.