Bump System.Data.SqlClient from 4.8.2 to 4.8.6 in /SqlServer.Rules.Test #128
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: .NET Pipeline | |
# Steps Information: | |
# SplitRepoName - splits the repo name into two parts : name, owner | |
# Setup .Net | |
# Checkout | |
# Install dotnet format - installs the dotnet format tool which will be used for the linting | |
# Linter - validates the code against the editorconfig and throws an error if any of the rules fail | |
# Build - builds the dlls | |
# Run Unit Tests - Runs the unit tests defined in the project | |
# Remove Docs - Removes the docs folder in preparation for it to be regenerated. So any deleted rules have their markdown removed. | |
# Extract Build Info - Extracts the build location, and assembly info from the csproj file, Extracts: | |
# - ${{ env.BUILD_OUTPUT_PATH }} - The directory path where the build output is placed | |
# - ${{ env.BUILD_OUTPUT_DLL }} - The fully qualified path to the build dll | |
# Generate Docs - generates the rules for the docs by extracting that information from the rule attribute, and the xml comments | |
# Write Docs Tree - purely a debugging step to see what doc files were written by the powershell | |
# Commit doc files - Commits any changes if there are any to the repo as the user Github Action | |
# Push doc changes - pushes the commit if there is one to the repo | |
# Create Release Zip(IF BRANCH==MASTER) - creates a release zip, containing the docs and binaries | |
# Bump version and push tag(IF BRANCH==MASTER) - semantic version tags branch | |
# Create Release(IF BRANCH==MASTER) - creates a release from the zip with using the tag version | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: SplitRepoName | |
shell: powershell | |
run: | | |
$repoVals = "${{github.repository}}" -split '/', 2 | |
echo "REPO_OWNER=$($repoVals[0])" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
echo "REPO_NAME=$($repoVals[1])" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- uses: dorny/paths-filter@v2 | |
id: changes_filter | |
with: | |
filters: | | |
workflows: | |
- '.github/workflows/**/*' | |
rules: | |
- 'SqlServer.Rules/**/*' | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: "5.0.x" # SDK Version to use; x will use the latest version of the 5.0 channel | |
# LINTER | |
# Format the output of dotnet format | |
- name: Add dotnet-format problem matcher | |
uses: xt0rted/dotnet-format-problem-matcher@v1 | |
# Install dotnet format as a global tool | |
- name: Install dotnet format | |
run: dotnet tool update --global dotnet-format | |
- name: Run dotnet format | |
run: dotnet format --check --verbosity diagnostic | |
# BUILD | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore --configuration Release | |
# RUN TESTS | |
- name: Run Unit Tests | |
run: dotnet test --no-build --configuration Release --verbosity normal | |
# REMOVE DOCS - TO REMOVE DELETED RULES | |
- name: Remove docs | |
if: ${{ github.ref == 'refs/heads/master' && (steps.changes_filter.outputs.workflows == 'true' || steps.changes_filter.outputs.rules == 'true') }} | |
run: | | |
git rm -rf ./docs/Performance/ | |
git rm -rf ./docs/Design/ | |
git rm -rf ./docs/Naming/ | |
# EXTRACT BUILD INFO | |
- name: Extract Build Info | |
shell: powershell | |
run: | | |
.\.github\workflows\get_project_outputs.ps1 ` | |
-ProjectPath "${{ github.workspace }}\SqlServer.Rules\SqlServer.Rules.csproj" ` | |
-TargetFramework "^net.*" | |
# GENERATE DOCS | |
- name: Generate Docs | |
if: ${{ github.ref == 'refs/heads/master' && (steps.changes_filter.outputs.workflows == 'true' || steps.changes_filter.outputs.rules == 'true') }} | |
shell: powershell | |
run: | | |
.\.github\workflows\generate_docs.ps1 ` | |
-ParentDirectory "${{ github.workspace }}" ` | |
-RulesDllPath "${{ env.BUILD_OUTPUT_DLL }}" | |
# TREE DOCS - JUST TO GIVE A VISUAL OF THE FILES GENERATED FOR DEBUG PURPOSES | |
- name: Write Docs Tree | |
run: tree /f .\docs | |
# COMMIT DOCS - ONLY IF THERE ARE FILE CHANGES | |
- name: Commit doc files | |
if: ${{ github.ref == 'refs/heads/master' && (steps.changes_filter.outputs.workflows == 'true' || steps.changes_filter.outputs.rules == 'true') }} | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add . | |
git diff-index --quiet HEAD || git commit -m "Updating the repository docs folder" | |
# PUSH DOCS | |
- name: Push doc changes | |
uses: ad-m/github-push-action@master | |
if: ${{ github.ref == 'refs/heads/master' && (steps.changes_filter.outputs.workflows == 'true' || steps.changes_filter.outputs.rules == 'true') }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.HEAD_REF }} | |
force: true | |
- name: Bump version and push tag | |
id: tag_version | |
uses: mathieudutour/[email protected] | |
if: ${{ github.ref == 'refs/heads/master' && (steps.changes_filter.outputs.workflows == 'true' || steps.changes_filter.outputs.rules == 'true') }} | |
with: | |
github_token: "${{ secrets.GITHUB_TOKEN }}" | |
# CREATE RELEASE | |
- name: Create Release Zip | |
if: ${{ github.ref == 'refs/heads/master' && (steps.changes_filter.outputs.workflows == 'true' || steps.changes_filter.outputs.rules == 'true') }} | |
shell: powershell | |
run: | | |
.\.github\workflows\create_release.ps1 ` | |
-ParentDirectory "${{ github.workspace }}" ` | |
-BuildDirectory "${{ env.BUILD_OUTPUT_PATH }}" ` | |
-releasePath "${{ github.workspace }}\\$($env:REPO_NAME).${{ steps.tag_version.outputs.new_tag }}.zip" | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
if: ${{ github.ref == 'refs/heads/master' && (steps.changes_filter.outputs.workflows == 'true' || steps.changes_filter.outputs.rules == 'true') }} | |
with: | |
artifacts: "${{ github.workspace }}\\${{ env.REPO_NAME }}.${{ steps.tag_version.outputs.new_tag }}.zip" | |
token: "${{ secrets.GITHUB_TOKEN }}" | |
tag: "${{ steps.tag_version.outputs.new_tag }}" |