Create codeql.yml #116
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: Continuous Integration | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
test: | |
name: Test | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest] #to consider later , ubuntu-latest, macos-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET Core 2.1 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: "2.1.x" | |
- name: Setup .NET Core 3.1 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: "3.1.x" | |
- name: Setup .NET 6.0 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: "6.0.x" | |
- name: Setup .NET 7.0 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: "7.0.x" | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
- name: Run tests | |
run: dotnet test --collect:"XPlat Code Coverage" | |
- name: Upload coverage | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Code coverage ${{ matrix.os }} | |
path: "**/coverage.cobertura.xml" | |
coverage: | |
name: Coverage | |
needs: [test] | |
runs-on: windows-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
- uses: actions/download-artifact@v2 | |
with: | |
name: Code coverage windows-latest | |
path: coverage-windows | |
- name: Generate coverage report | |
uses: danielpalme/ReportGenerator-GitHub-Action@4.8.12 | |
with: | |
reports: "**/coverage.cobertura.xml" | |
targetdir: "coverage-report" | |
reporttypes: "Cobertura" | |
# - name: Publish coverage report to Codacy | |
# uses: codacy/codacy-coverage-reporter-action@master | |
# if: github.repository == 'siemens/simatic-s7-webserver-api' && github.event_name == 'push' | |
# with: | |
# project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
# coverage-reports: coverage-report/Cobertura.xml | |
pack: | |
name: Pack | |
needs: [test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
- name: Create packages | |
run: dotnet pack --configuration Release --output ./packages | |
- name: Upload a Build Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: NuGet packages | |
path: packages/*.* | |
deploy: | |
name: Deploy | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
needs: [pack] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
- uses: actions/download-artifact@v2 | |
with: | |
name: NuGet packages | |
path: packages | |
- name: Print Files in packages folder | |
run: dir packages | |
- name: Push packages | |
run: dotnet nuget push "packages/*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |
- uses: dotnet/nbgv@v0.4.0 | |
id: nbgv | |
- name: Create GitHub release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ steps.nbgv.outputs.SemVer2 }} | |
release_name: v${{ steps.nbgv.outputs.SemVer2 }} | |
- name: Comment relevant issues and merge requests | |
uses: apexskier/github-release-commenter@v1.3.2 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
comment-template: | | |
This is addressed in release {release_link}. | |
label-template: | | |
state: released |