Simple Demo CRUD .NET 6 - Unit Testing Web Api.
Setting up a simple Github Workflow for Unit Testing following the Github Guide.
Just create a Workflow file
You may want to create a simple workflow badge to check the testing result after every commit.
Once you created the .yml file you just need to go to the Actions tab, select your action and click on "Create status badge".
Copy-paste the generated code in the readme.
Here it is the Microsoft reference to create the result badge.
Here I also raw-tested a publish package workflow wich runs on tag pushes like "v1.0.13" (regex). This is helpful if you want to automate the publication of a package.
Instead of just build the project, pack it and call the nuget-push api setting up a github secret.
- name: Pack
run: dotnet pack <YOUR_PROJECT>.csproj --configuration Release --no-build --output .
- name: Push Nuget
run: dotnet nuget push <YOUR_PROJECT>.${VERSION}.nupkg --source <API_URL> --api-key ${NUGET_API_KEY}
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
- name: Success Message
run: echo "Version ${VERSION} published! 🎉"