Skip to content

Commit

Permalink
revise github flow
Browse files Browse the repository at this point in the history
  • Loading branch information
sillygod committed May 15, 2020
1 parent 0190410 commit aa6cd57
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,29 @@ on:
tags:
- 'v*'


name: create release

jobs:
build:
name: build assets and make release
runs-on: ubuntu-latest
steps:
- name: set up go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.14
id: go

- name: checkout
uses: actions/checkout@v2

- name: build
run: |
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o caddy cmd/main.go
zip linux-binary caddy
- name: create release
id: create_release
uses: actions/create-lease@v1
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand All @@ -38,3 +44,12 @@ jobs:
asset_path: ./linux-binary.zip
asset_name: linux-binary.zip
asset_content_type: application/zip

- name: docker build and push
uses: docker/build-push-action@v1
with:
registry: docker.pkg.github.com
repository: sillygod/cdp-cache/caddy
username: sillygod
password: ${{ secrets.GITHUB_TOKEN }}
tags: ${{ github.ref }}
3 changes: 1 addition & 2 deletions cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,6 @@ func getCacheStatus(req *http.Request, response *Response, config *Config) (bool
return false, time.Now()
}

// TODO: the expiration here.. is weird
// implement my own cache expire rule
reasonsNotToCache, expiration, _, _, err := judgeResponseShouldCacheOrNot(req, response.Code, response.snapHeader, false)
if err != nil {
return false, time.Time{}
Expand Down Expand Up @@ -348,6 +346,7 @@ type HTTPCache struct {

// NewHTTPCache new a HTTPCache to hanle cache entries
func NewHTTPCache(config *Config) *HTTPCache {
// TODO: think how to apply UsagePool
entries := make([]map[string][]*Entry, config.CacheBucketsNum)
entriesLock := make([]*sync.RWMutex, config.CacheBucketsNum)

Expand Down
1 change: 0 additions & 1 deletion url_lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ type URLLock struct {
urlLockBucketsSize int
}

// It seems that this lock is related to uri
func NewURLLock(config *Config) *URLLock {
globalLocks := make([]*sync.Mutex, config.CacheBucketsNum)
keys := make([]map[string]*sync.Mutex, config.CacheBucketsNum)
Expand Down

0 comments on commit aa6cd57

Please sign in to comment.