1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2026-02-04 02:43:32 +00:00

Merge branch 'feature/docs-in-docker' into development

This commit is contained in:
Robert 2025-12-29 12:02:57 +01:00
commit 0823de45a4
6 changed files with 82 additions and 307 deletions

View File

@ -1,36 +0,0 @@
name: Master - DocFX
on:
workflow_dispatch:
push:
branches:
- master
jobs:
docfx:
name: Build DocFX Documentation
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
- name: Setup DocFX
run: dotnet tool update -g docfx
- name: Build Core
run: dotnet build src/Artemis.Core/Artemis.Core.csproj
- name: Build UI.Shared
run: dotnet build src/Artemis.UI.Shared/Artemis.UI.Shared.csproj
- name: Build DocFX
run: docfx docfx/docfx_project/docfx.json
- name: Upload to FTP
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
with:
server: www360.your-server.de
protocol: ftps
username: ${{ secrets.FTP_USER }}
password: ${{ secrets.FTP_PASSWORD }}
local-dir: docfx/docfx_project/_site/
server-dir: /docs/

View File

@ -1,55 +0,0 @@
# .NET Desktop
# Build and run tests for .NET Desktop or Windows classic desktop solutions.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
trigger:
- master
pr: none
pool:
vmImage: 'windows-latest'
variables:
artemisSolution: '**/Artemis.sln'
rgbSolution: '**/RGB.NET.sln'
pluginProjects: '**/Artemis.Plugins.*.csproj'
BuildId: $(Build.BuildId)
BuildNumber: $(Build.BuildNumber)
SourceBranch: $(Build.SourceBranch)
SourceVersion: $(Build.SourceVersion)
steps:
- checkout: self
path: s/Artemis
- task: DotNetCoreCLI@2
displayName: 'dotnet build Artemis'
inputs:
command: 'build'
projects: '$(artemisSolution)'
feedsToUse: 'config'
nugetConfigPath: '$(Pipeline.Workspace)/s/Artemis/src/NuGet.Config'
- task: PowerShell@2
displayName: "DockFX build"
inputs:
targetType: 'inline'
script: |
choco install docfx -y
docfx.exe .\docfx_project\docfx.json
workingDirectory: '$(Pipeline.Workspace)/s/Artemis/docfx'
- task: FtpUpload@2
displayName: "DockFX FTP upload"
inputs:
credentialsOption: 'inputs'
serverUrl: 'ftp://www360.your-server.de'
username: '$(ftp_user)'
password: '$(ftp_password)'
rootDirectory: '$(Pipeline.Workspace)/s/Artemis/docfx/docfx_project/_site'
filePatterns: '**'
remoteDirectory: '/docs'
clean: true
preservePaths: true
trustSSL: false

View File

