Skip to content

Commit

Permalink
Merge pull request #1 from Axemasta/actions
Browse files Browse the repository at this point in the history
Added Test, Build, Release Actions
  • Loading branch information
Axemasta authored Aug 23, 2023
2 parents 9565a63 + 4ac77b4 commit 565d618
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 27 deletions.
62 changes: 36 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,35 @@ on:
- 'version.json'

jobs:
build-test:
test:
runs-on: windows-latest

if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # https://github.com/dotnet/Nerdbank.GitVersioning/blob/main/doc/cloudbuild.md
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage"
- name: Publish Code Coverage To PR
uses: 5monkeys/cobertura-action@v13
with:
path: tests/Moq.INavigationService.Tests/TestResults/*/coverage.cobertura.xml
minimum_coverage: 5
show_line: true
show_branch: true
show_missing: true

build:
runs-on: windows-latest
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -28,27 +54,14 @@ jobs:
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage"
if: github.event_name == 'pull_request'
- name: Publish Code Coverage To PR
uses: 5monkeys/cobertura-action@v13
with:
path: tests/Mocale.UnitTests/TestResults/*/coverage.cobertura.xml
minimum_coverage: 5
show_line: true
show_branch: true
show_missing: true
if: github.event_name == 'pull_request'
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: drop
path: src/**/*.nupkg
if: github.event_name != 'pull_request'

release:
needs: build-test
needs: build
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
env:
Expand All @@ -60,20 +73,17 @@ jobs:

- name: Download artifacts
id: download-artifact
uses: dawidd6/action-download-artifact@v2
uses: actions/download-artifact@v2.1.1
with:
name: ${{ inputs.artifact-name }}
repo: Axemasta/Mocale
workflow: mocale-ci.yml
name: drop
path: Artifacts/
search_artifacts: true

- name: Process NuGet Version
shell: pwsh
working-directory: Artifacts/
id: process-version
run: |
$Artifact = Get-ChildItem -Recurse | Where-Object { $_.Name.EndsWith('.nupkg') -and $_.Name.StartsWith('Mocale.') } | Select-Object -First 1
$Artifact = Get-ChildItem -Recurse | Where-Object { $_.Name.EndsWith('.nupkg') -and $_.Name.StartsWith('Axemasta.Moq.INavigationService.') } | Select-Object -First 1
$ArtifactName = $Artifact.Name
$Pattern = '\b\d+\.\d+\.\d+(-\w+)?\b'
Expand Down Expand Up @@ -115,16 +125,16 @@ jobs:
- uses: ncipollo/release-action@main
name: Create Release
with:
artifacts: ${{ inputs.artifacts }}
artifactErrorsFailBuild: ${{ inputs.artifactErrorsFailBuild }}
artifacts: Artifacts/**/*.nupkg
artifactErrorsFailBuild: true
draft: true
generateReleaseNotes: true
name: ${{ env.RELEASE_TITLE }}
tag: ${{ env.VERSION_NAME }}
prerelease: ${{ env.IS_PRERELEASE }}
body: ${{ inputs.release-notes }}
body: "TODO"

- name: Publish NuGet
run: nuget push ${{ inputs.artifacts }} -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{ secrets.NUGET_API_KEY }} -SkipDuplicate
run: nuget push Artifacts/**/*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{ secrets.NUGET_API_KEY }} -SkipDuplicate


2 changes: 1 addition & 1 deletion src/Moq.INavigationService/Moq.INavigationService.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PropertyGroup Label="NuGet">
<AssemblyName>Moq.INavigationService</AssemblyName>
<RootNamespace>Moq</RootNamespace>
<PackageId>Moq.INavigationService</PackageId>
<PackageId>Axemasta.Moq.INavigationService</PackageId>
<Summary>Testing library for Prism.Maui's INavigationService using Moq.</Summary>
<PackageTag>prism,maui,prism.maui,moq,inavigationservice</PackageTag>
<Title>Moq.INavigationService</Title>
Expand Down

0 comments on commit 565d618

Please sign in to comment.