Skip to content

Commit

Permalink
ci: fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkgos committed Jul 1, 2024
1 parent 89c3d65 commit c6ebd6e
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
go test -v -race -coverprofile=coverage -covermode=atomic ./...
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v4
with:
files: ./coverage
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ jobs:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22.x"
cache: false

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22.x"
cache: false
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with: # BUG: typecheck error when enable all
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: goreleaser

on:
push:
# run only against tags
tags:
- "*"

permissions:
contents: write
# packages: write
# issues: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --force --tags
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ">=1.22.0"
cache: true
# More assembly might be required: Docker logins, GPG, etc. It all depends
# on your needs.
- name: Release binary
uses: goreleaser/goreleaser-action@v6
with:
# either 'goreleaser' (default) or 'goreleaser-pro':
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro'
# distribution:
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
70 changes: 70 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com

# The lines below are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/need to use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 1

env:
- GO111MODULE=on

snapshot:
name_template: "{{ incpatch .Version }}-next"

# 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:
- main: .
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
- "386"
- arm
goarm:
- "7"
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- -s -w
# If true, skip the build. for library projects.
skip: true

archives:
- name_template: >-
{{ .ProjectName }}_
{{- .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}'
format_overrides:
- goos: windows
format: zip
checksum:
name_template: "checksums.txt"

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
# modelines, 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
6 changes: 3 additions & 3 deletions queue/priority_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ func NewPriorityQueue[T cmp.Ordered](maxHeap bool, items ...T) *PriorityQueue[T]

// NewPriorityQueue initializes and returns an Queue, default min heap.
func NewPriorityQueueWith[T comparable](maxHeap bool, compare comparator.Comparable[T], items ...T) *PriorityQueue[T] {
q := &PriorityQueue[T]{
pq := &PriorityQueue[T]{
container: &comparator.Container[T]{
Items: items,
Desc: maxHeap,
Compare: compare,
},
}
heap.Init(q.container)
return q
heap.Init(pq.container)
return pq
}

// Len returns the length of this priority queue.
Expand Down

0 comments on commit c6ebd6e

Please sign in to comment.