I have a unit test that requires some folders/files to be created. It works locally as I have permission to create the folders/files but this doesn't seem to work in Github Actions.
I have the following set up for Github Actions:
jobs: build: runs-on: [windows-latest] steps: - uses: actions/checkout@v2 - name: Setup MSBuild uses: microsoft/setup-msbuild@v1 - name: Setup NuGet uses: NuGet/setup-nuget@v1.0.5 - name: Restore NuGet packages run: nuget restore NewFolderSolution.sln # Run msbuild as we have "ResolveComReference" used # dotnet build doesn't support "ResolveComReference" - name: Build the solution run: msbuild NewFolderSolution.sln - name: Run dotnet test on new folder solution project run: dotnet test NewFolderSolution.sln I am getting the following error:
A total of 1 test files matched the specified pattern. Failed TestNewFolderCreation[285 ms] Error Message: System.UnauthorizedAccessException : Access to the path 'D:\a\solution\project\folder1\NewlyCreatedFolder' is denied. Stack Trace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound, WIN32_FIND_DATA& data) at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost) at System.IO.Directory.Delete(String path, Boolean recursive) at NewFolderSolutionTest.Setup() in D:\a\solution\project\folder1\NewFolderSolutionTest.cs:line 23 Is there some permission that I need to set for this to work?
Edit: The issue seems to be related to deleting the directory
https://stackoverflow.com/questions/66756106/can-github-actions-have-unit-tests-that-create-files-and-directories March 23, 2021 at 09:41AM
没有评论:
发表评论