Skip to content

Commit

Permalink
Merge branch 'develop' into angular_upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
SakuraIsayeki committed Feb 2, 2024
2 parents 303cc19 + c001613 commit 7f64891
Show file tree
Hide file tree
Showing 12 changed files with 215 additions and 6 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/build-package-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build & Package API

on:
workflow_call:
inputs:
build_configuration:
description: 'Build Configuration'
type: string
required: true

permissions:
contents: read
packages: read

jobs:
# Build prod
build-api-prod:
name: Build API (prod)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
# include-prerelease: true

- name: Build .NET project (prod)
run: dotnet build ./WowsKarma.Api/WowsKarma.Api.csproj --configuration ${{ inputs.build_configuration }}

- name: Package API (prod)
run: dotnet publish ./WowsKarma.Api/WowsKarma.Api.csproj --configuration ${{ inputs.build_configuration }} --output ./publish

- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: wowskarma_api
path: ./publish
45 changes: 45 additions & 0 deletions .github/workflows/build-package-web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build & Package Web App

on:
workflow_call:
inputs:
build_configuration:
description: 'Build Configuration'
type: string
required: true

permissions:
contents: read
packages: read

jobs:
# Build angular app
build-web:
name: Build Web App
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'

- name: Install Angular CLI
run: npm install -g @angular/cli

- name: Install dependencies
working-directory: wowskarma.app
run: npm install

- name: Build Angular app
working-directory: wowskarma.app
run: ng build --configuration=${{ inputs.build_configuration }}

- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: wowskarma_app
path: ./wowskarma.app/dist
66 changes: 66 additions & 0 deletions .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Deploy Preview to Server

on:
push:
branches: [ develop ]

permissions:
contents: read
packages: read
deployments: write

jobs:
# First: Make sure dev build ran fine.
build-test-solution:
name: Build & Test Solution
uses: ./.github/workflows/dotnet-build.yml

# Build & Package API & Web from 'build-package-api.yml' and 'build-package-web.yml'.
build-package-api:
name: Build & Package API
needs: build-test-solution
uses: ./.github/workflows/build-package-api.yml
with:
build_configuration: 'Preview'

build-package-web:
name: Build & Package Web App
needs: build-test-solution
uses: ./.github/workflows/build-package-web.yml
with:
build_configuration: 'preview'

# Deploy to server
deploy-preview:
name: Deploy Preview to server
environment:
name: preview
url: https://preview.wows-karma.com/
needs:
- build-package-api
- build-package-web
runs-on: ubuntu-latest
steps:
- name: Download packaged API artifacts
uses: actions/download-artifact@v4
with:
name: wowskarma_api
path: ./api

- name: Download packaged Web App artifacts
uses: actions/download-artifact@v4
with:
name: wowskarma_app
path: ./web

- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATEKEY }}
known_hosts: '*.nodsoft.net'

- name: Add Known Hosts
run: ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts

- name: Deploy with rsync
run: rsync -rvmzOE . ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{ secrets.SSH_DEPLOYPATH }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -371,3 +371,5 @@ wowskarma.app/pnpm-lock.yaml
.store/

wowskarma.api.minimap/main.py

WowsKarma.Api/appsettings.Preview.json
4 changes: 3 additions & 1 deletion WowsKarma.Api/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,16 @@ public void ConfigureServices(IServiceCollection services)
});

services.AddResiliencePolicies();

services.AddSystemd();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseETagger();
app.UseResponseCompression();

app.UseSwagger();
app.UseSwaggerUI(c =>
{
Expand Down
1 change: 1 addition & 0 deletions WowsKarma.Api/WowsKarma.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="8.0.0" />
<PackageReference Include="NodaTime" Version="3.1.9" />
<PackageReference Include="Nodsoft.Wargaming.Api.Client" Version="0.3.5" />
<PackageReference Include="Nodsoft.WowsReplaysUnpack.ExtendedData" Version="2.0.1" />
Expand Down
29 changes: 28 additions & 1 deletion wowskarma.app/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,40 @@
],
"outputHashing": "all"
},
"preview": {
"budgets": [
{
"type": "initial",
"maximumWarning": "1mb",
"maximumError": "4mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.preview.ts"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
"namedChunks": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.development.ts"
}
]
}
},
"defaultConfiguration": "production"
Expand Down
2 changes: 1 addition & 1 deletion wowskarma.app/src/app/services/hubs/hub-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@ export abstract class HubBase {
.withAutomaticReconnect()
// Disabled the MessagePack serializer, due to casing issues.
//.withHubProtocol(new signalRMsgPack.MessagePackHubProtocol())
.configureLogging(environment.production ? signalR.LogLevel.Warning : signalR.LogLevel.Information)
.configureLogging(environment.name !== "development" ? signalR.LogLevel.Warning : signalR.LogLevel.Information)
}
25 changes: 25 additions & 0 deletions wowskarma.app/src/environments/environment.preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export const environment = {
name: "preview",

apiHost: {
EU: "https://api.preview.wows-karma.com",
NA: "https://api.preview.wows-karma.com",
CIS: "https://api.preview.wows-karma.com",
SEA: "https://api.preview.wows-karma.com",
},

applicationInsights: {
connectionString: "InstrumentationKey=3fab5b95-b531-4f15-95e9-83f31e2ed531;IngestionEndpoint=https://francecentral-1.in.applicationinsights.azure.com/;LiveEndpoint=https://francecentral.livediagnostics.monitor.azure.com/",
},

cookies: {
domain: "localhost",

name: {
EU: "Auth_EU",
NA: "Auth_NA",
CIS: "Auth_CIS",
SEA: "Auth_SEA",
},
},
};
2 changes: 1 addition & 1 deletion wowskarma.app/src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const environment = {
production: true,
name: "production",

apiHost: {
EU: "https://api.wows-karma.com",
Expand Down
2 changes: 1 addition & 1 deletion wowskarma.app/src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// The list of file replacements can be found in `angular.json`.

export const environment = {
production: false,
name: "development",

apiHost: {
EU: "http://localhost:5010",
Expand Down
2 changes: 1 addition & 1 deletion wowskarma.app/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';

if (environment.production) {
if (environment.name === "production") {
enableProdMode();
//console.debug = (...args: any[]) => {};
}
Expand Down

0 comments on commit 7f64891

Please sign in to comment.