diff --git a/.appveyor.yml b/.appveyor.yml index 0b365f1..3b528cd 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,7 +1,23 @@ #---------------------------------# # Build Image # #---------------------------------# -image: Visual Studio 2017 +image: Visual Studio 2022 + +#---------------------------------# +# Install .NET # +#---------------------------------# +install: + - ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetsdk" + - ps: mkdir $env:DOTNET_INSTALL_DIR -Force | Out-Null + - ps: Invoke-WebRequest -Uri "https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.ps1" -OutFile "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" + - ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Channel 2.1 -InstallDir $env:DOTNET_INSTALL_DIR' + - ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Channel 3.1 -InstallDir $env:DOTNET_INSTALL_DIR' + - ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Channel 5.0 -InstallDir $env:DOTNET_INSTALL_DIR' + - ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Channel 6.0 -InstallDir $env:DOTNET_INSTALL_DIR' + - ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Channel 7.0 -InstallDir $env:DOTNET_INSTALL_DIR' + - ps: '& "$($env:DOTNET_INSTALL_DIR)/dotnet-install.ps1" -Channel 8.0 -InstallDir $env:DOTNET_INSTALL_DIR' + - ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path" + - ps: dotnet --info #---------------------------------# # Build Script # diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..fa1b7a1 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,84 @@ +name: Build + +on: + push: + branches: + - master + - develop + - "feature/**" + - "release/**" + - "hotfix/**" + tags: + - "*" + paths-ignore: + - "README.md" + pull_request: + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ windows-2022, ubuntu-22.04, macos-12 ] + + env: + AZURE_PASSWORD: ${{ secrets.AZURE_PASSWORD }} + AZURE_SOURCE: ${{ secrets.AZURE_SOURCE }} + AZURE_USER: ${{ secrets.AZURE_USER }} + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + GITHUB_PAT: ${{ secrets.GH_TOKEN }} + GITTER_ROOM_ID: ${{ secrets.GITTER_ROOM_ID }} + GITTER_TOKEN: ${{ secrets.GITTER_TOKEN }} + GPR_PASSWORD: ${{ secrets.GPR_PASSWORD }} + GPR_SOURCE: ${{ secrets.GPR_SOURCE }} + GPR_USER: ${{ secrets.GPR_USER }} + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} + NUGET_SOURCE: "https://api.nuget.org/v3/index.json" + TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} + TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }} + TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }} + TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }} + WYAM_ACCESS_TOKEN: ${{ secrets.WYAM_ACCESS_TOKEN }} + WYAM_DEPLOY_BRANCH: "gh-pages" + WYAM_DEPLOY_REMOTE: ${{ github.event.repository.html_url }} + + steps: + - name: Checkout the repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + - name: Fetch all tags and branches + run: git fetch --prune --unshallow + - uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.0 + with: + dotnet-version: | + 2.1.818 + 3.1.x + 5.0.x + 6.0.x + 7.0.x + 8.0.x + - name: Cache Tools + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 + with: + path: tools + key: ${{ runner.os }}-tools-${{ hashFiles('recipe.cake') }} + - name: Build project + uses: cake-build/cake-action@a6eb054329257c9e70a6c6bf01747ad6e1d9d52b # v1 + with: + script-path: recipe.cake + target: CI + cake-version: 0.32.1 + - name: Upload Issues + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4 + with: + if-no-files-found: warn + name: ${{ matrix.os }} Issues + path: | + BuildArtifacts/report.html + BuildArtifacts/**/coverlet/*.xml + - name: Upload Packages + uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4 + if: runner.os == 'Windows' + with: + if-no-files-found: warn + name: package + path: BuildArtifacts/Packages/**/* diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..9d41c74 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,67 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +name: "CodeQL" + +on: + push: + branches: [develop] + pull_request: + # The branches below must be a subset of the branches above + branches: [develop] + schedule: + - cron: '0 15 * * 6' + workflow_dispatch: + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-22.04 + + strategy: + fail-fast: false + matrix: + # Override automatic language detection by changing the below list + # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] + language: ['csharp'] + # Learn more... + # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection + + steps: + - name: Checkout repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + with: + fetch-depth: 0 + - uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.0 + with: + dotnet-version: | + 5.0.x + 8.0.x + + - name: Cache Tools + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 + with: + path: tools + key: ${{ runner.os }}-tools-${{ hashFiles('recipe.cake') }} + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@1b1aada464948af03b950897e5eb522f92603cc2 # v3 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + - name: Build project + uses: cake-build/cake-action@a6eb054329257c9e70a6c6bf01747ad6e1d9d52b # v1 + with: + script-path: recipe.cake + target: DotNetCore-Build + cake-version: 0.32.1 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@1b1aada464948af03b950897e5eb522f92603cc2 # v3 diff --git a/recipe.cake b/recipe.cake index 7314e1d..fc28784 100644 --- a/recipe.cake +++ b/recipe.cake @@ -12,15 +12,16 @@ BuildParameters.SetParameters(context: Context, webHost: "cake-contrib.github.io", webLinkRoot: "Cake.Terraform", webBaseEditUrl: "https://github.com/cake-contrib/Cake.Terraform/tree/develop/docs/input", - shouldRunGitVersion: true); + shouldRunGitVersion: true, + shouldRunDupFinder: false, + shouldRunInspectCode: false + //preferredBuildProviderType: BuildProviderType.GitHubActions, + //preferredBuildAgentOperatingSystem: PlatformFamily.Linux + ); BuildParameters.PrintParameters(Context); ToolSettings.SetToolSettings(context: Context, - dupFinderExcludePattern: new string[] { - BuildParameters.RootDirectoryPath + "/src/Cake.Terraform.Tests/**/*.cs" - }, - dupFinderThrowExceptionOnFindingDuplicates: false, testCoverageFilter: "+[*]* -[xunit.*]* -[Cake.Core]* -[Cake.Testing]* -[*.Tests]* ", testCoverageExcludeByAttribute: "*.ExcludeFromCodeCoverage*", testCoverageExcludeByFile: "*/*Designer.cs;*/*.g.cs;*/*.g.i.cs");