Skip to content

Update CI

Update CI #16

Workflow file for this run

name: service
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: self-hosted
environment: Default
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Run Unit Tests
run: |
dotnet test --filter "Tests.Units" \
--results-directory ./tests/reports/ \
--logger "trx;LogFileName=unit-tests.trx"
- name: Run Integration Tests
run: |
dotnet test --filter "Tests.Integrations" \
/p:CollectCoverage=true \
/p:CoverletOutputFormat=cobertura \
/p:CoverletOutput=./reports/code-coverage.xml
- name: Upload Unit Tests
uses: actions/upload-artifact@v3
with:
name: unit-test-results
path: ./tests/reports/unit-tests.trx
- name: Upload Code Coverage
uses: actions/upload-artifact@v3
with:
name: code-coverage-results
path: ./tests/reports/code-coverage.xml
- name: Login Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Run GitVersion
id: gitversion
uses: gittools/actions/gitversion@v3.0.0
with:
useConfigFile: true
env:
GITVERSION_FALLBACK_TAG: "latest"
- name: Display GitVersion Output
run: |
echo "GitVersion Output:"
echo "FullSemVer: ${{ steps.gitversion.outputs.fullsemver }}"
echo "SemVer: ${{ steps.gitversion.outputs.semver }}"
echo "Major: ${{ steps.gitversion.outputs.major }}"
echo "Minor: ${{ steps.gitversion.outputs.minor }}"
echo "Patch: ${{ steps.gitversion.outputs.patch }}"
# - name: Build Docker Image
# run: docker build -t ${{ github.repository }}:latest .
# - name: Tag Docker Image
# run: |
# docker tag ${{ github.repository }}:latest ${{ github.repository }}:${{ steps.gitversion.outputs.semver }}
# echo "Image tagged as ${{ github.repository }}:${{ steps.gitversion.outputs.semver }}"
# run: echo "Image tagged as ${{ github.repository }}:${{ steps.gitversion.outputs.semver }}"
# - name: Push Docker Image
# run: docker push ${{ github.repository }}:${{ env.VERSION }}