Add-ci #13
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 Project | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
workflow_dispatch: ## turn available trigger manually the workflow | |
jobs: | |
versioning: | |
runs-on: ubuntu-latest | |
name: Versioning | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
fetch-depth: 0 | |
- uses: codacy/git-version@2.8.0 | |
id: version | |
with: | |
release-branch: master | |
prefix: v | |
## prefix to version | |
build: | |
runs-on: ubuntu-latest | |
name: Build Project | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '9.0.x' # Adjust the version as needed | |
cache: true | |
cache-dependency-path: ./src/**/packages.lock.json # Needs to enable cache directly in the main project first, adding that flag as true RestorePackagesWithLockFile | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build the project | |
run: dotnet build --configuration Release --no-restore | |
# Do the tests and generate the file | |
- name: Test | |
run: | | |
dotnet test --no-build --no-restore ./AspirePoc.sln --configuration Release --logger trx --results-directory "TestResults" | |
- uses: actions/upload-artifact@v4 # generate artifacts that turn available to download | |
with: | |
name: dotnet-test-results | |
path: TestResults | |