Skip to content
Merged
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
36 changes: 0 additions & 36 deletions .github/workflows/build.yml

This file was deleted.

67 changes: 10 additions & 57 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,18 @@
name: Publish release

on:
push:
branches:
- main
- master
- develop
release:
types:
- published

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check github.ref starts with 'refs/tags/'
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
run: |
echo Error! github.ref does not start with 'refs/tags'
echo github.ref: ${{ github.ref }}
exit 1
- name: Set version number environment variable
env:
github_ref: ${{ github.ref }}
run: |
ref="${github_ref:10}"
echo $ref
echo "ref=$ref" >> $GITHUB_ENV
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
source-url: https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.NUGET_AUTH_TOKEN}}
- name: Install dependencies
run: dotnet restore
- name: Build solution [Release]
run: dotnet build --no-restore -c Release -p:Version=$ref
- name: Pack solution [Release]
run: dotnet pack --no-restore --no-build -c Release -p:Version=$ref -o out
- name: Publish artifacts
uses: actions/upload-artifact@v4
with:
name: Nuget packages
path: out/*
- name: Publish Nuget packages to NuGet registry
run: dotnet nuget push "out/*" -k ${{secrets.NUGET_AUTH_TOKEN}}
- name: Upload nuget packages as release artifacts
uses: actions/github-script@v2
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
console.log('environment', process.versions);
const fs = require('fs').promises;
const { repo: { owner, repo }, sha } = context;
for (let file of await fs.readdir('out')) {
console.log('uploading', file);
await github.repos.uploadReleaseAsset({
owner,
repo,
release_id: ${{ github.event.release.id }},
name: file,
data: await fs.readFile(`out/${file}`)
});
}
publish:
uses: Shane32/SharedWorkflows/.github/workflows/publish-nuget.yml@v1
with:
dotnet_folder: '.'
secrets: inherit
78 changes: 11 additions & 67 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,72 +2,16 @@ name: Run code tests

on:
pull_request:
push:
branches:
- main
- master
- develop

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Install dependencies
run: dotnet restore
- name: Build solution [Debug]
run: dotnet build --no-restore
- name: Test solution [Debug]
run: >
dotnet test --no-restore --no-build --collect "XPlat Code Coverage" --results-directory .
--
DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=lcov
# ==== code coverage reports ====
- name: Move coverage file
shell: bash
run: find ./**/coverage.info -exec mv {} ./output.lcov.info \;
- name: Convert coverage report to clover & htmlsummary format
uses: danielpalme/ReportGenerator-GitHub-Action@4.7.1
with:
reports: 'output.lcov.info'
targetdir: '.'
reporttypes: 'Clover;HtmlSummary'
tag: 'test_${{ github.run_number }}'
- name: Convert coverage report to html
uses: danielpalme/ReportGenerator-GitHub-Action@4.7.1
with:
reports: 'output.lcov.info'
targetdir: './code_coverage'
reporttypes: 'Html'
tag: 'test_${{ github.run_number }}'
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Test coverage reports
path: |
output.lcov.info
Clover.xml
code_coverage/**
summary.html
- name: Monitor coverage
if: ${{ github.event_name == 'pull_request' }}
uses: slavcodev/coverage-monitor-action@1.2.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
clover_file: "Clover.xml"
threshold_alert: 60
threshold_warning: 80

format:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Install dependencies
run: dotnet restore
- name: Check formatting
run: dotnet format --no-restore --verify-no-changes --severity error
build-check:
uses: Shane32/SharedWorkflows/.github/workflows/build-check.yml@v1
with:
dotnet_folder: '.'
coveralls: true
secrets: inherit
3 changes: 1 addition & 2 deletions Shane32.TestHelpers.sln
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
global.json = global.json
README.md = README.md
LICENSE = LICENSE
README.md = README.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "src\Tests\Tests.csproj", "{87DB4CC0-4AC3-4AC1-97FD-7C55D3B921D9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Workflows", "Workflows", "{1DAFDDB7-1BBC-4F75-BB8D-C6430F9DFA02}"
ProjectSection(SolutionItems) = preProject
.github\workflows\build.yml = .github\workflows\build.yml
.github\workflows\publish.yml = .github\workflows\publish.yml
.github\workflows\tests.yml = .github\workflows\tests.yml
EndProjectSection
Expand Down
Loading