Skip to content
Open
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
21 changes: 0 additions & 21 deletions .github/workflows/NET472.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/NET60.yml

This file was deleted.

156 changes: 156 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
name: dotnet build

on:
workflow_call:
inputs:
build_artifact:
description: 'The name of the build artifact'
required: false
type: string
test_artifact:
description: 'The name of the test artifact'
required: false
type: string
retention:
description: 'The number of days to retain the artifact'
required: false
default: 5
type: number
ref:
description: 'The branch, tag or SHA to checkout. When checking out the repository that triggered a workflow, this defaults to the reference or SHA for that event.'
required: false
type: string
workflow_dispatch:
inputs:
build_artifact:
description: 'The name of the build artifact'
required: false
type: string
test_artifact:
description: 'The name of the test artifact'
required: false
type: string
retention:
description: 'The number of days to retain the artifact'
required: false
type: number
default: 5
ref:
description: 'The branch, tag or SHA to checkout. When checking out the repository that triggered a workflow, this defaults to the reference or SHA for that event.'
required: false
type: string

push:
tags: ["v*", "test-please-*"]
pull_request:
tags: ["v*"]

concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true


jobs:
build:

env:
ref: ${{github.ref_name}}-last
test: ${{ github.workspace }}/tests
DOTNET_INSTALL_DIR: ${{ github.workspace }}/.dotnet
dotnet-versions: 7.x-6.x
key: ${{format('{0}-{1}', github.ref_name, github.sha) }}
build_artifact: ${{inputs.build_artifact || format('build-artifact-{0}', github.sha) }}
test_artifact: ${{inputs.test_artifact || format('test-artifact-{0}', github.sha) }}

runs-on: ${{ github.event.act && 'self-hosted' || 'ubuntu-latest' }}

steps:
- name: Setup Env
run: |
echo "ref=${{inputs.ref || github.sha}}" >> $GITHUB_ENV
echo "test=${{ github.workspace }}/tests" >> $GITHUB_ENV
echo "DOTNET_INSTALL_DIR=${{ github.workspace }}/.dotnet" >> $GITHUB_ENV
echo "build_artifact=${{inputs.build_artifact || format('build-artifact-{0}', github.sha) }}" >> $GITHUB_ENV
echo "test_artifact=${{inputs.test_artifact || format('test-artifact-{0}', github.sha) }}" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
ref: ${{inputs.ref || github.sha}}
submodules: true
- name: Cache Net setup
uses: actions/cache@v2
id: cache-net
with:
path: ${{ env.DOTNET_INSTALL_DIR }}
key: ${{ runner.os }}-dotnet-${{env.dotnet-versions}}
restore-keys: |
${{ runner.os }}-dotnet-${{env.dotnet-versions}}

- name: Set dotnet path
run: echo "${{ env.DOTNET_INSTALL_DIR }}" >> $GITHUB_PATH
if: steps.cache-net.outputs.cache-hit == 'true'

- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.x
7.x
if: steps.cache-net.outputs.cache-hit != 'true'


- uses: actions/cache@v2
id: cache-nuget
with:
path: ${{ github.workspace }}/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-

- name: Restore dependencies
run: dotnet restore --packages ${{ github.workspace }}/.nuget/packages --use-lock-file

- name: Build
run: dotnet build --no-restore --configuration Release

- name: Upload sha build artifact to ${{env.build_artifact}}
uses: actions/upload-artifact@v3
with:
name: ${{env.build_artifact}}
path: ${{ github.workspace }}/**/*
retention-days: ${{inputs.retention}}

- name: Test
run: dotnet test --no-build --configuration Release --logger trx --results-directory ${{env.test}}
continue-on-error: true

- name: Process trx reports with default
id: process-trx
uses: im-open/process-dotnet-test-results@v2.3.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
ignore-test-failures: true
base-directory: ${{env.test}}
output-test-results: true
create-results-file: true
comment-identifier: 'unit-tests'
report-title-filter: "Unit Tests"

- name: Annotate Test Results
run: cat ${{ steps.process-test.outputs.test-results-file-path }} > $GITHUB_STEP_SUMMARY


- name: Upload dotnet test results to ${{env.test_artifact}}
uses: actions/upload-artifact@v3
with:
name: ${{env.test_artifact}}
path: ${{env.test}}/**/*
retention-days: ${{inputs.retention}}