@ -1,216 +0,0 @@
# .NET Desktop
# Build and run tests for .NET Desktop or Windows classic desktop solutions.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
trigger:
- master
pr: none
resources:
repositories:
- repository: Plugins
type: github
endpoint: github.com_SpoinkyNL
name: Artemis-RGB/Artemis.Plugins
ref: master
variables:
windowsProject: "**/Artemis.UI.Windows/Artemis.UI.Windows.csproj"
linuxProject: "**/Artemis.UI.Linux/Artemis.UI.Linux.csproj"
pluginProjects: "**/Artemis.Plugins.*.csproj"
BuildId: $(Build.BuildId)
BuildNumber: $(Build.BuildNumber)
SourceBranch: $(Build.SourceBranch)
SourceVersion: $(Build.SourceVersion)
jobs:
- job: Windows
pool:
vmImage: "windows-latest"
steps:
- checkout: self
path: s/Artemis
- checkout: Plugins
path: s/Artemis.Plugins
- task: DotNetCoreCLI@2
displayName: "Artemis - Publish"
inputs:
command: "publish"
publishWebProjects: false
projects: "$(windowsProject)"
arguments: '--configuration Release --runtime win10-x64 --output $(Build.ArtifactStagingDirectory)/windows-build /nowarn:cs1591'
zipAfterPublish: false
modifyOutputPath: false
- task: PowerShell@2
displayName: "Artemis - Create buildinfo.json"
inputs:
targetType: "inline"
script: |
$OFS = "`r`n"
SET-Content -Path 'buildinfo.json' -Value ('{' + $OFS + ' "BuildId": 0,' + $OFS + ' "BuildNumber": 0.0,' + $OFS + ' "SourceBranch": "",' + $OFS + ' "SourceVersion": ""' + $OFS + '}')
workingDirectory: "$(Build.ArtifactStagingDirectory)/windows-build"
- task: FileTransform@1
displayName: "Artemis - Populate buildinfo.json"
inputs:
folderPath: "$(Build.ArtifactStagingDirectory)/windows-build"
fileType: "json"
targetFiles: "**/buildinfo.json"
- task: PowerShell@2
displayName: "Plugins - Insert build number into plugin.json"
inputs:
targetType: "inline"
script: |
Get-ChildItem -Recurse -Filter plugin.json |
Foreach-Object {
$buidNumber = "1.0.1." + $Env:BUILD_BUILDID;
$a = Get-Content $_.FullName | ConvertFrom-Json
$a.Version = $buidNumber;
$a | ConvertTo-Json | Set-Content $_.FullName
}
workingDirectory: "Artemis.Plugins"
- task: DotNetCoreCLI@2
displayName: "Plugins - Publish"
inputs:
command: "publish"
publishWebProjects: false
arguments: "--configuration Release --runtime win10-x64 --output $(Build.ArtifactStagingDirectory)/windows-build/Plugins"
projects: "$(pluginProjects)"
zipAfterPublish: true
- task: PublishPipelineArtifact@1
displayName: "Upload build to Azure Pipelines"
inputs:
targetPath: "$(Build.ArtifactStagingDirectory)/windows-build"
artifact: "Artemis build - Windows"
publishLocation: "pipeline"
- task: ArchiveFiles@2
displayName: "ZIP binaries"
inputs:
rootFolderOrFile: "$(Build.ArtifactStagingDirectory)/windows-build"
includeRootFolder: false
archiveType: "zip"
archiveFile: "$(Build.ArtifactStagingDirectory)/archive/artemis-build-windows.zip"
replaceExistingArchive: true
- task: PowerShell@2
displayName: "Calculate ZIP hash"
inputs:
targetType: "inline"
script: '(Get-FileHash .\artemis-build-windows.zip).Hash | Out-File -FilePath .\hash-windows.txt'
workingDirectory: "$(Build.ArtifactStagingDirectory)/archive"
- task: FtpUpload@2
displayName: "Upload binaries to FTP"
inputs:
credentialsOption: "inputs"
serverUrl: "ftp://artemis-rgb.com"
username: "devops"
password: "$(ftp_password)"
rootDirectory: "$(Build.ArtifactStagingDirectory)/archive"
filePatterns: "**"
remoteDirectory: "/builds.artemis-rgb.com/binaries/$(Build.SourceBranchName)/$(Build.BuildNumber)"
clean: false
preservePaths: true
trustSSL: false
- job: Linux
pool:
vmImage: "ubuntu-latest"
steps:
- checkout: self
path: s/Artemis
- checkout: Plugins
path: s/Artemis.Plugins
- task: DotNetCoreCLI@2
displayName: "Artemis - Publish"
inputs:
command: "publish"
publishWebProjects: false
projects: "$(linuxProject)"
arguments: '--configuration Release --runtime linux-x64 --output $(Build.ArtifactStagingDirectory)/linux-build /nowarn:cs1591'
zipAfterPublish: false
modifyOutputPath: false
- task: PowerShell@2
displayName: "Artemis - Create buildinfo.json"
inputs:
targetType: "inline"
script: |
$OFS = "`r`n"
SET-Content -Path 'buildinfo.json' -Value ('{' + $OFS + ' "BuildId": 0,' + $OFS + ' "BuildNumber": 0.0,' + $OFS + ' "SourceBranch": "",' + $OFS + ' "SourceVersion": ""' + $OFS + '}')
workingDirectory: "$(Build.ArtifactStagingDirectory)/linux-build"
- task: FileTransform@1
displayName: "Artemis - Populate buildinfo.json"
inputs:
folderPath: "$(Build.ArtifactStagingDirectory)/linux-build"
fileType: "json"
targetFiles: "**/buildinfo.json"
- task: PowerShell@2
displayName: "Plugins - Insert build number into plugin.json"
inputs:
targetType: "inline"
script: |
Get-ChildItem -Recurse -Filter plugin.json |
Foreach-Object {
$buidNumber = "1.0.1." + $Env:BUILD_BUILDID;
$a = Get-Content $_.FullName | ConvertFrom-Json
$a.Version = $buidNumber;
$a | ConvertTo-Json | Set-Content $_.FullName
}
workingDirectory: "Artemis.Plugins"
- task: DotNetCoreCLI@2
displayName: "Plugins - Publish"
inputs:
command: "publish"
publishWebProjects: false
arguments: "--configuration Release --runtime linux-x64 --output $(Build.ArtifactStagingDirectory)/linux-build/Plugins"
projects: "$(pluginProjects)"
zipAfterPublish: true
- task: PublishPipelineArtifact@1
displayName: "Upload build to Azure Pipelines"
inputs:
targetPath: "$(Build.ArtifactStagingDirectory)/linux-build"
artifact: "Artemis build - Linux"
publishLocation: "pipeline"
- task: ArchiveFiles@2
displayName: "ZIP binaries"
inputs:
rootFolderOrFile: "$(Build.ArtifactStagingDirectory)/linux-build"
includeRootFolder: false
archiveType: "zip"
archiveFile: "$(Build.ArtifactStagingDirectory)/archive/artemis-build-linux.zip"
replaceExistingArchive: true
- task: PowerShell@2
displayName: "Calculate ZIP hash"
inputs:
targetType: "inline"
script: '(Get-FileHash .\artemis-build-linux.zip).Hash | Out-File -FilePath .\hash-linux.txt'
workingDirectory: "$(Build.ArtifactStagingDirectory)/archive"
- task: FtpUpload@2
displayName: "Upload binaries to FTP"
inputs:
credentialsOption: "inputs"
serverUrl: "ftp://artemis-rgb.com"
username: "devops"
password: "$(ftp_password)"
rootDirectory: "$(Build.ArtifactStagingDirectory)/archive"
filePatterns: "**"
remoteDirectory: "/builds.artemis-rgb.com/binaries/$(Build.SourceBranchName)/$(Build.BuildNumber)"
clean: false
preservePaths: true
trustSSL: false

