.forgejo: Add DCO action #54
4 changed files with 40 additions and 22 deletions
21
.forgejo/workflows/dco.yml
Normal file
21
.forgejo/workflows/dco.yml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
name: DCO action
|
||||||
|
on: [pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
dco:
|
||||||
|
name: DCO
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v3
|
||||||
|
with:
|
||||||
|
go-version: '1.21'
|
||||||
|
|
||||||
|
- name: Run commit format checker
|
||||||
|
uses: https://git.frostfs.info/TrueCloudLab/dco-go@v2
|
||||||
|
with:
|
||||||
|
from: 'origin/${{ github.event.pull_request.base.ref }}'
|
|
@ -1,15 +0,0 @@
|
||||||
package random
|
|
||||||
|
|
||||||
import (
|
|
||||||
"math/rand"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
rand.Seed(time.Now().UnixNano())
|
|
||||||
}
|
|
||||||
|
|
||||||
// Uint32 returns random uint32 value [0, max).
|
|
||||||
func Uint32(max uint32) uint32 {
|
|
||||||
return rand.Uint32() % max
|
|
||||||
}
|
|
|
@ -1,7 +1,9 @@
|
||||||
package objecttest
|
package objecttest
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/internal/random"
|
"math/rand"
|
||||||
|
"time"
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
||||||
refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test"
|
refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test"
|
||||||
|
@ -186,7 +188,7 @@ func GenerateGetResponseBody(empty bool) *object.GetResponseBody {
|
||||||
m := new(object.GetResponseBody)
|
m := new(object.GetResponseBody)
|
||||||
|
|
||||||
if !empty {
|
if !empty {
|
||||||
switch random.Uint32(3) {
|
switch randomInt(3) {
|
||||||
case 0:
|
case 0:
|
||||||
m.SetObjectPart(GenerateGetObjectPartInit(false))
|
m.SetObjectPart(GenerateGetObjectPartInit(false))
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -240,7 +242,7 @@ func GeneratePutRequestBody(empty bool) *object.PutRequestBody {
|
||||||
m := new(object.PutRequestBody)
|
m := new(object.PutRequestBody)
|
||||||
|
|
||||||
if !empty {
|
if !empty {
|
||||||
switch random.Uint32(2) {
|
switch randomInt(2) {
|
||||||
case 0:
|
case 0:
|
||||||
m.SetObjectPart(GeneratePutObjectPartInit(false))
|
m.SetObjectPart(GeneratePutObjectPartInit(false))
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -362,7 +364,7 @@ func GenerateHeadResponseBody(empty bool) *object.HeadResponseBody {
|
||||||
m := new(object.HeadResponseBody)
|
m := new(object.HeadResponseBody)
|
||||||
|
|
||||||
if !empty {
|
if !empty {
|
||||||
switch random.Uint32(3) {
|
switch randomInt(3) {
|
||||||
case 0:
|
case 0:
|
||||||
m.SetHeaderPart(GenerateHeaderWithSignature(false))
|
m.SetHeaderPart(GenerateHeaderWithSignature(false))
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -524,7 +526,7 @@ func GenerateGetRangeResponseBody(empty bool) *object.GetRangeResponseBody {
|
||||||
m := new(object.GetRangeResponseBody)
|
m := new(object.GetRangeResponseBody)
|
||||||
|
|
||||||
if !empty {
|
if !empty {
|
||||||
switch random.Uint32(2) {
|
switch randomInt(2) {
|
||||||
case 0:
|
case 0:
|
||||||
m.SetRangePart(GenerateGetRangePartChunk(false))
|
m.SetRangePart(GenerateGetRangePartChunk(false))
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -642,3 +644,7 @@ func GeneratePutSingleResponse(empty bool) *object.PutSingleResponse {
|
||||||
m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty))
|
m.SetVerificationHeader(sessiontest.GenerateResponseVerificationHeader(empty))
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func randomInt(n int) int {
|
||||||
|
return rand.New(rand.NewSource(time.Now().UnixNano())).Intn(n)
|
||||||
|
}
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package sessiontest
|
package sessiontest
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"math/rand"
|
||||||
|
"time"
|
||||||
|
|
||||||
acltest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/test"
|
acltest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/test"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/internal/random"
|
|
||||||
refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test"
|
refstest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/test"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session"
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/session"
|
||||||
statustest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/test"
|
statustest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/status/test"
|
||||||
|
@ -167,7 +169,7 @@ func GenerateSessionTokenBody(empty bool) *session.TokenBody {
|
||||||
m.SetOwnerID(refstest.GenerateOwnerID(false))
|
m.SetOwnerID(refstest.GenerateOwnerID(false))
|
||||||
m.SetLifetime(GenerateTokenLifetime(false))
|
m.SetLifetime(GenerateTokenLifetime(false))
|
||||||
|
|
||||||
switch random.Uint32(2) {
|
switch randomInt(2) {
|
||||||
case 0:
|
case 0:
|
||||||
m.SetContext(GenerateObjectSessionContext(false))
|
m.SetContext(GenerateObjectSessionContext(false))
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -236,3 +238,7 @@ func GenerateXHeaders(empty bool) []session.XHeader {
|
||||||
|
|
||||||
return xs
|
return xs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func randomInt(n int) int {
|
||||||
|
return rand.New(rand.NewSource(time.Now().UnixNano())).Intn(n)
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue