Skip to content

Commit

Permalink
feat(ci): init
Browse files Browse the repository at this point in the history
  • Loading branch information
sevennt committed Oct 23, 2024
1 parent 75046ea commit bdc0a1c
Show file tree
Hide file tree
Showing 9 changed files with 183 additions and 22 deletions.
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: https://cdn.gocn.vip/gotomicro/s.jpeg
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/custom.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Custom issue template
about: Describe this issue template's purpose here.
title: ''
labels: ''
assignees: ''

---


20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
36 changes: 36 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: golangci-lint
on:
push:
tags:
- v*
branches:
- master
- main
pull_request:
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.55

# Optional: working directory, useful for monorepos
# working-directory: ./

# Optional: golangci-lint command line arguments.
args: --timeout=5m --print-issued-lines=true --print-linter-name=true --uniq-by-line=true

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true then the action will use pre-installed Go
# skip-go-installation: true
55 changes: 55 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Go

on:
push:
pull_request:

jobs:
tests:
runs-on: ubuntu-latest
services:
minio:
image: minio/minio:RELEASE.2023-08-09T23-30-22Z
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.22
- name: test-cos
env:
ENDPOINT: $COS_ENDPOINT
REGION: $COS_REGION
BUCKET: $COS_BUCKET
AK_ID: $COS_AK_ID
AK_SECRET: $COS_AK_SECRET
BUCKET_SHARD: $COS_BUCKET_SHARD
run:
go test -run=TestS3 -v -race $(go list ./... | grep -v /examples)
- name: test-minio
env:
ENDPOINT: $MINIO_ENDPOINT
REGION: $MINIO_REGION
BUCKET: $MINIO_BUCKET
AK_ID: $MINIO_AK_ID
AK_SECRET: $MINIO_AK_SECRET
BUCKET_SHARD: $MINIO_BUCKET_SHARD
run: go test -run=TestS3 -v -race $(go list ./... | grep -v /examples)
- name: test-obs
env:
ENDPOINT: $OBS_ENDPOINT
REGION: $OBS_REGION
BUCKET: $OBS_BUCKET
AK_ID: $OBS_AK_ID
AK_SECRET: $OBS_AK_SECRET
BUCKET_SHARD: $OBS_BUCKET_SHARD
run: go test -run=TestS3 -v -race $(go list ./... | grep -v /examples)
- name: test-oss
env:
ENDPOINT: $OSS_ENDPOINT
REGION: $OSS_REGION
BUCKET: $OSS_BUCKET
AK_ID: $OSS_AK_ID
AK_SECRET: $OSS_AK_SECRET
BUCKET_SHARD: $OSS_BUCKET_SHARD
run: go test -run=TestOSS -v -race $(go list ./... | grep -v /examples)
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ dev/
logs/
.env
.env-oss
coverage.txt
18 changes: 6 additions & 12 deletions aws_test.go

Large diffs are not rendered by default.

15 changes: 5 additions & 10 deletions oss_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ const (
content = "aaaaaa"
expectLength = 6
expectHead = 1

compressGUID = "test123-snappy"
compressContent = "snappy-contentsnappy-contentsnappy-contentsnappy-content"
)

var (
Expand All @@ -47,17 +44,15 @@ ssl = false
shards = [%s]
compressLimit = 0
prefix = "abc-01"
enableCompressor = %t
compressType = "%s"
`

func init() {
ossCmp = newOssCmp(os.Getenv("BUCKET"), "", true, "gzip")
ossCmp = newOssCmp(os.Getenv("BUCKET"), "")
}

func newOssCmp(bucket string, shards string, enableCompressor bool, compressType string) *Component {
func newOssCmp(bucket string, shards string) *Component {
newConfs := fmt.Sprintf(ossConfs, os.Getenv("AK_ID"), os.Getenv("AK_SECRET"), os.Getenv("ENDPOINT"),
bucket, os.Getenv("REGION"), shards, enableCompressor, compressType)
bucket, os.Getenv("REGION"), shards)
if err := econf.LoadFromReader(strings.NewReader(newConfs), toml.Unmarshal); err != nil {
panic(err)
}
Expand All @@ -67,7 +62,7 @@ func newOssCmp(bucket string, shards string, enableCompressor bool, compressType

func TestOSS_GetBucketName(t *testing.T) {
bucketShard := os.Getenv("BUCKET_SHARD")
cmp := newOssCmp(bucketShard, `"abcdefghijklmnopqr", "stuvwxyz0123456789"`, true, "gzip")
cmp := newOssCmp(bucketShard, `"abcdefghijklmnopqr", "stuvwxyz0123456789"`)

ctx := context.TODO()
bn, err := cmp.GetBucketName(ctx, "fasdfsfsfsafsf")
Expand Down Expand Up @@ -215,7 +210,7 @@ func TestOSS_GetNotExist(t *testing.T) {
}

func TestOSS_Range(t *testing.T) {
cmp := newOssCmp(os.Getenv("BUCKET"), "", false, "")
cmp := newOssCmp(os.Getenv("BUCKET"), "")

ctx := context.TODO()
cmp.Del(ctx, guid)
Expand Down

0 comments on commit bdc0a1c

Please sign in to comment.