Add crazy badges to README

This commit is contained in:
世界 2024-07-06 09:03:50 +08:00
parent d7af8bd589
commit 6ada0cc22e
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
8 changed files with 87 additions and 48 deletions

View File

@ -1,33 +0,0 @@
name: Debug build
on:
push:
branches:
- main
- dev
paths-ignore:
- '**.md'
- '.github/**'
- '!.github/workflows/debug.yml'
pull_request:
branches:
- main
- dev
jobs:
build:
name: Debug build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ^1.22
continue-on-error: true
- name: Run Test
run: |
go test -v ./...

View File

@ -1,4 +1,4 @@
name: Lint
name: lint
on:
push:
@ -20,16 +20,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ^1.22
- name: Cache go module
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
key: go-${{ hashFiles('**/go.sum') }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
uses: golangci/golangci-lint-action@v6
with:
version: latest
args: --timeout=30m
install-mode: binary

64
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,64 @@
name: test
on:
push:
branches:
- main
- dev
paths-ignore:
- '**.md'
- '.github/**'
- '!.github/workflows/debug.yml'
pull_request:
branches:
- main
- dev
jobs:
build:
name: Linux
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ^1.22
- name: Build
run: |
make test
build_windows:
name: Windows
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ^1.22
continue-on-error: true
- name: Build
run: |
make test
build_darwin:
name: macOS
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ^1.22
continue-on-error: true
- name: Build
run: |
make test

View File

@ -5,7 +5,6 @@ linters:
- govet
- gci
- staticcheck
- paralleltest
linters-settings:
gci:
@ -14,5 +13,3 @@ linters-settings:
- standard
- prefix(github.com/sagernet/)
- default
staticcheck:
go: '1.20'

View File

@ -35,6 +35,9 @@ lint:
lint_install:
go install -v github.com/golangci/golangci-lint/cmd/golangci-lint@latest
test:
go test ./...
release:
goreleaser release --clean --skip publish
mkdir dist/release

View File

@ -1,5 +1,8 @@
# serenity
![test](https://github.com/sagernet/sing/actions/workflows/test.yml/badge.svg)
![lint](https://github.com/sagernet/sing/actions/workflows/lint.yml/badge.svg)
The configuration generator for sing-box.
## Documentation

View File

@ -7,7 +7,7 @@ import (
"github.com/sagernet/sing-box/option"
"github.com/sagernet/sing/common/json"
"github.com/sagernet/sing/common/rw"
"github.com/sagernet/sing/common/varbin"
)
type Subscription struct {
@ -23,7 +23,7 @@ func (c *Subscription) MarshalBinary() ([]byte, error) {
if err != nil {
return nil, err
}
err = rw.WriteUVariant(&buffer, uint64(len(content)))
_, err = varbin.WriteUvarint(&buffer, uint64(len(content)))
if err != nil {
return nil, err
}
@ -35,7 +35,7 @@ func (c *Subscription) MarshalBinary() ([]byte, error) {
if err != nil {
return nil, err
}
err = rw.WriteVString(&buffer, c.LastEtag)
err = varbin.Write(&buffer, binary.BigEndian, c.LastEtag)
if err != nil {
return nil, err
}
@ -49,7 +49,7 @@ func (c *Subscription) UnmarshalBinary(data []byte) error {
return err
}
_ = version
contentLength, err := rw.ReadUVariant(reader)
contentLength, err := binary.ReadUvarint(reader)
if err != nil {
return err
}
@ -68,7 +68,7 @@ func (c *Subscription) UnmarshalBinary(data []byte) error {
return err
}
c.LastUpdated = time.Unix(lastUpdatedUnix, 0)
c.LastEtag, err = rw.ReadVString(reader)
err = varbin.Read(reader, binary.BigEndian, &c.LastEtag)
if err != nil {
return err
}

View File

@ -12,6 +12,7 @@ import (
)
func TestFilter1100(t *testing.T) {
t.Parallel()
options := &option.Options{
DNS: &option.DNSOptions{
Rules: []option.DNSRule{