Skip to content

Commit

Permalink
debug build
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-guard committed Feb 15, 2024
1 parent 5fe3579 commit 3bc95f3
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 4 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,54 @@ jobs:
with:
name: server-manager-windows
path: ./server-manager.zip

build-windows-debug:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '16.x'

- name: download mikeros tools
uses: arma-actions/mikero-tools@latest

- name: Install deps
run: npm ci
- name: Install ui deps
run: npm run install:ui

- name: Set version
if: startsWith(github.ref, 'refs/tags/v')
run: npm version ${{ github.ref_name }}

- name: Set mod debug flags
run: |
echo "#define DayZServerManager" > "watcher_mod/DayZServerManager/Scripts/Common/DayZServerManager/ServerManagerDefines.c"
echo "#define DZSM_DEBUG" >> "watcher_mod/DayZServerManager/Scripts/Common/DayZServerManager/ServerManagerDefines.c"
echo "#define DZSM_DEBUG_CONTAINER" >> "watcher_mod/DayZServerManager/Scripts/Common/DayZServerManager/ServerManagerDefines.c"
- name: Set manager debug flags
run: |
echo "export const dzsmDebugHttp = true;" > "src/config/constants.ts"
echo "export const dzsmDebugLogReader = true;" >> "src/config/constants.ts"
echo "export const dzsmDebugProcessList = true;" >> "src/config/constants.ts"
- name: Build
run: npm run build

- name: Pack (windows)
run: npm run pack:windows

- name: Zip Artifacts (windows)
run: powershell Compress-Archive -Path 'build/*' -DestinationPath 'server-manager.zip'

- name: Archive build artifacts (windows)
uses: actions/upload-artifact@v2
with:
name: server-manager-windows-debug
path: ./server-manager.zip

build-ubuntu-18:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -203,6 +251,7 @@ jobs:
- build-ubuntu-18
- build-ubuntu-latest
- build-windows
- build-windows-debug

steps:
- name: Create Release
Expand Down Expand Up @@ -235,6 +284,26 @@ jobs:
asset_path: ./server-manager-windows.zip
asset_name: server-manager-windows.zip
asset_content_type: application/zip

- name: Download artifacts (windows debug)
uses: actions/download-artifact@v2
with:
name: server-manager-windows-debug

- name: Rename
run: |
mv server-manager.zip server-manager-windows-debug.zip
- name: Upload Release Asset (Windows Debug)
id: upload-release-asset-windows-debug
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./server-manager-windows-debug.zip
asset_name: server-manager-windows-debug.zip
asset_content_type: application/zip

- name: Download artifacts (ubuntu 18)
uses: actions/download-artifact@v2
Expand Down
3 changes: 3 additions & 0 deletions src/config/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const dzsmDebugHttp = false;
export const dzsmDebugLogReader = false;
export const dzsmDebugProcessList = false;
3 changes: 2 additions & 1 deletion src/middleware/logger.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Request, Response } from 'express';
import { Logger, LogLevel } from '../util/logger';
import { dzsmDebugHttp } from '../config/constants';

const logger = new Logger('HTTP API');

/* istanbul ignore next */
export const loggerMiddleware = (req: Request, resp: Response, next: any): void => {
if (process.env['DZSM_DEBUG_HTTP'] === 'true') {
if (process.env['DZSM_DEBUG_HTTP'] === 'true' || dzsmDebugHttp) {
logger.log(
LogLevel.DEBUG,
'Request:',
Expand Down
3 changes: 2 additions & 1 deletion src/services/log-reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { LoggerFactory } from './loggerfactory';
import { FSAPI, InjectionTokens } from '../util/apis';
import { EventBus } from '../control/event-bus';
import { InternalEventTypes } from '../types/events';
import { dzsmDebugLogReader } from '../config/constants';

export interface LogContainer {
logFiles?: FileDescriptor[];
Expand Down Expand Up @@ -143,7 +144,7 @@ export class LogReader extends IStatefulService {
});
logContainer.tail.on('line', (line) => {
if (line) {
if (process.env['DZSM_DEBUG_LOG_READER'] === 'true') {
if (process.env['DZSM_DEBUG_LOG_READER'] === 'true' || dzsmDebugLogReader) {
this.log.log(LogLevel.DEBUG, `${type} - ${line}`);
}
const logEntry = {
Expand Down
3 changes: 2 additions & 1 deletion src/services/server-detector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { LogLevel } from '../util/logger';
import { IService } from '../types/service';
import { injectable, singleton } from 'tsyringe';
import { LoggerFactory } from './loggerfactory';
import { dzsmDebugProcessList } from '../config/constants';

@singleton()
@injectable()
Expand All @@ -28,7 +29,7 @@ export class ServerDetector extends IService {
this.manager.getServerExePath(),
);

if (process.env['DZSM_DEBUG_PROCESS_LIST'] === 'true') {
if (process.env['DZSM_DEBUG_PROCESS_LIST'] === 'true' || dzsmDebugProcessList) {
this.log.log(
LogLevel.DEBUG,
'Fetched new Process list',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#define DayZServerManager

// #define DZSM_DEBUG
// #define DZSM_DEBUG
// #define DZSM_DEBUG_CONTAINER

0 comments on commit 3bc95f3

Please sign in to comment.