mirror of
https://github.com/pagefaultgames/rogueserver.git
synced 2025-04-03 03:27:13 +08:00
Update rogueserver
This commit is contained in:
parent
2da5ccaa33
commit
c14d667fc1
52
.github/workflows/ci.yml
vendored
52
.github/workflows/ci.yml
vendored
@ -1,52 +0,0 @@
|
|||||||
name: Build
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build (${{ matrix.os_name }})
|
|
||||||
env:
|
|
||||||
GO_VERSION: 1.22
|
|
||||||
GOOS: ${{ matrix.os_name }}
|
|
||||||
GOARCH: ${{ matrix.arch }}
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- os: ubuntu-latest
|
|
||||||
os_name: linux
|
|
||||||
arch: amd64
|
|
||||||
- os: windows-latest
|
|
||||||
os_name: windows
|
|
||||||
arch: amd64
|
|
||||||
# TODO macos needs universal binary!
|
|
||||||
# - os: macos-latest
|
|
||||||
# os_name: macos
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: Set up Go ${{ env.GO_VERSION }}
|
|
||||||
uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: ${{ env.GO_VERSION }}
|
|
||||||
- name: Install dependencies
|
|
||||||
run: go mod download
|
|
||||||
- name: Lint Codebase
|
|
||||||
continue-on-error: true
|
|
||||||
uses: golangci/golangci-lint-action@v6
|
|
||||||
with:
|
|
||||||
version: latest
|
|
||||||
args: --config .golangci.yml
|
|
||||||
- name: Test
|
|
||||||
run: go test -v
|
|
||||||
- name: Build
|
|
||||||
run: go build -v
|
|
||||||
- name: Upload artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: rogueserver-${{ matrix.os_name }}-${{ matrix.arch }}-${{ github.sha }}
|
|
||||||
path: |
|
|
||||||
rogueserver*
|
|
||||||
!rogueserver.go
|
|
38
.github/workflows/ghcr.yml
vendored
38
.github/workflows/ghcr.yml
vendored
@ -1,38 +0,0 @@
|
|||||||
name: Publish to GHCR
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build and publish to GHCR
|
|
||||||
if: github.repository == 'pagefaultgames/rogueserver'
|
|
||||||
env:
|
|
||||||
GO_VERSION: 1.22
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Setup Docker BuildX
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
- name: Log into container registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.repository_owner }}
|
|
||||||
password: ${{ github.token }}
|
|
||||||
- name: Extract Docker metadata
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: ghcr.io/${{ github.repository }}
|
|
||||||
- name: Build Docker image
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
build-args: |
|
|
||||||
GO_VERSION=${{ env.GO_VERSION }}
|
|
||||||
VERSION=${{ github.ref_name }}-SNAPSHOT
|
|
||||||
COMMIT_SHA=${{ env.GITHUB_SHA_SHORT }}
|
|
@ -45,7 +45,6 @@ func main() {
|
|||||||
dbaddr := os.Getenv("dbaddr")
|
dbaddr := os.Getenv("dbaddr")
|
||||||
dbname := os.Getenv("dbname")
|
dbname := os.Getenv("dbname")
|
||||||
|
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
// register gob types
|
// register gob types
|
||||||
@ -76,11 +75,8 @@ func main() {
|
|||||||
handler := prodHandler(mux)
|
handler := prodHandler(mux)
|
||||||
if debug {
|
if debug {
|
||||||
handler = debugHandler(mux)
|
handler = debugHandler(mux)
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
err = http.ServeTLS(listener, handler, *tlscert, *tlskey)
|
err = http.Serve(listener, handler)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("failed to create http server or server errored: %s", err)
|
log.Fatalf("failed to create http server or server errored: %s", err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user