Skip to content

Commit

Permalink
Update CI (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
cristaloleg authored Oct 5, 2023
1 parent 0a6ed37 commit e64b660
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 55 deletions.
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: "gomod"
commit-message:
prefix: "deps:"
directory: "/"
schedule:
interval: "weekly"
day: "sunday"
time: "09:00"
- package-ecosystem: "github-actions"
commit-message:
prefix: "ci:"
directory: "/"
schedule:
interval: "weekly"
day: "sunday"
time: "09:00"
60 changes: 8 additions & 52 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,16 @@ name: build

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
tag:
description: 'Tag to create'
required: true
default: 'v0.0.0'
branches: [main]
schedule:
- cron: '0 0 * * 0' # run "At 00:00 on Sunday"

# See https://github.com/cristalhq/.github/.github/workflows
jobs:

build:
name: Build & Test
runs-on: ubuntu-latest

steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.15

- name: Check out code
uses: actions/checkout@v2

- name: Download module dependencies
env:
GOPROXY: "https://proxy.golang.org"
run: go mod download

- name: Test
run: go test -v -coverprofile=coverage.txt ./...

- name: Upload Coverage
uses: codecov/codecov-action@v1
continue-on-error: true
with:
token: ${{secrets.CODECOV_TOKEN}}
file: ./coverage.txt
fail_ci_if_error: false

release:
if: github.event_name == 'workflow_dispatch'

name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Checkout with tags
run: git fetch --prune --unshallow --tags
uses: cristalhq/.github/.github/workflows/build.yml@v0.6.0

- name: Create release
run: |
git log --format="%C(auto) %H %s" `git tag --sort=-committerdate | head -1`...HEAD > changelog.txt
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
gh release create ${{ github.event.inputs.tag }} -F changelog.txt
vuln:
uses: cristalhq/.github/.github/workflows/vuln.yml@v0.6.0
4 changes: 2 additions & 2 deletions example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/cristalhq/sse"
)

func Example_UpgradeHTTP() {
func ExampleUpgradeHTTP() {
http.HandleFunc("/sse", func(w http.ResponseWriter, r *http.Request) {
stream, err := sse.UpgradeHTTP(r, w)
if err != nil {
Expand All @@ -25,7 +25,7 @@ func Example_UpgradeHTTP() {
})
}

func Example_Upgrader() {
func ExampleUpgrader() {
ln, err := net.Listen("tcp", "localhost:8080")
if err != nil {
panic(err)
Expand Down
1 change: 0 additions & 1 deletion sse.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ func UpgradeHTTP(r *http.Request, w http.ResponseWriter) (*Stream, error) {

// LastEventID returns a last ID known by user.
// If it's not presented - empty string will be returnes
//
func LastEventID(r *http.Request) string {
return r.Header.Get("Last-Event-ID")
}
Expand Down

0 comments on commit e64b660

Please sign in to comment.