- name: Fail if there were test problems
if: steps.process-trx.outputs.test-outcome == 'Failed'
run: |
echo "There were test failures."
exit 1


67 changes: 67 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Create Release

on:
push:
branches:
- beta

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions-ecosystem/action-get-merged-pull-request@v1
id: get-merged-pull-request
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions-ecosystem/action-release-label@v1
id: release-label
if: ${{ steps.get-merged-pull-request.outputs.title != null }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: ${{ steps.get-merged-pull-request.outputs.labels }}

- uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
if: ${{ steps.release-label.outputs.level != null }}
with:
semver_only: true

- uses: actions-ecosystem/action-bump-semver@v1
id: bump-semver
if: ${{ steps.release-label.outputs.level != null }}
with:
current_version: ${{ steps.get-latest-tag.outputs.tag }}
level: ${{ steps.release-label.outputs.level }}

- uses: actions-ecosystem/action-regex-match@v2
id: regex-match
if: ${{ steps.bump-semver.outputs.new_version != null }}
with:
text: ${{ steps.get-merged-pull-request.outputs.body }}
regex: '```release_note([\s\S]*)```'

- uses: actions-ecosystem/action-push-tag@v1
if: ${{ steps.bump-semver.outputs.new_version != null }}
with:
tag: ${{ steps.bump-semver.outputs.new_version }}
message: "${{ steps.bump-semver.outputs.new_version }}: PR #${{ steps.get-merged-pull-request.outputs.number }} ${{ steps.get-merged-pull-request.outputs.title }}"

- uses: actions/create-release@v1
if: ${{ steps.release-label.outputs.level == 'major' || steps.release-label.outputs.level == 'minor' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.bump-semver.outputs.new_version }}
release_name: ${{ steps.bump-semver.outputs.new_version }}
body: ${{ steps.regex-match.outputs.group1 }}

- uses: actions-ecosystem/action-create-comment@v1
if: ${{ steps.bump-semver.outputs.new_version != null }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
number: ${{ steps.get-merged-pull-request.outputs.number }}
body: |
The new version [${{ steps.bump-semver.outputs.new_version }}](https://github.com/${{ github.repository }}/releases/tag/${{ steps.bump-semver.outputs.new_version }}) has been released :tada:
25 changes: 0 additions & 25 deletions .github/workflows/dotnet.yml

This file was deleted.

84 changes: 84 additions & 0 deletions .github/workflows/release-nugets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: release add packages
on:
release:
types: [created, edited]
workflow_call:
inputs:
release_tag:
description: 'The release tag to use.'
required: true
type: string
workflow_dispatch:
inputs:
release_tag:
description: 'The release tag to use.'
required: true
type: string
push:
tags:
- v*

jobs:
build:
env:
DOTNET_INSTALL_DIR: ${{ github.workspace }}/.dotnet
dotnet-versions: 7.x-6.x
key: ${{format('{0}-{1}', github.ref_name, github.sha) }}

runs-on: ${{ github.event.act && 'self-hosted' || 'ubuntu-latest' }}

steps:
- uses: actions/checkout@v3
with:
submodules: true
ref: ${{ inputs.release_tag || github.event.release.tag_name || github.ref }}
- name: Cache Net setup
uses: actions/cache@v3
id: cache-net
with:
path: ${{ env.DOTNET_INSTALL_DIR }}
key: ${{ runner.os }}-dotnet-${{env.dotnet-versions}}
restore-keys: |
${{ runner.os }}-dotnet-${{env.dotnet-versions}}

- name: Set dotnet path
run: echo "${{ env.DOTNET_INSTALL_DIR }}" >> $GITHUB_PATH
if: steps.cache-net.outputs.cache-hit == 'true'

- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.x
7.x
if: steps.cache-net.outputs.cache-hit != 'true'


- uses: actions/cache@v3
id: cache-nuget
with:
path: ${{ github.workspace }}/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-

- name: Restore dependencies
run: dotnet restore --packages ${{ github.workspace }}/.nuget/packages --use-lock-file


- name: Build
run: dotnet build --no-restore --configuration Release

- name: Pack
run: dotnet pack --no-build --configuration Release --output ${{ github.workspace }}/nugets

- name: Upload NuGet to release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ inputs.release_tag || github.event.release.tag_name || github.ref_name }}
files: |
${{ github.workspace }}/nugets/*.nupkg
${{ github.workspace }}/nugets/*.snupkg
draft: true
Loading