v19-r1 #19
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: feature CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- feature/* | |
paths-ignore: | |
- 'README' | |
- 'README.md' | |
- 'LICENSE' | |
- '.github/workflows/**' | |
- '.github/actions/**' | |
- 'Dockerfile' | |
- 'Dockerfile.*' | |
- 'docker-compose.yml' | |
- 'docker-compose.*.yml' | |
run-name: v${{ github.run_number }}-r${{ github.run_attempt }} | |
jobs: | |
build_and_test: | |
name: build_and_test | |
runs-on: ${{ vars.DEFAULT_RUNS_ON }} | |
steps: | |
- uses: btungut/devops/.github/actions/common@master | |
id: common | |
- uses: btungut/devops/.github/actions/git-checkout@master | |
with: | |
gitToken: ${{ secrets.GITHUB_TOKEN }} | |
- name: dotnet_restore_and_build | |
id: dotnet_restore_and_build | |
shell: bash | |
run: | | |
set -euo pipefail | |
dotnet restore | |
dotnet build -c Release | |
working-directory: app | |
# run tests and publish cobertura report | |
- name: dotnet_test | |
id: dotnet_test | |
shell: bash | |
run: | | |
set -euo pipefail | |
rm -rf ./coverage* | |
dotnet test --collect:"XPlat Code Coverage" --results-directory ./coverage -c Release --no-build --no-restore --verbosity normal | |
working-directory: app/tests | |
- name: copy_coverage_files | |
shell: bash | |
run: | | |
set -euo pipefail | |
# find *.xml file under app/tests/coverage directory, if not exist or exist more than one fail, else copy it to the root directory | |
coverage_files=$(find app/tests/coverage -name '*.xml') | |
if [ $(echo "$coverage_files" | wc -l) -ne 1 ]; then | |
echo "Coverage file not found or found more than one: $coverage_files" | |
exit 1 | |
fi | |
cp $coverage_files ${{ runner.temp }}/result.xml | |
- uses: danielpalme/[email protected] | |
with: | |
reports: ${{ runner.temp }}/result.xml | |
reporttypes: "Html;MarkdownSummary;Cobertura" | |
toolpath: 'reportgeneratortool' | |
targetdir: coveragereport | |
tag: ${{ runner.name }} | |
- shell: bash | |
run: | | |
set -euo pipefail | |
tree coveragereport | |
- name: Upload coverage report artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: CoverageReport # Artifact name | |
path: coveragereport # Directory containing files to upload | |
- name: Publish coverage in build summary # Only applicable if 'MarkdownSummaryGithub' or one of the other Markdown report types is generated | |
run: | | |
cat coveragereport/SummaryGithub.md >> $GITHUB_STEP_SUMMARY # Adjust path and filename if necessary | |
shell: bash | |
# - name: irongut_coverage | |
# uses: irongut/[email protected] | |
# with: | |
# filename: result.xml | |
# badge: true | |
# fail_below_min: true | |
# format: markdown | |
# hide_branch_rate: false | |
# hide_complexity: false | |
# indicators: true | |
# output: both | |
# thresholds: '50 75' |