Skip to content

Commit

Permalink
feat: add release
Browse files Browse the repository at this point in the history
  • Loading branch information
rfyiamcool committed Mar 14, 2023
1 parent 7170f5b commit 8946e0b
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
.vscode
pgcacher
.DS_Store

dist/
46 changes: 46 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
- arm64

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of uname.
name_template: >-
{{ .ProjectName }}_v{{ .Version }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
# use zip for windows archives
format_overrides:
- goos: windows
format: zip
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

# The lines beneath this are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
10 changes: 10 additions & 0 deletions pgcacher_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package main

import (
"os"
"testing"

"github.com/stretchr/testify/assert"
ppc "github.com/tobert/pcstat/pkg"
)

func TestMatch(t *testing.T) {
Expand All @@ -13,3 +15,11 @@ func TestMatch(t *testing.T) {
assert.True(t, wildcardMatch("xiaorui.cc", "*xiaorui?cc*"))
assert.True(t, wildcardMatch("github.com/rfyiamcool", "rfy"))
}

func TestNull(t *testing.T) {
ppc.SwitchMountNs(os.Getegid())
stat, err := ppc.GetPcStatus(os.Args[0])
assert.Nil(t, err)

t.Logf("%s %v", stat.Name, stat.Cached)
}

0 comments on commit 8946e0b

Please sign in to comment.