Skip to content
Merged

V7 #12

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions .github/actions/push-package/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ inputs:
description: 'The package registry (github or nuget)'
default: github
required: true
outputs:
coverage-line:
description: 'Line coverage percentage'
value: ${{ steps.extract-coverage.outputs.line }}
coverage-branch:
description: 'Branch coverage percentage'
value: ${{ steps.extract-coverage.outputs.branch }}
runs:
using: "composite"
steps:
Expand All @@ -33,11 +40,28 @@ runs:
- name: Build
run: dotnet build ./src/${{ inputs.project }}/${{ inputs.project }}.csproj -c ${{ inputs.config }} --verbosity minimal
shell: bash

# Test
- name: Test
if: ${{ inputs.skiptest == 'false' }}
run: dotnet test ./test/${{ inputs.project }}.Tests/${{ inputs.project }}.Tests.csproj -c ${{ inputs.config }} --verbosity minimal
run: dotnet test ./test/${{ inputs.project }}.Tests/${{ inputs.project }}.Tests.csproj -c ${{ inputs.config }} --verbosity minimal --collect:"XPlat Code Coverage" --results-directory ./coverage
shell: bash

# Generate coverage report
- name: Coverage Report
if: ${{ inputs.skiptest == 'false' }}
run: reportgenerator -reports:./coverage/**/coverage.cobertura.xml -targetdir:./coverage/report -reporttypes:JsonSummary
shell: bash

# Extract line and branch coverage percentages
- name: Extract Coverage
id: extract-coverage
if: ${{ inputs.skiptest == 'false' }}
run: |
LINE=$(cat ./coverage/report/Summary.json | python3 -c "import sys,json; d=json.load(sys.stdin); print(round(d['summary']['linecoverage']))")
BRANCH=$(cat ./coverage/report/Summary.json | python3 -c "import sys,json; d=json.load(sys.stdin); print(round(d['summary']['branchcoverage']))")
echo "line=$LINE" >> $GITHUB_OUTPUT
echo "branch=$BRANCH" >> $GITHUB_OUTPUT
shell: bash

# Pack
Expand All @@ -59,7 +83,7 @@ runs:
if: ${{ inputs.registry == 'nuget' }}
run: dotnet nuget push _packages/${{ inputs.project }}.${{ inputs.version }}.nupkg --skip-duplicate --no-symbols --api-key ${{ inputs.ghapikey }} --source github
shell: bash

# Second push to Nuget (for package cadence, Github will be used and in production Nuget after package verification)
- name: Nuget Push
if: ${{ inputs.registry == 'nuget' }}
Expand Down
38 changes: 19 additions & 19 deletions .github/workflows/build-test-cross.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,30 @@ jobs:

# Checkout
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v6

# Read env
# Read env
- name: Read Env
run: cat .github/package_version.env >> $GITHUB_ENV
continue-on-error: false

# Setup .Net with global.json
- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v5

# Restore dependencies
- name: Restore
run: dotnet restore

# Build
- name: Build
run: dotnet build --no-restore

# Test
- name: Test
run: dotnet test --no-build --verbosity normal
macos:

macos:
runs-on: macos-latest
timeout-minutes: 15

Expand All @@ -64,44 +64,44 @@ jobs:

# Checkout
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v6

# Setup .Net with global.json
- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v5

# Restore dependencies
- name: Restore
run: dotnet restore

# Build
- name: Build
run: dotnet build --no-restore

# Test
- name: Test
run: dotnet test --no-build --verbosity normal
windows:

windows:
runs-on: windows-latest
timeout-minutes: 15

# Environment Variables
env:
# GitHub package authentication
PI_GITHUB_USERNAME_ENV: ${{ secrets.PI_GITHUB_USERNAME }}
PI_GITHUB_PAT_ENV: ${{ secrets.PI_GITHUB_PAT }}
PI_CI_REFERENCE: cross

steps:

# Checkout
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v6

# Setup .Net with global.json
- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v5

# Restore dependencies
- name: Restore
Expand Down
43 changes: 35 additions & 8 deletions .github/workflows/build-test-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:

# Checkout
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v6

# Read env
- name: Read Env
Expand Down Expand Up @@ -109,13 +109,12 @@ jobs:

# Setup .Net with global.json
- name: Setup .NET
uses: actions/setup-dotnet@v3

# Setup Nuget
- name: Setup NuGet.exe
uses: NuGet/setup-nuget@v1
with:
nuget-version: latest
uses: actions/setup-dotnet@v5

