Skip to content

Commit

Permalink
housekeeping: Update tests and initial version release (#42)
Browse files Browse the repository at this point in the history
* housekeeping: Add tests

* Adding more tests

* Further updates

* Update github release action

* Update dependabot

* Fix the action

* Use dotnet to compile

* Remove msbuild action

* update versions

* Add missing build
  • Loading branch information
glennawatson authored May 29, 2021
1 parent 3e6c1b2 commit af57fd3
Show file tree
Hide file tree
Showing 68 changed files with 4,020 additions and 1,042 deletions.
455 changes: 455 additions & 0 deletions .editorconfig

Large diffs are not rendered by default.

131 changes: 91 additions & 40 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -1,74 +1,125 @@
name: .NET Core Desktop
name: Build and Release

on:
push:
branches: [ main ]
pull_request:
types: [opened, synchronize, reopened, closed]
branches: [ main ]

env:
configuration: Release
productNamespacePrefix: "DynamicData"
validRelease: ${{ contains(github.event.pull_request.labels.*.name, 'release') && github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true }}
productNamespacePrefix: "ReactiveMarbles"

jobs:
build:

runs-on: windows-latest

outputs:
nbgv: ${{ steps.nbgv.outputs.SemVer2 }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v2.3.4
with:
fetch-depth: 0

- name: Install .NET Core
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v1.8.0
with:
dotnet-version: '5.0.100-rc.1.20452.10'
dotnet-version: 3.1.x

- name: Install Latest NuGet
uses: nuget/setup-nuget@v1
- name: Install .NET 5
uses: actions/setup-dotnet@v1.8.0
with:
nuget-api-key: ${{ secrets.NuGetAPIKey }}
nuget-version: '5.x'
dotnet-version: 5.0.x

# - name: Update VS2019
# shell: powershell
# run: Start-Process -Wait -PassThru -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe" -ArgumentList "update --passive --norestart --installpath ""C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise"""

- name: NBGV
id: nbgv
uses: dotnet/nbgv@master
with:
setAllVars: true

- name: Restore NuGet Packages
- name: NuGet Restore
run: dotnet restore
working-directory: src

- name: Install Report Generator
run: dotnet tool install --global dotnet-reportgenerator-globaltool


- name: Build
run: dotnet build --configuration ${{env.configuration}} --no-restore
run: dotnet build --configuration=${{ env.configuration }} --verbosity=minimal --no-restore
working-directory: src

- name: Run Unit Tests
run: dotnet test --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput="../../artifacts/coverage/coverage.xml" /p:Include="[${{ env.productNamespacePrefix}}*]*" /p:Exclude="[${{ env.productNamespacePrefix}}*Tests.*]*"
working-directory: src
- name: Run Unit Tests and Generate Coverage
uses: glennawatson/coverlet-msbuild@v1
with:
project-files: '**/*Tests*.csproj'
no-build: true
exclude-filter: '[${{env.productNamespacePrefix}}.*.Tests.*]*'
include-filter: '[${{env.productNamespacePrefix}}*]*'
output-format: cobertura
output: '../../artifacts/'
configuration: ${{ env.configuration }}

- name: Upload Code Coverage
shell: bash
run: |
echo $PWD
bash <(curl -s https://codecov.io/bash) -X gcov -X coveragepy -t ${{ env.CODECOV_TOKEN }} -s '$PWD/artifacts' -f '*.xml'
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Create NuGet Artifacts
uses: actions/upload-artifact@master
with:
name: nuget
path: '**/*.nupkg'

# - name: Generate Coverage Report
# run: reportgenerator -reports:"coverage.*.xml" -targetdir:report-output
# working-directory: artifacts/coverage

# - name: Generate Coverage Artifacts
# uses: actions/upload-artifact@master
# with:
# name: Coverage
# path: artifacts/coverage/report-output

# - name: Upload Code Coverage
# uses: codecov/codecov-action@v1
# with:
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
# directory: artifacts/coverage

- name: Release to NuGet
if: ${{ env.validRelease == true }}
run: echo ${{ env.ValidRelease }}
release:
runs-on: windows-latest
needs: build
if: contains(github.event.pull_request.labels.*.name, 'release') && github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
with:
fetch-depth: 0

- name: Download NuGet Packages
uses: actions/download-artifact@v2.0.9
with:
name: nuget

- uses: nuget/setup-nuget@v1
name: Setup NuGet

# Decode the base 64 encoded pfx and save the Signing_Certificate
- name: Sign NuGet packages
shell: pwsh
run: |
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.SIGNING_CERTIFICATE }}")
[IO.File]::WriteAllBytes("GitHubActionsWorkflow.pfx", $pfx_cert_byte)
$secure_password = ConvertTo-SecureString ${{ secrets.SIGN_CERTIFICATE_PASSWORD }} –asplaintext –force
Import-PfxCertificate -FilePath GitHubActionsWorkflow.pfx -Password $secure_password -CertStoreLocation Cert:\CurrentUser\My
nuget sign -Timestamper http://timestamp.digicert.com -CertificateFingerprint ${{ secrets.SIGN_CERTIFICATE_HASH }} **/*.nupkg
- name: Changelog
uses: glennawatson/ChangeLog@v1
id: changelog

- name: Create Release
uses: actions/create-release@v1.1.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ needs.build.outputs.nbgv }}
release_name: ${{ needs.build.outputs.nbgv }}
body: |
${{ steps.changelog.outputs.commitLog }}
- name: NuGet Push
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}
SOURCE_URL: https://api.nuget.org/v3/index.json
run: |
dotnet nuget push -s ${{ env.SOURCE_URL }} -k ${{ env.NUGET_AUTH_TOKEN }} **/*.nupkg

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

110 changes: 93 additions & 17 deletions src/.idea/.idea.ReactiveMarbles.ObservableEvents/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit af57fd3

Please sign in to comment.