chore: migrate build to GitHub Actions #22
Workflow file for this run
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" | |
on: | |
push: | |
branches: ["main"] | |
paths: | |
- 'src/**' | |
pull_request: | |
branches: ["main"] | |
paths: | |
- 'src/**' | |
- '.github/workflows/build.yml' | |
jobs: | |
analyze: | |
name: test and pack | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/setup@v0 | |
with: | |
versionSpec: '5.x' | |
preferLatestVersion: true | |
- name: Determine version | |
id: gitversion | |
uses: gittools/actions/gitversion/execute@v0 | |
with: | |
updateAssemblyInfo: true | |
useConfigFile: true | |
configFilePath: gitversion.yml | |
- name: Show version | |
run: | | |
echo "Major: ${{ steps.gitversion.outputs.major }}" | |
echo "Minor: ${{ steps.gitversion.outputs.minor }}" | |
echo "Patch: ${{ steps.gitversion.outputs.patch }}" | |
echo "MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}" | |
echo "SemVer: ${{ steps.gitversion.outputs.semVer }}" | |
echo "NuGetVersion: ${{ steps.gitversion.outputs.nuGetVersion }}" | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '7.x' | |
dotnet-quality: 'ga' | |
- name: Build solution | |
run: > | |
dotnet build | |
--configuration Release | |
--property:Version=${{ steps.gitversion.outputs.nuGetVersion }} | |
--property:ContinuousIntegrationBuild=true | |
-warnAsError | |
- name: Test library | |
run: > | |
dotnet test | |
--configuration Release | |
--no-build | |
--logger trx | |
--results-directory "TestResults" | |
--collect "Code Coverage" | |
- name: Save test results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-results | |
path: TestResults | |
if: ${{ always() }} | |
- name: Pack for NuGet | |
run: > | |
dotnet pack src/Indicators.csproj | |
--configuration Release | |
--no-build | |
--include-symbols | |
--output NuGet | |
-p:PackageVersion=${{ steps.gitversion.outputs.nuGetVersion }} | |
- name: Save NuGet package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: packages | |
path: NuGet |