Strip unnecessary runtimes from artifacts

This commit is contained in:
Jordan Dominion
2023-08-13 17:08:20 -04:00
parent 6e54d69564
commit bb8d1c52de
6 changed files with 52 additions and 15 deletions
+20 -12
View File
@@ -464,17 +464,20 @@ jobs:
if: ${{ matrix.configuration == 'Release' && matrix.watchdog-type == 'Basic' }}
run: |
cd src/Tgstation.Server.Host.Service
dotnet publish -c ${{ matrix.configuration }} -o ../../Artifacts/Service
dotnet publish -c ${{ matrix.configuration }} -o ../../artifacts/Service
cd ../Tgstation.Server.Host
dotnet publish -c ${{ matrix.configuration }} --no-build -o ../../Artifacts/Service/lib/Default
mv ../../Artifacts/Service/lib/Default/appsettings.yml ../../Artifacts/Service/appsettings.yml
dotnet publish -c ${{ matrix.configuration }} --no-build -o ../../artifacts/Service/lib/Default
cd ../..
mv artifacts/Service/lib/Default/appsettings.yml artifacts/Service/appsettings.yml
build/RemoveUnsupportedRuntimes.sh artifacts/Service/lib/Default
build/RemoveUnsupportedServiceRuntimes.ps1 artifacts/Service
- name: Store Server Service
if: ${{ matrix.configuration == 'Release' && matrix.watchdog-type == 'Basic' }}
uses: actions/upload-artifact@v3
with:
name: ServerService
path: Artifacts/Service/
path: artifacts/Service/
- name: Install Code Signing Certificate
if: ${{ matrix.configuration == 'Release' && matrix.watchdog-type == 'Basic' }}
@@ -489,7 +492,7 @@ jobs:
- name: Test Sign Service .exe
if: ${{ matrix.configuration == 'Release' && matrix.watchdog-type == 'Basic' }}
shell: powershell
run: Set-AuthenticodeSignature Artifacts/Service/Tgstation.Server.Host.Service.exe -Certificate (Get-ChildItem Cert:\CurrentUser\My | Where-Object { $_.Thumbprint -eq "${{ vars.CODE_SIGNING_THUMBPRINT }}" }) -TimestampServer "http://timestamp.digicert.com"
run: Set-AuthenticodeSignature artifacts/Service/Tgstation.Server.Host.Service.exe -Certificate (Get-ChildItem Cert:\CurrentUser\My | Where-Object { $_.Thumbprint -eq "${{ vars.CODE_SIGNING_THUMBPRINT }}" }) -TimestampServer "http://timestamp.digicert.com"
linux-integration-tests:
name: Linux Live Tests
@@ -626,31 +629,36 @@ jobs:
if: ${{ matrix.configuration == 'Release' && matrix.watchdog-type == 'System' && matrix.database-type == 'MariaDB' }}
run: |
cd src/Tgstation.Server.Host.Console
dotnet publish -c ${{ matrix.configuration }} -o ../../Artifacts/Console
dotnet publish -c ${{ matrix.configuration }} -o ../../artifacts/Console
cd ../Tgstation.Server.Host
dotnet publish -c ${{ matrix.configuration }}NoWindows --no-build -o ../../Artifacts/Console/lib/Default
mv ../../Artifacts/Console/lib/Default/appsettings.yml ../../Artifacts/Console/appsettings.yml
dotnet publish -c ${{ matrix.configuration }}NoWindows --no-build -o ../../artifacts/Console/lib/Default
cd ../..
mv artifacts/Console/lib/Default/appsettings.yml artifacts/Console/appsettings.yml
build/RemoveUnsupportedRuntimes.sh artifacts/Console/lib/Default
build/RemoveUnsupportedRuntimes.sh artifacts/Console
- name: Package Server Update Package
if: ${{ matrix.configuration == 'Release' && matrix.watchdog-type == 'System' && matrix.database-type == 'PostgresSql' }}
run: |
cd src/Tgstation.Server.Host
dotnet publish -c ${{ matrix.configuration }}NoWindows --no-build -o ../../Artifacts/ServerUpdate
rm ../../Artifacts/ServerUpdate/appsettings.yml
dotnet publish -c ${{ matrix.configuration }}NoWindows --no-build -o ../../artifacts/ServerUpdate
cd ../..
rm artifacts/ServerUpdate/appsettings.yml
build/RemoveUnsupportedRuntimes.sh artifacts/ServerUpdate
- name: Store Server Console
if: ${{ matrix.configuration == 'Release' && matrix.watchdog-type == 'System' && matrix.database-type == 'MariaDB' }}
uses: actions/upload-artifact@v3
with:
name: ServerConsole
path: Artifacts/Console/
path: artifacts/Console/
- name: Store Server Update Package
if: ${{ matrix.configuration == 'Release' && matrix.watchdog-type == 'System' && matrix.database-type == 'PostgresSql' }}
uses: actions/upload-artifact@v3
with:
name: ServerUpdatePackage
path: Artifacts/ServerUpdate/
path: artifacts/ServerUpdate/
validate-openapi-spec:
name: OpenAPI Spec Validation
+7 -2
View File
@@ -58,10 +58,15 @@ COPY . .
RUN dos2unix build/tgs.docker.sh
WORKDIR /repo/src/Tgstation.Server.Host.Console
RUN dotnet publish -c Release -o /app
RUN dotnet publish -c Release -o /app \
&& cd ../.. \
&& build/RemoveUnsupportedRuntimes.sh /app
WORKDIR /repo/src/Tgstation.Server.Host
RUN dotnet publish -c Release -o /app/lib/Default && mv /app/lib/Default/appsettings* /app
RUN dotnet publish -c Release -o /app/lib/Default \
&& cd ../.. \
&& build/RemoveUnsupportedRuntimes.sh /app/lib/Default \
&& mv /app/lib/Default/appsettings* /app
FROM mcr.microsoft.com/dotnet/aspnet:6.0-bookworm-slim
+10
View File
@@ -0,0 +1,10 @@
#!/bin/sh
# Run with publish directory as parameter
rm -rf $1/runtimes/browser* \
$1/runtimes/osx* \
$1/runtimes/mac* \
$1/runtimes/*-arm* \
$1/runtimes/*-ppc64le \
$1/runtimes/*-s390x \
$1/runtimes/*-mips64
@@ -0,0 +1,9 @@
param (
[Parameter(Position=0)] $PublishDirectory
)
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$PublishDirectory/runtimes/browser*"
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$PublishDirectory/runtimes/linux*"
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$PublishDirectory/runtimes/osx*"
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$PublishDirectory/runtimes/unix*"
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$PublishDirectory/runtimes/alpine*"
+2
View File
@@ -14,6 +14,8 @@ override_dh_auto_build:
cd src/Tgstation.Server.Host.Console && dotnet publish -c Release -o ../../artifacts
cd src/Tgstation.Server.Host && dotnet publish -c Release -o ../../artifacts/lib/Default
rm artifacts/lib/Default/appsettings.yml
build/RemoveUnsupportedRuntimes.sh artifacts/lib/Default
build/RemoveUnsupportedRuntimes.sh artifacts
override_dh_auto_install:
cp build/package/deb/MakeInstall ./Makefile
@@ -39,7 +39,10 @@ try
exit $lastexitcode
}
mv ../../artifacts/Tgstation.Server.Host.Service/Tgstation.Server.Host.Service.exe ../../artifacts/
cd ../..
build/RemoveUnsupportedRuntimes.sh artifacts/Tgstation.Server.Host
build/RemoveUnsupportedServiceRuntimes.ps1 artifacts/Tgstation.Server.Host.Service
mv artifacts/Tgstation.Server.Host.Service/Tgstation.Server.Host.Service.exe artifacts/
}
finally
{