Update EveWHMapperHelperTest.cs #186
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: CI-CD | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- "main" | |
env: | |
DOTNET_VERSION: '7.0.x' | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup JDK 11 𦴠| |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'oracle' | |
java-version: 17 | |
- name: Setup .NET7 𦴠| |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: ${{env.DOTNET_VERSION}} | |
- name: Check out code | |
uses: actions/checkout@v3 | |
with: | |
lfs: true | |
# Disabling shallow clone is recommended for improving relevancy of reporting | |
fetch-depth: 0 | |
- name: Start Posgresql | |
run: | | |
docker run --name db -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=mysecretpassword -e POSTGRES_DB=whmappertest -p 5432:5432 -d postgres | |
- name: Sleep for 5 seconds | |
uses: jakejarvis/wait-action@master | |
with: | |
time: '5s' | |
- name: Restore dependencies | |
run: dotnet restore | |
#- name: Build app π | |
# run: dotnet build WHMapper -c Release --no-restore | |
#- name: Run automated test π§ͺ | |
# env: | |
# ConnectionStrings__DefaultConnection: "server=localhost;port=5432;database=whmappertest;User Id=postgres;Password=mysecretpassword" | |
# run: dotnet test WHMapper.Tests -c Release | |
#- name: Publish app π | |
# run: dotnet publish WHMapper -c release -o ./WHMapper/app/publish | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v1 | |
with: | |
path: ~\sonar\cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Install SonarCloud scanners | |
run: | | |
dotnet tool install --global dotnet-sonarscanner | |
dotnet tool install --global dotnet-coverage | |
- name: SonarCloud Build and Analyze π π§ͺ | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
ConnectionStrings__DefaultConnection: "server=localhost;port=5432;database=whmappertest;User Id=postgres;Password=mysecretpassword" | |
#run: | | |
# dotnet-sonarscanner begin /k:"pfh59_eve-whmapper" /o:"pfh59" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml | |
# dotnet build WHMapper -c Release --no-restore | |
# dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" | |
run: | | |
dotnet-sonarscanner begin /k:"pfh59_eve-whmapper" /o:"pfh59" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml | |
dotnet build WHMapper -c Release --no-restore | |
dotnet-coverage collect "dotnet test WHMapper.Tests -c Release" -f xml -o "coverage.xml" | |
dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" | |
#publish_docker_images: | |
# runs-on: ubuntu-latest | |
# needs: build | |
# steps: | |
- name: Extract metadata (tags, labels) for Docker | |
if: github.event_name != 'pull_request' | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=sha | |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }} | |
flavor: | | |
latest=false | |
- name: Log in to the Container registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push π | |
if: github.event_name != 'pull_request' | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./WHMapper/ | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |