Skip to content

fix: 🐛 make unit tests run (#12) #64

fix: 🐛 make unit tests run (#12)

fix: 🐛 make unit tests run (#12) #64

Workflow file for this run

name: build
on:
push:
pull_request:
release:
types:
- published
env:
# Stop wasting time caching packages
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending usage data to Microsoft
DOTNET_CLI_TELEMETRY_OPTOUT: true
# Project name to pack and publish
PROJECT_NAME: DotNetFreeSwitch
# GitHub Packages Feed settings
GITHUB_FEED: https://nuget.pkg.github.com/DotNetFreeSwitch/
GITHUB_USER: Tochemey
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Official NuGet Feed settings
NUGET_FEED: https://api.nuget.org/v3/index.json
NUGET_KEY: ${{ secrets.NUGET_KEY }}
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
dotnet-quality: 'ga'
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build -c Release --no-restore
- name: Test
# figure out later why tests are failing on windows
if: matrix.os != 'windows-latest'
run: dotnet test -c Release
- name: Pack
if: matrix.os == 'ubuntu-latest'
run: dotnet pack -v normal -c Release --no-restore --include-symbols --include-source -p:PackageVersion=0.0.0 $PROJECT_NAME/$PROJECT_NAME.csproj
- name: Upload Artifact
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v2
with:
name: nupkg
path: ${{ env.PROJECT_NAME }}/bin/Release/*.nupkg
deploy:
needs: build
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
dotnet-quality: 'ga'
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build -c Release --no-restore
- name: Create Release NuGet package
run: |
arrTag=(${GITHUB_REF//\// })
VERSION="${arrTag[2]}"
echo Version: $VERSION
VERSION="${VERSION//v}"
echo Clean Version: $VERSION
dotnet pack -v normal -c Release --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg $PROJECT_NAME/$PROJECT_NAME.csproj
- name: Push to GitHub Feed
run: |
for f in ./nupkg/*.nupkg
do
curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED
done
- name: Push to NuGet Feed
run: dotnet nuget push ./nupkg/*.nupkg --source $NUGET_FEED --skip-duplicate --api-key $NUGET_KEY