mirror of
https://github.com/sony/sonyflake.git
synced 2026-01-08 20:33:06 +00:00
Upgrade Sonyflake to v2 (#66)
* Add v2 * Introduce staticcheck * Introduce golangci-lint * Add error checks * Add error checks * Lint v2 code * Improve CI trigger * Use io.ReadAll * Use int64 * Remove NewSonyflake * Fix errors * v2: Change MachineID, sequence, and AmazonEC2MachineID to int; update all usage and tests for type consistency * docs: update Settings struct in README to use int for MachineID and CheckMachineID (v2) * docs(v2): clarify Settings, StartTime, MachineID, and CheckMachineID comments and update README links and explanations * docs(v2/mock): improve comments and docstrings for mock implementations * docs(types): unify and clarify package and type docstrings for types.go in v1 and v2 * test(v2): refactor and modernize tests, improve error assertions, and update mocks for v2 * test(v2): normalize whitespace in pseudoSleep calls for consistency * feat(v2): add configurable TimeUnit and refactor time handling for So… (#67) * feat(v2): add configurable TimeUnit and refactor time handling for Sonyflake v2 * test(v2): add ToTime tests, clarify TimeUnit behavior, and update docs for v2 * gofmt
This commit is contained in:
50
.github/workflows/test-v2.yml
vendored
Normal file
50
.github/workflows/test-v2.yml
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
name: CI for v2 Module
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- .github/workflows/test-v2.yml
|
||||
- 'v2/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- .github/workflows/test-v2.yml
|
||||
- 'v2/**'
|
||||
|
||||
jobs:
|
||||
test-v2:
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.23.x, 1.24.x]
|
||||
os: [ubuntu-latest]
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./v2
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: ./v2/go.mod
|
||||
|
||||
- name: Tidy modules
|
||||
run: go mod tidy
|
||||
|
||||
- name: Lint Code
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
with:
|
||||
working-directory: ./v2
|
||||
|
||||
- name: Check format
|
||||
run: test -z "`gofmt -l .`"
|
||||
|
||||
- name: Run tests
|
||||
run: go test ./... -v
|
||||
|
||||
- name: Build example
|
||||
run: cd example && ./linux64_build.sh
|
||||
Reference in New Issue
Block a user