diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..64f1e6b4 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,62 @@ +name: CI + +on: [push, pull_request] + +jobs: + build-linux: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Install .Net Core + uses: actions/setup-dotnet@v2 + with: + dotnet-version: | + 6.0.x + 7.0.x + include-prerelease: true + - name: Install dotnet-script + run: dotnet tool install dotnet-script --global + + - name: Run build script + run: dotnet-script build/Build.csx + + build-mac: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v3 + - name: Install .Net Core + uses: actions/setup-dotnet@v2 + with: + dotnet-version: | + 6.0.x + 7.0.x + include-prerelease: true + - name: Install dotnet-script + run: dotnet tool install dotnet-script --global + + - name: Run build script + run: dotnet-script build/Build.csx + + build-windows: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v3 + - name: Install .Net Core + uses: actions/setup-dotnet@v2 + with: + dotnet-version: | + 6.0.x + 7.0.x + include-prerelease: true + - name: Install dotnet-script + run: dotnet tool install dotnet-script --global + + - name: Run build script + run: dotnet-script build/Build.csx + env: # Or as an environment variable + GITHUB_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + IS_SECURE_BUILDENVIRONMENT: ${{ secrets.IS_SECURE_BUILDENVIRONMENT }} + NUGET_APIKEY: ${{ secrets.NUGET_APIKEY }} diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index b0b520c2..00000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,126 +0,0 @@ -resources: - - repo: self - -trigger: - tags: - include: - - refs/tags/* - branches: - include: - - "*" - -variables: - - group: dotnet-script-api-keys - -jobs: - - job: Job_3 - displayName: Ubuntu Agent - condition: succeeded() - pool: - vmImage: 'ubuntu-18.04' - steps: - - bash: "curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin -version 3.1.102" - displayName: "Install 3.0.100" - - - bash: "curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin -version 5.0.100" - displayName: " 5.0.100" - - - bash: "curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin -version 6.0.100" - displayName: " 6.0.100" - - - bash: | - export PATH=/home/vsts/.dotnet:$PATH - curl -L https://github.com/filipw/dotnet-script/releases/download/1.2.1/dotnet-script.1.2.1.zip > dotnet-script.zip - unzip -o dotnet-script.zip -d ./ - displayName: "Install dotnet-script" - - - bash: | - export PATH=/home/vsts/.dotnet:$PATH - dotnet dotnet-script/dotnet-script.dll build/Build.csx - displayName: "Run build.csx" - - - job: Job_1 - displayName: Mac Agent - condition: succeeded() - pool: - vmImage: 'macOS-latest' - steps: - - bash: | - curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin -version 3.1.102 - displayName: "Install 3.0.100" - - - bash: | - curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin -version 5.0.100 - displayName: "Install 5.0.100" - - - bash: | - curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin -version 6.0.100 - displayName: "Install 6.0.100" - - - bash: | - curl -L https://github.com/filipw/dotnet-script/releases/download/1.2.1/dotnet-script.1.2.1.zip > dotnet-script.zip - unzip -o dotnet-script.zip -d ./ - displayName: "Install dotnet-script" - - - bash: "dotnet dotnet-script/dotnet-script.dll build/build.csx" - displayName: "Run build.csx" - - - job: Job_2 - displayName: Windows Agent - condition: succeeded() - pool: - name: Hosted Windows 2019 with VS2019 - steps: - - powershell: | - iwr https://raw.githubusercontent.com/dotnet/cli/release/2.1.3xx/scripts/obtain/dotnet-install.ps1 -outfile dotnet-install.ps1 - .\dotnet-install.ps1 -Version 3.1.102 - - displayName: "Install 3.0.100" - - - powershell: | - iwr https://raw.githubusercontent.com/dotnet/cli/release/2.1.3xx/scripts/obtain/dotnet-install.ps1 -outfile dotnet-install.ps1 - .\dotnet-install.ps1 -Version 5.0.100 - - displayName: "Install 5.0.100" - - - powershell: | - iwr https://raw.githubusercontent.com/dotnet/cli/release/2.1.3xx/scripts/obtain/dotnet-install.ps1 -outfile dotnet-install.ps1 - .\dotnet-install.ps1 -Version 6.0.100 - - displayName: "Install 6.0.100" - - # NuGet Tool Installer - # Acquires a specific version of NuGet from the internet or the tools cache and adds it to the PATH. Use this task to change the version of NuGet used in the NuGet tasks. - - task: NuGetToolInstaller@0 - inputs: - versionSpec: "4.8.2" - - #checkLatest: false # Optional - - bash: | - export PATH=/c/Users/VssAdministrator/AppData/Local/Microsoft/dotnet:$PATH - dotnet --info - - displayName: "Show installed sdk" - - - bash: | - export PATH=/c/Users/VssAdministrator/AppData/Local/Microsoft/dotnet:$PATH - cd build - curl -L https://github.com/filipw/dotnet-script/releases/download/1.2.1/dotnet-script.1.2.1.zip > dotnet-script.zip - unzip -o dotnet-script.zip -d ./ - displayName: "Install dotnet-script" - - - bash: | - export PATH=/c/Users/VssAdministrator/AppData/Local/Microsoft/dotnet:$PATH - cd build - dotnet dotnet-script/dotnet-script.dll build.csx - displayName: "Run build.csx" - env: - IS_SECURE_BUILDENVIRONMENT: $(IS_SECURE_BUILDENVIRONMENT) - GITHUB_REPO_TOKEN: $(GITHUB_REPO_TOKEN) - NUGET_APIKEY: $(NUGET_APIKEY) - CHOCOLATEY_APIKEY: $(CHOCOLATEY_APIKEY) - - - task: PublishPipelineArtifact@0 - displayName: "Publish Pipeline Artifact" - inputs: - targetPath: build/Artifacts diff --git a/build/Build.csx b/build/Build.csx index e9b6782f..623e404b 100644 --- a/build/Build.csx +++ b/build/Build.csx @@ -4,10 +4,10 @@ #load "Choco.csx" #load "BuildContext.csx" -using static ReleaseManagement; +using System.Xml.Linq; using static ChangeLog; using static FileUtils; -using System.Xml.Linq; +using static ReleaseManagement; [StepDescription("Runs all tests.")] Step test = () => RunTests(); @@ -35,7 +35,7 @@ await StepRunner.Execute(Args); private void CreateGitHubReleaseAsset() { - DotNet.Publish(dotnetScriptProjectFolder, publishArtifactsFolder, "netcoreapp3.1"); + DotNet.Publish(dotnetScriptProjectFolder, publishArtifactsFolder, "net6.0"); Zip(publishArchiveFolder, pathToGitHubReleaseAsset); } diff --git a/build/Choco.csx b/build/Choco.csx index 9a00be3b..05c8de13 100644 --- a/build/Choco.csx +++ b/build/Choco.csx @@ -13,7 +13,7 @@ public static class Choco { string pathToProjectFile = Directory.GetFiles(pathToProjectFolder, "*.csproj").Single(); CreateSpecificationFromProject(pathToProjectFile, pathToBinaries); - Command.Execute("choco.exe", $@"pack Chocolatey\chocolatey.nuspec --outputdirectory {outputFolder}"); + Command.Execute("choco.exe", $@"pack {Path.Combine(FileUtils.GetScriptFolder(), "Chocolatey", "chocolatey.nuspec")} --outputdirectory {outputFolder}"); } public static void Push(string packagesFolder, string apiKey, string source = "https://push.chocolatey.org/") @@ -78,8 +78,7 @@ public static class Choco filesElement.Add(CreateFileElement(@"tools\*.*", $@"{packageId}\tools")); var srcGlobPattern = $@"{pathToBinaries}\**\*"; filesElement.Add(CreateFileElement(srcGlobPattern, packageId)); - - using var fileStream = new FileStream("Chocolatey/chocolatey.nuspec", FileMode.Create); + using var fileStream = new FileStream(Path.Combine(FileUtils.GetScriptFolder(), "Chocolatey", "chocolatey.nuspec"), FileMode.Create); new XDocument(packageElement).Save(fileStream); } diff --git a/build/omnisharp.json b/build/omnisharp.json index 44278159..74b7fc1b 100644 --- a/build/omnisharp.json +++ b/build/omnisharp.json @@ -1,6 +1,6 @@ { "script": { "enableScriptNuGetReferences": true, - "defaultTargetFramework": "netcoreapp3.1" + "defaultTargetFramework": "net6.0" } } \ No newline at end of file diff --git a/global.json b/global.json index b2d7a05a..b68e0c11 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.100", + "version": "7.0.100-rc.1.22431.12", "rollForward": "latestFeature" } -} \ No newline at end of file +} diff --git a/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj b/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj index 113f54ec..132db377 100644 --- a/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj +++ b/src/Dotnet.Script.Core/Dotnet.Script.Core.csproj @@ -2,9 +2,9 @@ A cross platform library allowing you to run C# (CSX) scripts with support for debugging and inline NuGet packages. Based on Roslyn. - 1.3.1 + 1.4.0 filipw - netstandard2.0;netcoreapp3.1 + net6.0;netstandard2.0 Dotnet.Script.Core Dotnet.Script.Core script;csx;csharp;roslyn diff --git a/src/Dotnet.Script.Core/ScriptAssemblyLoadContext.cs b/src/Dotnet.Script.Core/ScriptAssemblyLoadContext.cs index f5691074..603661ae 100644 --- a/src/Dotnet.Script.Core/ScriptAssemblyLoadContext.cs +++ b/src/Dotnet.Script.Core/ScriptAssemblyLoadContext.cs @@ -1,4 +1,4 @@ -#if NETCOREAPP +#if NET using System; using System.Reflection; @@ -20,7 +20,7 @@ public ScriptAssemblyLoadContext() { } -#if NETCOREAPP3_0_OR_GREATER +#if NET5_0_OR_GREATER /// /// Initializes a new instance of the class /// with a name and a value that indicates whether unloading is enabled. diff --git a/src/Dotnet.Script.DependencyModel.Nuget/Dotnet.Script.DependencyModel.NuGet.csproj b/src/Dotnet.Script.DependencyModel.Nuget/Dotnet.Script.DependencyModel.NuGet.csproj index 05999b1a..c0df9c53 100644 --- a/src/Dotnet.Script.DependencyModel.Nuget/Dotnet.Script.DependencyModel.NuGet.csproj +++ b/src/Dotnet.Script.DependencyModel.Nuget/Dotnet.Script.DependencyModel.NuGet.csproj @@ -8,7 +8,7 @@ https://github.com/filipw/dotnet-script.git git script;csx;csharp;roslyn;nuget - 1.3.1 + 1.4.0 A MetadataReferenceResolver that allows inline nuget references to be specified in script(csx) files. dotnet-script dotnet-script diff --git a/src/Dotnet.Script.DependencyModel/Compilation/CompilationDependencyResolver.cs b/src/Dotnet.Script.DependencyModel/Compilation/CompilationDependencyResolver.cs index 51dbc3c0..136cb552 100644 --- a/src/Dotnet.Script.DependencyModel/Compilation/CompilationDependencyResolver.cs +++ b/src/Dotnet.Script.DependencyModel/Compilation/CompilationDependencyResolver.cs @@ -43,14 +43,8 @@ public IEnumerable GetDependencies(string targetDirectory result.Add(compilationDependency); } - // On .Net Core, we need to fetch the compilation references for framework assemblies separately. - if (defaultTargetFramework.StartsWith("netcoreapp3", StringComparison.InvariantCultureIgnoreCase) || - defaultTargetFramework.StartsWith("net5", StringComparison.InvariantCultureIgnoreCase) || - defaultTargetFramework.StartsWith("net6", StringComparison.InvariantCultureIgnoreCase)) - { - var compilationreferences = _compilationReferenceReader.Read(projectFileInfo); - result.Add(new CompilationDependency("Dotnet.Script.Default.Dependencies", "99.0", compilationreferences.Select(cr => cr.Path).ToArray(), Array.Empty())); - } + var compilationReferences = _compilationReferenceReader.Read(projectFileInfo); + result.Add(new CompilationDependency("Dotnet.Script.Default.Dependencies", "99.0", compilationReferences.Select(cr => cr.Path).ToArray(), Array.Empty())); return result; } diff --git a/src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj b/src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj index 3dccf82a..0a4df0c5 100644 --- a/src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj +++ b/src/Dotnet.Script.DependencyModel/Dotnet.Script.DependencyModel.csproj @@ -11,7 +11,7 @@ https://github.com/filipw/dotnet-script.git git script;csx;csharp;roslyn;omnisharp - 1.3.1 + 1.4.0 latest true ../dotnet-script.snk diff --git a/src/Dotnet.Script.Desktop.Tests/CompilationDepenencyTests.cs b/src/Dotnet.Script.Desktop.Tests/CompilationDepenencyTests.cs index e3b01a0b..e20e33e0 100644 --- a/src/Dotnet.Script.Desktop.Tests/CompilationDepenencyTests.cs +++ b/src/Dotnet.Script.Desktop.Tests/CompilationDepenencyTests.cs @@ -15,8 +15,8 @@ public CompilationDependencyTests(ITestOutputHelper testOutputHelper) } [Theory] - [InlineData("netcoreapp3.1")] - [InlineData("net5.0")] + [InlineData("net6.0")] + [InlineData("net7.0")] public void ShouldGetCompilationDependenciesForNetCoreApp(string targetFramework) { var resolver = CreateResolver(); diff --git a/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj b/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj index af049301..138b3a56 100644 --- a/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj +++ b/src/Dotnet.Script.Tests/Dotnet.Script.Tests.csproj @@ -1,6 +1,6 @@ - net6.0;net5.0;netcoreapp3.1 + net7.0;net6.0 false true ../dotnet-script.snk diff --git a/src/Dotnet.Script/Dotnet.Script.csproj b/src/Dotnet.Script/Dotnet.Script.csproj index e17ab3a5..c446dccf 100644 --- a/src/Dotnet.Script/Dotnet.Script.csproj +++ b/src/Dotnet.Script/Dotnet.Script.csproj @@ -1,10 +1,10 @@  Dotnet CLI tool allowing you to run C# (CSX) scripts. - 1.3.1 + 1.4.0 filipw Dotnet.Script - net6.0;net5.0;netcoreapp3.1 + net7.0;net6.0 portable dotnet-script Exe