diff --git a/.github/workflows/azure-functions-smoke-tests.yml b/.github/workflows/azure-functions-smoke-tests.yml index d593cf7a..37c4c5f7 100644 --- a/.github/workflows/azure-functions-smoke-tests.yml +++ b/.github/workflows/azure-functions-smoke-tests.yml @@ -31,9 +31,6 @@ jobs: with: global-json-file: global.json - - name: Restore dependencies - run: dotnet restore test/AzureFunctionsSmokeTests/AzureFunctionsSmokeTests.csproj - - name: Run smoke tests run: | cd test/AzureFunctionsSmokeTests diff --git a/.github/workflows/codeQL.yml b/.github/workflows/codeQL.yml index 5c190824..251cf1f7 100644 --- a/.github/workflows/codeQL.yml +++ b/.github/workflows/codeQL.yml @@ -53,16 +53,21 @@ jobs: with: submodules: true - - name: Setup .NET - uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0 + - name: Setup .NET 6.0 + uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0 + with: + dotnet-version: '6.0.x' + + - name: Setup .NET from global.json + uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0 with: global-json-file: global.json - name: Restore dependencies - run: dotnet restore $solution + run: dotnet restore "$env:solution" --configfile "$env:GITHUB_WORKSPACE\nuget.config" - name: Build - run: dotnet build $solution #--configuration $config #--no-restore -p:FileVersionRevision=$GITHUB_RUN_NUMBER -p:ContinuousIntegrationBuild=true + run: dotnet build "$env:solution" --no-restore -p:FileVersionRevision=$env:GITHUB_RUN_NUMBER -p:ContinuousIntegrationBuild=true # Run CodeQL analysis - name: Perform CodeQL Analysis diff --git a/.github/workflows/validate-build.yml b/.github/workflows/validate-build.yml index 100ff0ed..25568d15 100644 --- a/.github/workflows/validate-build.yml +++ b/.github/workflows/validate-build.yml @@ -47,16 +47,16 @@ jobs: global-json-file: global.json - name: Restore dependencies - run: dotnet restore $env:solution + run: dotnet restore "$env:solution" --configfile "$env:GITHUB_WORKSPACE\nuget.config" - name: Build - run: dotnet build $env:solution --configuration $env:config --no-restore -p:FileVersionRevision=$env:GITHUB_RUN_NUMBER + run: dotnet build "$env:solution" --configuration $env:config --no-restore -p:FileVersionRevision=$env:GITHUB_RUN_NUMBER - name: Test - run: dotnet test $env:solution --configuration $env:config --no-build --verbosity normal + run: dotnet test "$env:solution" --configuration $env:config --no-build --no-restore --verbosity normal - name: Pack - run: dotnet pack $env:solution --configuration $env:config --no-build + run: dotnet pack "$env:solution" --configuration $env:config --no-build --no-restore - name: Upload uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 diff --git a/azure-pipelines-release.yml b/azure-pipelines-release.yml index 60abd025..3bfb6e83 100644 --- a/azure-pipelines-release.yml +++ b/azure-pipelines-release.yml @@ -42,6 +42,9 @@ steps: useGlobalJson: true # Start by restoring all the dependencies. This needs to be its own task. +- task: NuGetAuthenticate@1 + displayName: Authenticate NuGet feeds + - task: DotNetCoreCLI@2 displayName: Restore inputs: @@ -105,7 +108,7 @@ steps: inputs: command: custom custom: pack - arguments: --no-build $(build_args) $(pack_binlog) + arguments: --no-build --no-restore $(build_args) $(pack_binlog) projects: $(project) # Digitally sign all the nuget packages with the Microsoft certificate. diff --git a/eng/templates/build.yml b/eng/templates/build.yml index 4b6112e0..fd163993 100644 --- a/eng/templates/build.yml +++ b/eng/templates/build.yml @@ -44,6 +44,9 @@ jobs: useGlobalJson: true # Start by restoring all the dependencies. This needs to be its own task. + - task: NuGetAuthenticate@1 + displayName: Authenticate NuGet feeds + - task: DotNetCoreCLI@2 displayName: Restore inputs: @@ -75,7 +78,7 @@ jobs: inputs: command: custom custom: pack - arguments: --no-build $(build_args) $(pack_binlog) + arguments: --no-build --no-restore $(build_args) $(pack_binlog) projects: $(project) - template: ci/sign-files.yml@eng diff --git a/nuget.config b/nuget.config index 6f509391..be7fc539 100644 --- a/nuget.config +++ b/nuget.config @@ -1,7 +1,12 @@ - - + + + + + + + \ No newline at end of file diff --git a/test/AzureFunctionsSmokeTests/run-smoketests.ps1 b/test/AzureFunctionsSmokeTests/run-smoketests.ps1 index 542132b6..ef0e5aca 100644 --- a/test/AzureFunctionsSmokeTests/run-smoketests.ps1 +++ b/test/AzureFunctionsSmokeTests/run-smoketests.ps1 @@ -30,6 +30,8 @@ $ErrorActionPreference = "Stop" $scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path $projectDir = $scriptDir $publishDir = Join-Path $projectDir "publish" +$repoRoot = Split-Path -Parent (Split-Path -Parent $scriptDir) +$nugetConfig = Join-Path $repoRoot "nuget.config" Write-Host "=== Azure Functions Smoke Test Runner ===" -ForegroundColor Cyan Write-Host "" @@ -63,9 +65,27 @@ try { Cleanup Write-Host "" - # Step 1: Build the project - Write-Host "Step 1: Building the Azure Functions project..." -ForegroundColor Green - dotnet build $projectDir -c Release + # Step 1: Restore and build the project + Write-Host "Step 1: Restoring and building the Azure Functions project..." -ForegroundColor Green + $restoreArguments = @( + "restore" + $projectDir + "--configfile" + $nugetConfig + ) + dotnet @restoreArguments + if ($LASTEXITCODE -ne 0) { + throw "Restore failed with exit code $LASTEXITCODE" + } + + $buildArguments = @( + "build" + $projectDir + "-c" + "Release" + "--no-restore" + ) + dotnet @buildArguments if ($LASTEXITCODE -ne 0) { throw "Build failed with exit code $LASTEXITCODE" } @@ -77,7 +97,16 @@ try { if (Test-Path $publishDir) { Remove-Item $publishDir -Recurse -Force } - dotnet publish $projectDir -c Release -o $publishDir + $publishArguments = @( + "publish" + $projectDir + "-c" + "Release" + "-o" + $publishDir + "--no-restore" + ) + dotnet @publishArguments if ($LASTEXITCODE -ne 0) { throw "Publish failed with exit code $LASTEXITCODE" }