Merge pull request #264 from dodexahedron/convert-tests-to-constraint… #788
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build, test and package | |
on: push | |
jobs: | |
package: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build | |
run: cd src && dotnet build | |
- name: Test | |
run: | | |
cd tests && dotnet test --configuration Debug --verbosity normal --collect:'XPlat Code Coverage' --settings coverlet.runsettings | |
- name: Move test results to accessible directory | |
run: | | |
mkdir TestResults | |
mv -v --backup=numbered tests/TestResults/*/*.* TestResults/ | |
# Note: this step is currently not writing to the gist for some reason | |
- name: Create Test Coverage Badge | |
uses: simon-k/[email protected] | |
id: create_coverage_badge | |
with: | |
label: Unit Test Coverage | |
color: brightgreen | |
path: TestResults/coverage.opencover.xml | |
gist-filename: code-coverage.json | |
# https://gist.github.com/tznind/2a31eee1c9151917aa8d17b59bc86633 | |
gist-id: 2a31eee1c9151917aa8d17b59bc86633 | |
gist-auth-token: ${{ secrets.GIST_AUTH_TOKEN }} | |
- name: Print Code Coverage | |
run: | | |
echo "Code coverage percentage: ${{steps.create_coverage_badge.outputs.percentage}}%" | |
echo "Badge data: ${{steps.create_coverage_badge.outputs.badge}}" | |
- name: Pack | |
run: cd src && dotnet pack | |
- name: Publish to Nuget | |
if: contains(github.ref, 'refs/tags/v') | |
run: dotnet nuget push ./src/nupkg/TerminalGuiDesigner.$(fgrep \<Version\> ./src/TerminalGuiDesigner.csproj | grep -oEi '[-0-9.rc]{5,}').nupkg --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json |