Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 55 additions & 16 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,74 @@ on:
pull_request:
branches: [master]
jobs:
build:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: "^1.21"
- name: Extract branch name
id: extract_branch
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//-/g')" >> $GITHUB_ENV
- uses: paulhatch/semantic-version@v5.3.0
id: version
go-version: "^1.24"
- run: make test
name: Unit tests

integration-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
version_format: "${major}.${minor}.${patch}-${{ env.BRANCH_NAME }}${increment}"
#- name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
go-version: "^1.24"
- run: make test-integration-docker
name: Run integration tests inside Docker

#- name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- run: make test
name: Unit tests
validate-api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "^1.24"
- run: make validate-api
name: Validate API

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "^1.24"
- run: make build
name: Build
- run: make build-plugins
name: Build Plugins
- uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
bin/druid
bin/druid_rcon
bin/druid_rcon_web_rust
.docker/entrypoint.sh
.docker/druid-install-command.sh

prerelease:
runs-on: ubuntu-latest
needs: [unit-tests, integration-tests, validate-api, build]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract branch name
id: extract_branch
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//-/g')" >> $GITHUB_ENV
- uses: paulhatch/semantic-version@v5.3.0
id: version
with:
version_format: "${major}.${minor}.${patch}-${{ env.BRANCH_NAME }}${increment}"
- uses: actions/download-artifact@v4
with:
name: build-artifacts
- name: Prerelease
uses: softprops/action-gh-release@v2
with:
Expand Down
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,20 @@
"9190"
],
},
{
"name": "Debug Daemon run install ark",
"type": "go",
"request": "launch",
"mode": "debug",
"console": "integratedTerminal",
"program": "${workspaceFolder}/main.go",
"args": [
"run",
"install",
"--cwd",
"${workspaceFolder}/examples/ark"
],
},
{
"name": "Debug Daemon serve (emtpy dir)",
"type": "go",
Expand Down
18 changes: 12 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@

VERSION ?= "dev"

build: ## Build Daemon
generate-api: ## Generate API types from OpenAPI spec
@echo "Generating API types from OpenAPI spec..."
@which oapi-codegen > /dev/null || (echo "Installing oapi-codegen..." && go install github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@latest)
oapi-codegen -config api/oapi-codegen.yaml api/openapi.yaml

validate-api: ## Validate OpenAPI spec
@echo "Validating OpenAPI spec..."
@which oapi-codegen > /dev/null || (echo "Installing oapi-codegen..." && go install github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@latest)
oapi-codegen -config api/oapi-codegen.yaml api/openapi.yaml > /dev/null
@echo "✓ OpenAPI spec is valid"

build: generate-api ## Build Daemon
CGO_ENABLED=0 go build -ldflags "-X github.com/highcard-dev/daemon/internal.Version=$(VERSION)" -o ./bin/druid

build-x86-docker:
Expand All @@ -18,11 +29,6 @@ build-plugins: ## Build Plugins
proto:
protoc --go_out=paths=source_relative:./ --go-grpc_out=paths=source_relative:./ --go-grpc_opt=paths=source_relative plugin/proto/*.proto

generate-swagger:
swag init -g ./main.go --overridesFile override.swag

serve-swagger: generate-swagger
npx serve ./docs

generate-md-docs:
go run ./docs_md/main.go
Expand Down
6 changes: 6 additions & 0 deletions api/oapi-codegen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package: api
output: internal/api/generated.go
generate:
fiber-server: true
models: true
embedded-spec: true
Loading