From e64b6608409bb4babccc5cb584814a6042db286b Mon Sep 17 00:00:00 2001 From: Oleg Kovalov Date: Thu, 5 Oct 2023 11:35:18 +0200 Subject: [PATCH] Update CI (#3) --- .github/dependabot.yml | 18 +++++++++++ .github/workflows/build.yml | 60 +++++-------------------------------- example_test.go | 4 +-- sse.go | 1 - 4 files changed, 28 insertions(+), 55 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..008272a --- /dev/null +++ b/.github/dependabot.yml @@ -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" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5070c22..c800836 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/example_test.go b/example_test.go index e7f4832..54cf9af 100644 --- a/example_test.go +++ b/example_test.go @@ -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 { @@ -25,7 +25,7 @@ func Example_UpgradeHTTP() { }) } -func Example_Upgrader() { +func ExampleUpgrader() { ln, err := net.Listen("tcp", "localhost:8080") if err != nil { panic(err) diff --git a/sse.go b/sse.go index 12bf601..3ab23f5 100644 --- a/sse.go +++ b/sse.go @@ -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") }