Skip to content

Commit

Permalink
Merge pull request #38 from requiemofthesouls/server-sent-events
Browse files Browse the repository at this point in the history
Add SSE
  • Loading branch information
requiemofthesouls authored Aug 3, 2023
2 parents ff8a1e1 + ccdabda commit 415cd06
Show file tree
Hide file tree
Showing 24 changed files with 952 additions and 343 deletions.
128 changes: 64 additions & 64 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
name: Build docker image and publish release

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
name: Build and push docker image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
file: ./build/package/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

publish-release:
needs: build-and-push-image
name: Publish release
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
draft: false
prerelease: false
token: ${{ secrets.RELEASE_TOKEN }}
#name: Build docker image and publish release
#
#on:
# push:
# tags:
# - 'v[0-9]+.[0-9]+.[0-9]+'
#
#env:
# REGISTRY: ghcr.io
# IMAGE_NAME: ${{ github.repository }}
#
#jobs:
# build-and-push-image:
# name: Build and push docker image
# runs-on: ubuntu-latest
# permissions:
# contents: read
# packages: write
#
# steps:
# - name: Checkout repository
# uses: actions/checkout@v2
#
# - name: Log in to the Container registry
# uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
# with:
# registry: ${{ env.REGISTRY }}
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@v3
# with:
# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
#
# - name: Build and push Docker image
# id: docker_build
# uses: docker/build-push-action@v2
# with:
# context: .
# file: ./build/package/Dockerfile
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
#
# publish-release:
# needs: build-and-push-image
# name: Publish release
# runs-on: ubuntu-latest
# permissions:
# contents: write
# packages: write
# steps:
# - name: Checkout repository
# uses: actions/checkout@v2
#
# - name: Create Release
# uses: softprops/action-gh-release@v1
# if: startsWith(github.ref, 'refs/tags/v')
# with:
# draft: false
# prerelease: false
# token: ${{ secrets.RELEASE_TOKEN }}
200 changes: 100 additions & 100 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,100 +1,100 @@
name: Build and test
on:
[push, pull_request]

jobs:
golangci-lint-github-pr-review:
name: golangci-lint (github-pr-review)
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: golangci-lint w/ github-pr-review
uses: reviewdog/action-golangci-lint@v2
with:
golangci_lint_flags: "--config=.golangci.yml"
tool_name: "golangci-lint-github-pr-review"
reporter: "github-pr-review"
fail_on_error: true

golangci-lint-github-check:
name: golangci-lint (github-check)
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: golangci-lint w/ github-check
uses: reviewdog/action-golangci-lint@v2
with:
golangci_lint_flags: "--config=.golangci.yml"
tool_name: "golangci-lint-github-check"
level: info
reporter: "github-check"
fail_on_error: true

golangci-lint:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: golangci-lint
uses: reviewdog/action-golangci-lint@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
level: info
golangci_lint_flags: "--config=.golangci.yml"
fail_on_error: true

build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Install Go
if: success()
uses: actions/setup-go@v2
with:
go-version: 1.20.x

test:
name: Testing
strategy:
matrix:
go-version: [ 1.20.x ]
platform: [ ubuntu-latest ]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
if: success()
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}

- name: Checkout code
uses: actions/checkout@v2

- name: Run tests
run: |
go test -race ./...
go test -v ./... -covermode=count
coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- name: Install Go
if: success()
uses: actions/setup-go@v2
with:
go-version: 1.20.x

- name: Checkout code
uses: actions/checkout@v2

- name: Calc coverage
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...

- name: Upload coverage to Codecov
run: bash <(curl -s https://codecov.io/bash)


#name: Build and test
#on:
# [push, pull_request]
#
#jobs:
# golangci-lint-github-pr-review:
# name: golangci-lint (github-pr-review)
# runs-on: ubuntu-latest
# steps:
# - name: Check out code into the Go module directory
# uses: actions/checkout@v2
# - name: golangci-lint w/ github-pr-review
# uses: reviewdog/action-golangci-lint@v2
# with:
# golangci_lint_flags: "--config=.golangci.yml"
# tool_name: "golangci-lint-github-pr-review"
# reporter: "github-pr-review"
# fail_on_error: true
#
# golangci-lint-github-check:
# name: golangci-lint (github-check)
# runs-on: ubuntu-latest
# steps:
# - name: Check out code into the Go module directory
# uses: actions/checkout@v2
# - name: golangci-lint w/ github-check
# uses: reviewdog/action-golangci-lint@v2
# with:
# golangci_lint_flags: "--config=.golangci.yml"
# tool_name: "golangci-lint-github-check"
# level: info
# reporter: "github-check"
# fail_on_error: true
#
# golangci-lint:
# name: golangci-lint
# runs-on: ubuntu-latest
# steps:
# - name: Check out code into the Go module directory
# uses: actions/checkout@v2
# - name: golangci-lint
# uses: reviewdog/action-golangci-lint@v2
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# level: info
# golangci_lint_flags: "--config=.golangci.yml"
# fail_on_error: true
#
# build:
# name: Build
# runs-on: ubuntu-latest
# steps:
# - name: Install Go
# if: success()
# uses: actions/setup-go@v2
# with:
# go-version: 1.20.x
#
# test:
# name: Testing
# strategy:
# matrix:
# go-version: [ 1.20.x ]
# platform: [ ubuntu-latest ]
# runs-on: ${{ matrix.platform }}
# steps:
# - name: Install Go
# if: success()
# uses: actions/setup-go@v2
# with:
# go-version: ${{ matrix.go-version }}
#
# - name: Checkout code
# uses: actions/checkout@v2
#
# - name: Run tests
# run: |
# go test -race ./...
# go test -v ./... -covermode=count
#
# coverage:
# name: Coverage
# runs-on: ubuntu-latest
# steps:
# - name: Install Go
# if: success()
# uses: actions/setup-go@v2
# with:
# go-version: 1.20.x
#
# - name: Checkout code
# uses: actions/checkout@v2
#
# - name: Calc coverage
# run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
#
# - name: Upload coverage to Codecov
# run: bash <(curl -s https://codecov.io/bash)
#
#
Loading

0 comments on commit 415cd06

Please sign in to comment.