Skip to content

Commit

Permalink
Merge pull request #9 from HotaruBlaze/dev
Browse files Browse the repository at this point in the history
Merge Dev into Main
  • Loading branch information
HotaruBlaze committed Jun 2, 2024
2 parents 63ab8a5 + 16111ab commit b9a0044
Show file tree
Hide file tree
Showing 45 changed files with 2,315 additions and 1,263 deletions.
112 changes: 92 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,55 +10,129 @@ env:
IMAGE_NAME: gotes3mp

jobs:
build-linux:
name: Build Linux
build-linux-x64:
name: Build Linux - x64
runs-on: ubuntu-latest
permissions:
contents: write
discussions: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Go 1.x
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: ^1.20
go-version: ^1.22
stable: true
id: linux-build
- name: Install Protoc
uses: arduino/setup-protoc@v3
- name: Generate go files
run: |
cd src
go install google.golang.org/protobuf/cmd/protoc-gen-go
go get google.golang.org/grpc/cmd/protoc-gen-go-grpc
export PATH="$PATH:$(go env GOPATH)/bin"
go generate
cd ..
- name: Run Tests
run: go test ./src/...
- name: Build-Linux
run: go build -ldflags="-X 'main.Build=${{ github.event.release.tag_name }}' -X 'main.GitCommit=$GITHUB_SHA'" -o build/goTES3MP-Linux src/*.go
run: |
cd src
CGO_ENABLED=0 go build -ldflags="-X 'main.Build=${{ github.event.release.tag_name }}' -X 'main.GitCommit=$GITHUB_SHA'" -o ../build/goTES3MP_Linux_amd64 .
- name: Generate default config
run: cd build/ &&chmod +x goTES3MP-Linux && ./goTES3MP-Linux

run: cd build/ && chmod +x goTES3MP_Linux_amd64 && ./goTES3MP_Linux_amd64
- name: GH Release
uses: softprops/[email protected].5
uses: softprops/[email protected].15
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
build/goTES3MP-Linux
build/goTES3MP_Linux_amd64
build/config.yaml
build-linux-aarch64:
name: Build Linux - aarch64
runs-on: self-hosted
permissions:
contents: write
discussions: write
steps:
- uses: actions/checkout@v4
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ^1.22
stable: true
id: linux-build
- name: Install Protoc
uses: arduino/setup-protoc@v3
- name: Generate go files
run: |
cd src
go install google.golang.org/protobuf/cmd/protoc-gen-go
go get google.golang.org/grpc/cmd/protoc-gen-go-grpc
export PATH="$PATH:$(go env GOPATH)/bin"
go generate
cd ..
- name: Run Tests
run: go test ./src/...
- name: Build-Linux
run: |
cd src
CGO_ENABLED=0 go build -ldflags="-X 'main.Build=${{ github.event.release.tag_name }}' -X 'main.GitCommit=${GITHUB_SHA}'" -o ../build/goTES3MP-Linux-aarch64 .
- name: Generate default config
run: cd build/ && chmod +x goTES3MP-Linux-aarch64 && ./goTES3MP-Linux-aarch64
- name: GH Release
uses: softprops/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
build/goTES3MP-Linux-aarch64
build/config.yaml
build-windows:
name: Build Windows
runs-on: ubuntu-latest
permissions:
contents: write
discussions: write
steps:
- uses: actions/checkout@v3
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: ^1.20
go-version: ^1.22
stable: true
id: windows-build
- name: Install Protoc
uses: arduino/setup-protoc@v3
- name: Generate go files
run: |
cd src
go install google.golang.org/protobuf/cmd/protoc-gen-go
go get google.golang.org/grpc/cmd/protoc-gen-go-grpc
export PATH="$PATH:$(go env GOPATH)/bin"
go generate
cd ..
- name: Run Tests
run: go test ./src
- name: Build-Windows
run: GOOS=windows GOARCH=amd64 go build -ldflags="-X 'main.Build=${{ github.event.release.tag_name }}' -X 'main.GitCommit=$GITHUB_SHA'" -o build/goTES3MP-Windows.exe src/*.go

run: |
cd src
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="-X 'main.Build=${{ github.event.release.tag_name }}' -X 'main.GitCommit=$GITHUB_SHA'" -o build/goTES3MP-Windows-amd64.exe .
- name: GH Release
uses: softprops/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: build/goTES3MP-Windows.exe
files: build/goTES3MP-Windows-amd64.exe

add-scripts:
name: Add Scripts
runs-on: ubuntu-latest
permissions:
contents: write
discussions: write
steps:
- uses: actions/checkout@v3

Expand All @@ -77,27 +151,25 @@ jobs:

build-dockerImage:
runs-on: ubuntu-latest
# If running with act, Uncomment below
# container: phaze9/action-runner
env:
DOCKER_CONFIG: $HOME/.docker
steps:
- uses: actions/checkout@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

- name: Login to ghcr.io
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ${{ env.IMAGE_REGISTRY }}
username: ${{ env.IMAGE_OWNER }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Docker Image
id: docker_build_x64
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Test PR

on:
pull_request:
branches:
- main
- dev

jobs:
test:
name: Test PR
runs-on: ubuntu-latest

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

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ^1.22
stable: true

- name: Generate go files
run: go generate

- name: Install dependencies
run: go mod download

- name: Run Tests
run: go test -v ./src
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ goTES3MP/logs/
build/
config.yaml
goTES3MP/data.json
version.go
.vscode/
13 changes: 10 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
FROM golang:1.20-alpine as BUILDER
FROM golang:1.22-alpine as BUILDER

RUN mkdir /app
WORKDIR /app
Expand All @@ -9,9 +9,16 @@ ARG GITHUB_SHA

COPY ["go.mod", "go.sum", "./"]
COPY ["src/", "./src/"]
COPY ["tes3mp/scripts/custom/IrcBridge/IrcBridge.lua", "/app/tes3mp/scripts/custom/IrcBridge/IrcBridge.lua"]

RUN go mod download && \
go build -ldflags="-X 'main.Build=$BUILD_VERSION' -X 'main.GitCommit=$GITHUB_SHA'" -o /app/build/goTES3MP-Linux src/*.go
RUN apk add --no-cache protoc

RUN cd src && \
go install google.golang.org/protobuf/cmd/protoc-gen-go && \
go get google.golang.org/grpc/cmd/protoc-gen-go-grpc && \
go generate && \
go mod download && \
go build -ldflags="-X 'main.Build=$BUILD_VERSION' -X 'main.GitCommit=$GITHUB_SHA'" -o /app/build/goTES3MP-Linux .


FROM golang:1.20-alpine as RUNNER
Expand Down
4 changes: 0 additions & 4 deletions docs/methods.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# GoTES3MP Methods

### Note: syncid is not used however it hasnt been fully removed from the source code and still has to be included in some places, however can be a blank string.

# "Sync" Method: [Link](../tes3mp/scripts/custom/goTES3MP\sync.lua)
```lua
local messageJson = {
Expand Down Expand Up @@ -31,7 +29,6 @@ local messageJson =
method = "rawDiscord",
source = "TES3MP",
serverid = goTES3MP.GetServerID(),
syncid = GoTES3MPSyncID,
data = {
channel = discordChannel,
server = discordServer,
Expand All @@ -52,7 +49,6 @@ local messageJson = {
method = "VPNCheck",
source = "TES3MP",
serverid = goTES3MP.GetServerID(),
syncid = GoTES3MPSyncID,
data = {
channel = discordChannel,
server = discordServer,
Expand Down
46 changes: 28 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,38 +1,48 @@
module github.com/hotarublaze/gotes3mp

go 1.20
go 1.22

require (
github.com/bwmarrin/discordgo v0.27.1
github.com/fatih/color v1.15.0
github.com/fsnotify/fsnotify v1.6.0
github.com/bwmarrin/discordgo v0.27.2-0.20230816134654-ff9176adccb6
github.com/fatih/color v1.16.0
github.com/fsnotify/fsnotify v1.7.0
github.com/golang/protobuf v1.5.4
github.com/google/go-github v17.0.0+incompatible
github.com/google/uuid v1.6.0
github.com/hashicorp/go-version v1.6.0
github.com/sirupsen/logrus v1.9.0
github.com/spf13/viper v1.15.0
github.com/sirupsen/logrus v1.9.3
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.8.4
github.com/thoj/go-ircevent v0.0.0-20210723090443-73e444401d64
github.com/tidwall/pretty v1.2.1
golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a
google.golang.org/protobuf v1.33.0
)

require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.18 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.7 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit b9a0044

Please sign in to comment.