Skip to content

Build

Build #175

Workflow file for this run

name: Build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
strategy:
matrix:
profile:
- publishProfile: "Release.pubxml"
artifactName: "nomad_iis"
- publishProfile: "ReleaseWithMgmtApi.pubxml"
artifactName: "nomad_iis_mgmt_api"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
# Publish the application
- name: Publish the application
run: dotnet publish "./src/NomadIIS/NomadIIS.csproj" /p:PublishProfile="./src/NomadIIS/Properties/PublishProfiles/${{ matrix.profile.publishProfile }}"
# Copy to output
- name: Copy to output folder
run: |
mkdir dist
copy .\src\NomadIIS\bin\Release\net8.0\win-x64\publish\nomad_iis.exe .\dist\nomad_iis.exe
# Upload the artifact
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.profile.artifactName }}
path: ./dist
test:
runs-on: windows-latest
needs: ["build"]
strategy:
matrix:
profile:
- artifactName: "nomad_iis"
- artifactName: "nomad_iis_mgmt_api"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
# Install IIS
- name: Install IIS
run: |
$features = @(
"IIS-WebServerRole",
"IIS-WebServer",
"IIS-CommonHttpFeatures",
"IIS-HttpErrors",
"IIS-HttpRedirect",
"IIS-ApplicationDevelopment",
"NetFx4Extended-ASPNET45",
"IIS-NetFxExtensibility45",
"IIS-HealthAndDiagnostics",
"IIS-HttpLogging",
"IIS-LoggingLibraries",
"IIS-RequestMonitor",
"IIS-HttpTracing",
"IIS-Security",
"IIS-RequestFiltering",
"IIS-Performance",
"IIS-WebServerManagementTools",
"IIS-IIS6ManagementCompatibility",
"IIS-Metabase",
"IIS-ManagementConsole",
"IIS-BasicAuthentication",
"IIS-WindowsAuthentication",
"IIS-StaticContent",
"IIS-DefaultDocument",
"IIS-WebSockets",
"IIS-ApplicationInit",
"IIS-ISAPIExtensions",
"IIS-ISAPIFilter",
"IIS-HttpCompressionStatic",
"IIS-ASP",
"IIS-ServerSideIncludes",
"IIS-ASPNET45"
)
Enable-WindowsOptionalFeature -Online -FeatureName $features
# Download Nomad
- name: Run setup.ps1
shell: pwsh
run: .\setup.ps1
# Download nomad_iis.exe
- uses: actions/download-artifact@master
with:
name: ${{ matrix.profile.artifactName }}
path: artifacts
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# with:
# detached: true
# TODO: -p:DefineConstants="MANAGEMENT_API"
- name: Run tests
env:
RUNNING_IN_CI: true
TEST_PLUGIN_DIRECTORY: ..\..\..\..\..\artifacts # Relative to bin\Debug\net8.0
#MANAGEMENT_API: ${{ matrix.profile.artifactName == 'nomad_iis_mgmt_api' && 'true' || '' }}
run: |
$args = ''
if ('${{ matrix.profile.artifactName }}' -eq 'nomad_iis_mgmt_api') {
$args = '-p:DefineConstants="MANAGEMENT_API"'
}
dotnet test src\NomadIIS.Tests\NomadIIS.Tests.csproj ${args}
# Get-Content -Path "src\NomadIIS.Tests\bin\Debug\net8.0\debug.test.txt"
# cat ./src/NomadIIS/PluginInfo.cs | grep -oP 'public static readonly string Version = "([0-9]+\.[0-9]+\.[0-9])";'