continuity/.gitea/workflows/server.yaml
Timothy Schenk 151aca2f14
All checks were successful
Test if Server can be built / build-server (push) Successful in 26s
Test if Server can be built / dependency-track (push) Successful in 28s
Test if Server can be built / sonarqube (push) Successful in 1m21s
ci: dependency track can run on any branch
2023-11-02 21:14:19 +01:00

79 lines
2.8 KiB
YAML

name: Test if Server can be built
run-name: ${{ gitea.actor }} is building the Server application
on: [ push ]
jobs:
build-server:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup dotnet
uses: https://github.com/actions/setup-dotnet@v3
with:
dotnet-version: 7.0
- name: Install dependencies
run: dotnet restore
- name: Build
run: |
dotnet build Server -c Release
# dotnet test Server.Tests -c Release
sonarqube:
needs: build-server
runs-on: ubuntu-latest
if: gitea.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
- name: Setup dotnet
uses: https://github.com/actions/setup-dotnet@v3
with:
dotnet-version: 7.0
- name: Install dependencies
run: |
dotnet restore
echo "::add-path::$HOME/.dotnet/tools"
- name: Setup Sonarqube Dependencies
run: |
apt-get update
apt-get install --yes openjdk-11-jre
dotnet tool install --global dotnet-sonarscanner
dotnet tool install --global dotnet-coverage
- name: Sonarqube Begin
run: |
dotnet sonarscanner begin /key:"${{ secrets.SONAR_PROJECT_KEY }}" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="${{ secrets.SONAR_HOST_URL }}"
- name: Sonarqube Scan
run: |
dotnet build Server -c Release
# dotnet test --collect "Code Coverage" --logger trx --results-directory "TestsResults"
# dotnet-coverage collect 'dotnet test' -f xml -o 'coverage.xml'
- name: Sonarqube End
run: |
dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
dependency-track:
needs: build-server
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup dotnet
uses: https://github.com/actions/setup-dotnet@v3
with:
dotnet-version: 7.0
- name: Install dependencies
run: |
dotnet restore
echo "::add-path::$HOME/.dotnet/tools"
- name: Setup Dependency Track Dependencies
run: |
dotnet tool install --global CycloneDX
- name: Generate SBOM
run: |
dotnet CycloneDX Server/Server.csproj -o . -dgl
- name: Upload SBOM
uses: https://github.com/DependencyTrack/gh-upload-sbom@v2.0.1
with:
apiKey: ${{ secrets.DEPENDENCY_TRACK_API_KEY }}
serverHostname: ${{ secrets.DEPENDENCY_TRACK_URL }}
projectName: ${{ secrets.DEPENDENCY_TRACK_PROJECT_NAME }}
autoCreate: true
# set projectversion to be the branch name
projectVersion: "${{ github.ref_name }}"
bomFilename: "${{ github.workspace }}/bom.xml"