sync project
This commit is contained in:
parent
3ef87c0b6c
commit
c1b170dfec
49
.github/workflows/bazel-build.yml
vendored
49
.github/workflows/bazel-build.yml
vendored
|
@ -1,49 +0,0 @@
|
|||
# This is a basic workflow to help you get started with Actions
|
||||
|
||||
name: Build
|
||||
|
||||
# Controls when the workflow will run
|
||||
on:
|
||||
push:
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
# This workflow contains a single job called "build"
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
# The type of runner that the job will run on
|
||||
runs-on: ${{ matrix.os }}
|
||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup Bazelisk
|
||||
# You may pin to the exact commit or the version.
|
||||
# uses: bazelbuild/setup-bazelisk@2351cf5a7584ce72638fbce7c22e5128a5fcd5b2
|
||||
uses: bazelbuild/setup-bazelisk@v1.0.1
|
||||
with:
|
||||
# The Bazelisk version to download (if necessary) and use. Supports semver spec and ranges.
|
||||
bazelisk-version: 1.x # optional, default is 1.x
|
||||
# Used to query bazelisk releases. Since there's a default, this is typically not supplied by the user.
|
||||
token: ${{ github.token }}
|
||||
# Runs a single command using the runners shell
|
||||
- name: Mount bazel cache # Optional
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: "~/.cache/bazel"
|
||||
key: bazel-${{ matrix.os }}
|
||||
# Runs a set of commands using the runners shell
|
||||
- name: Execute build script
|
||||
shell: bash
|
||||
run: |
|
||||
bazel build //:package
|
||||
|
||||
- name: Bazel artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: all-${{ matrix.os }}
|
||||
path: bazel-bin*/**/*
|
|
@ -1,22 +0,0 @@
|
|||
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
|
||||
load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
|
||||
|
||||
go_library(
|
||||
name = "novalet_lib",
|
||||
srcs = ["main.go"],
|
||||
importpath = "github.com/discordnova/nova/novalet",
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
go_binary(
|
||||
name = "novalet",
|
||||
embed = [":novalet_lib"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
pkg_tar(
|
||||
name = "novalet_pkg",
|
||||
srcs = [":novalet"],
|
||||
mode = "0755",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
|
@ -1,12 +0,0 @@
|
|||
load("@io_bazel_rules_go//go:def.bzl", "go_library")
|
||||
|
||||
go_library(
|
||||
name = "lib",
|
||||
srcs = ["internal_transporter.go"],
|
||||
importpath = "github.com/discordnova/nova/novalet/lib",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//common/gateway",
|
||||
"@com_github_rs_zerolog//log",
|
||||
],
|
||||
)
|
|
@ -1,37 +0,0 @@
|
|||
package lib
|
||||
|
||||
import (
|
||||
"github.com/discordnova/nova/common/gateway"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
type InternalTransporter struct {
|
||||
pullChannel chan []byte
|
||||
pushChannel chan gateway.PushData
|
||||
}
|
||||
|
||||
// NewRabbitMqTransporter creates a rabbitmq transporter using a given url
|
||||
func NewInternalTransporter() (gateway.Transporter, error) {
|
||||
log.Info().Msg("using the memory transporter")
|
||||
|
||||
pullChannel, pushChannel := make(chan []byte), make(chan gateway.PushData)
|
||||
|
||||
go func() {
|
||||
for {
|
||||
// TODO(matthieu): Implement push channel for the internal transporter.
|
||||
<-pushChannel
|
||||
}
|
||||
}()
|
||||
|
||||
return &InternalTransporter{
|
||||
pullChannel: pullChannel,
|
||||
pushChannel: pushChannel,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (t InternalTransporter) PushChannel() chan gateway.PushData {
|
||||
return t.pushChannel
|
||||
}
|
||||
func (t InternalTransporter) PullChannel() chan []byte {
|
||||
return t.pullChannel
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
package lib
|
||||
|
||||
import (
|
||||
stand "github.com/nats-io/nats-streaming-server/server"
|
||||
)
|
||||
|
||||
type NatsStandalone struct {
|
||||
streamingServer *stand.StanServer
|
||||
}
|
||||
|
||||
func NewNatsStandalone() *NatsStandalone {
|
||||
server, err := stand.RunServer("standalone_server")
|
||||
if err != nil {
|
||||
panic("failed to start the server")
|
||||
}
|
||||
return &NatsStandalone{
|
||||
streamingServer: server,
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
websocketLib "github.com/discordnova/nova/gateway/lib/gateway"
|
||||
"github.com/discordnova/nova/novalet/lib"
|
||||
)
|
||||
|
||||
func main() {
|
||||
go lib.NewNatsStandalone()
|
||||
transporter, _ := lib.NewInternalTransporter()
|
||||
websocket := websocketLib.NewGateway(websocketLib.GatewayConnectorOptions{
|
||||
Transporter: transporter,
|
||||
})
|
||||
|
||||
go websocket.Start()
|
||||
}
|
Loading…
Reference in a new issue