50
docfx/Dockerfile Normal file
View File

@ -0,0 +1,50 @@
# Stage 1: Build DocFX site
FROM mcr.microsoft.com/dotnet/sdk:10.0-alpine AS docfx-build
# Create non-root user
RUN addgroup -S docfx && adduser -S docfx -G docfx
# Switch early
USER docfx
ENV HOME=/home/docfx
ENV PATH="$PATH:/home/docfx/.dotnet/tools"
WORKDIR /workspace
# Install DocFX as docfx user
RUN dotnet tool install -g docfx
# Copy sources
COPY --chown=docfx:docfx docfx ./docfx
COPY --chown=docfx:docfx src ./src
WORKDIR /workspace/docfx
RUN docfx docfx_project/docfx.json
# Stage 2: Runtime (Nginx)
FROM nginx:alpine
# Create non-root user
RUN addgroup -S nginx-user && adduser -S nginx-user -G nginx-user
# Prepare runtime directories
RUN mkdir -p /var/cache/nginx /var/run \
&& chown -R nginx-user:nginx-user /var/cache/nginx /var/run
# Remove default content and config
RUN rm -rf /usr/share/nginx/html/* \
&& rm /etc/nginx/conf.d/default.conf
# Copy static site
COPY --from=docfx-build \
--chown=nginx-user:nginx-user \
/workspace/docfx/docfx_project/_site \
/usr/share/nginx/html
# Provide nginx config
COPY docfx/nginx.conf /etc/nginx/nginx.conf
USER nginx-user
EXPOSE 8080
CMD ["nginx", "-g", "daemon off;"]

View File

@ -25,4 +25,7 @@ apiRules:
type: Type type: Type
- exclude: - exclude:
uidRegex: ^Artemis\.Core\.TypeExtensions uidRegex: ^Artemis\.Core\.TypeExtensions
type: Type
- exclude:
uidRegex: ^Artemis\.Storage
type: Type type: Type

29
docfx/nginx.conf Normal file
View File

@ -0,0 +1,29 @@
pid /tmp/nginx.pid;
worker_processes auto;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
server_tokens off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
server {
listen 8080;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
}