2024-01-23 19:24:52 +01:00
|
|
|
name: Testing
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- "main"
|
|
|
|
- "rc"
|
|
|
|
- "hotfix-rc"
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
env:
|
|
|
|
_AZ_REGISTRY: "bitwardenprod.azurecr.io"
|
|
|
|
|
|
|
|
jobs:
|
2024-08-13 18:56:47 +02:00
|
|
|
check-test-secrets:
|
|
|
|
name: Check for test secrets
|
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
outputs:
|
|
|
|
available: ${{ steps.check-test-secrets.outputs.available }}
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Check
|
|
|
|
id: check-test-secrets
|
|
|
|
run: |
|
|
|
|
if [ "${{ secrets.CODECOV_TOKEN }}" != '' ]; then
|
|
|
|
echo "available=true" >> $GITHUB_OUTPUT;
|
|
|
|
else
|
|
|
|
echo "available=false" >> $GITHUB_OUTPUT;
|
|
|
|
fi
|
|
|
|
|
2024-01-23 19:24:52 +01:00
|
|
|
testing:
|
|
|
|
name: Run tests
|
2024-01-29 19:25:34 +01:00
|
|
|
if: ${{ startsWith(github.head_ref, 'version_bump_') == false }}
|
2024-01-23 19:24:52 +01:00
|
|
|
runs-on: ubuntu-22.04
|
2024-08-13 18:56:47 +02:00
|
|
|
needs: check-test-secrets
|
2024-08-13 14:24:15 +02:00
|
|
|
permissions:
|
|
|
|
checks: write
|
|
|
|
contents: read
|
|
|
|
pull-requests: write
|
|
|
|
|
2024-01-23 19:24:52 +01:00
|
|
|
env:
|
|
|
|
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
|
2024-08-13 14:24:15 +02:00
|
|
|
|
2024-01-23 19:24:52 +01:00
|
|
|
steps:
|
|
|
|
- name: Check out repo
|
2024-10-17 16:42:44 +02:00
|
|
|
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
|
2024-01-23 19:24:52 +01:00
|
|
|
|
|
|
|
- name: Set up .NET
|
2024-08-26 22:46:30 +02:00
|
|
|
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1
|
2024-01-23 19:24:52 +01:00
|
|
|
|
|
|
|
- name: Print environment
|
|
|
|
run: |
|
|
|
|
dotnet --info
|
|
|
|
nuget help | grep Version
|
|
|
|
echo "GitHub ref: $GITHUB_REF"
|
|
|
|
echo "GitHub event: $GITHUB_EVENT"
|
|
|
|
|
|
|
|
- name: Remove SQL project
|
|
|
|
run: dotnet sln bitwarden-server.sln remove src/Sql/Sql.sqlproj
|
|
|
|
|
|
|
|
- name: Test OSS solution
|
|
|
|
run: dotnet test ./test --configuration Debug --logger "trx;LogFileName=oss-test-results.trx" /p:CoverletOutputFormatter="cobertura" --collect:"XPlat Code Coverage"
|
|
|
|
|
|
|
|
- name: Test Bitwarden solution
|
|
|
|
run: dotnet test ./bitwarden_license/test --configuration Debug --logger "trx;LogFileName=bw-test-results.trx" /p:CoverletOutputFormatter="cobertura" --collect:"XPlat Code Coverage"
|
|
|
|
|
|
|
|
- name: Report test results
|
2024-07-10 21:47:20 +02:00
|
|
|
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5 # v1.9.1
|
2024-08-13 20:03:13 +02:00
|
|
|
if: ${{ needs.check-test-secrets.outputs.available == 'true' && !cancelled() }}
|
2024-01-23 19:24:52 +01:00
|
|
|
with:
|
|
|
|
name: Test Results
|
|
|
|
path: "**/*-test-results.trx"
|
|
|
|
reporter: dotnet-trx
|
|
|
|
fail-on-error: true
|
|
|
|
|
|
|
|
- name: Upload to codecov.io
|
2024-10-17 16:42:44 +02:00
|
|
|
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
|
2024-08-13 18:56:47 +02:00
|
|
|
if: ${{ needs.check-test-secrets.outputs.available == 'true' }}
|
2024-01-23 19:24:52 +01:00
|
|
|
env:
|
|
|
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|