# Setup ReportGenerator
- name: Setup ReportGenerator
run: dotnet tool install --global dotnet-reportgenerator-globaltool
continue-on-error: false

# Setup local
# OneImlx.Shared is the first package so we use the local project reference to avoid cyclic Nuget dependency resolution.
Expand All @@ -126,6 +125,7 @@ jobs:

# Publish OneImlx.Shared
- name: OneImlx.Shared
id: oneimlx-shared
uses: ./.github/actions/push-package
with:
project: OneImlx.Shared
Expand All @@ -142,6 +142,7 @@ jobs:

# Publish OneImlx.Test
- name: OneImlx.Test
id: oneimlx-test
uses: ./.github/actions/push-package
with:
project: OneImlx.Test
Expand All @@ -151,3 +152,29 @@ jobs:
ghapikey: ${{ env.PI_GITHUB_PAT_ENV }}
nugetapikey: ${{ env.PI_NUGET_PAT_ENV }}
registry: ${{ env.PI_PUBLISH_REGISTRY }}

# Update line coverage badge in Gist
- name: Line Coverage Badge
uses: Schneegans/dynamic-badges-action@v1.8.0
with:
auth: ${{ secrets.PI_GITHUB_GIST_PAT }}
gistID: ${{ secrets.PI_GITHUB_GIST_ID }}
filename: coverage_${{ github.event.repository.name }}_line.json
label: coverage-line
message: ${{ steps.oneimlx-shared.outputs.coverage-line }}%
valColorRange: ${{ steps.oneimlx-shared.outputs.coverage-line }}
maxColorRange: 100
minColorRange: 0

# Update branch coverage badge in Gist
- name: Branch Coverage Badge
uses: Schneegans/dynamic-badges-action@v1.8.0
with:
auth: ${{ secrets.PI_GITHUB_GIST_PAT }}
gistID: ${{ secrets.PI_GITHUB_GIST_ID }}
filename: coverage_${{ github.event.repository.name }}_branch.json
label: coverage-branch
message: ${{ steps.oneimlx-shared.outputs.coverage-branch }}%
valColorRange: ${{ steps.oneimlx-shared.outputs.coverage-branch }}
maxColorRange: 100
minColorRange: 0
6 changes: 3 additions & 3 deletions .github/workflows/delete-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
# Delete specific
- name: Delete ${{ env.PI_DELETE_PACKAGES }}
if: ${{ env.PI_DELETE_PACKAGES != 'All' }}
uses: actions/delete-package-versions@v4
uses: actions/delete-package-versions@v5
with:
package-name: ${{ env.PI_DELETE_PACKAGES }}
package-type: nuget
Expand All @@ -74,7 +74,7 @@ jobs:
# Delete OneImlx.Shared
- name: Delete OneImlx.Shared
if: ${{ env.PI_DELETE_PACKAGES == 'All' }}
uses: actions/delete-package-versions@v4
uses: actions/delete-package-versions@v5
with:
package-name: OneImlx.Shared
package-type: nuget
Expand All @@ -83,7 +83,7 @@ jobs:
# Delete OneImlx.Test
- name: Delete OneImlx.Test
if: ${{ env.PI_DELETE_PACKAGES == 'All' }}
uses: actions/delete-package-versions@v4
uses: actions/delete-package-versions@v5
with:
package-name: OneImlx.Test
package-type: nuget
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ This repository contains the shared components for our cross-platform frameworks
[![Cross-Platform Build and Test](https://github.com/perpetualintelligence/shared/actions/workflows/build-test-cross.yml/badge.svg)](https://github.com/perpetualintelligence/shared/actions/workflows/build-test-cross-manual.yml)
[![Push Build and Test](https://github.com/perpetualintelligence/shared/actions/workflows/build-test-push.yml/badge.svg)](https://github.com/perpetualintelligence/shared/actions/workflows/build-test-push.yml)

![coverage-line: 66%](https://img.shields.io/badge/coverage--line-66%25-yellow)
![coverage-branch: 60%](https://img.shields.io/badge/coverage--branch-76%25-orange)
![coverage-line](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/perpetualintelligencegit/141903832ee52f1e9e7913300a92d507/raw/coverage_shared_line.json)
![coverage-branch](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/perpetualintelligencegit/141903832ee52f1e9e7913300a92d507/raw/coverage_shared_branch.json)

## Feedback
We welcome feedback and suggestions. Issues and tasks are tracked in the [GitHub Issues](https://github.com/perpetualintelligence/shared/issues). Details about our issue classification and resolution procedures are available in our [Issues Policy](https://terms.perpetualintelligence.com/articles/issues_policy.html).
Expand Down