-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Workflow linting and test separation #3684
Changes from all commits
2b5d6ea
eb87471
0958414
402d379
97b81df
6b41c28
6524c55
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,23 +2,23 @@ | |
name: Build | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- "l10n_master" | ||
- "gh-pages" | ||
paths-ignore: | ||
- ".github/workflows/**" | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- "main" | ||
- "rc" | ||
- "hotfix-rc" | ||
pull_request: | ||
|
||
env: | ||
_AZ_REGISTRY: "bitwardenprod.azurecr.io" | ||
|
||
jobs: | ||
cloc: | ||
name: CLOC | ||
name: Count lines of code | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout repo | ||
- name: Check out repo | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | ||
|
||
- name: Install cloc | ||
|
@@ -33,62 +33,19 @@ jobs: | |
name: Lint | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout repo | ||
- name: Check out repo | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | ||
|
||
- name: Set up dotnet | ||
- name: Set up .NET | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⛏️ I'd keep this |
||
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0 | ||
|
||
- name: Verify Format | ||
- name: Verify format | ||
run: dotnet format --verify-no-changes | ||
|
||
testing: | ||
name: Testing | ||
runs-on: ubuntu-22.04 | ||
env: | ||
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | ||
|
||
- name: Set up dotnet | ||
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0 | ||
|
||
- name: Print environment | ||
run: | | ||
dotnet --info | ||
nuget help | grep Version | ||
echo "GitHub ref: $GITHUB_REF" | ||
echo "GitHub event: $GITHUB_EVENT" | ||
|
||
- name: Remove SQL proj | ||
run: dotnet sln bitwarden-server.sln remove src/Sql/Sql.sqlproj | ||
|
||
- name: Test OSS solution | ||
run: dotnet test ./test --configuration Release --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 Release --logger "trx;LogFileName=bw-test-results.trx" /p:CoverletOutputFormatter="cobertura" --collect:"XPlat Code Coverage" | ||
|
||
- name: Report test results | ||
uses: dorny/test-reporter@c9b3d0e2bd2a4e96aaf424dbaa31c46b42318226 # v1.6.0 | ||
if: always() | ||
with: | ||
name: Test Results | ||
path: "**/*-test-results.trx" | ||
reporter: dotnet-trx | ||
fail-on-error: true | ||
|
||
- name: Upload to codecov.io | ||
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
build-artifacts: | ||
name: Build artifacts | ||
runs-on: ubuntu-22.04 | ||
needs: | ||
- testing | ||
- lint | ||
strategy: | ||
fail-fast: false | ||
|
@@ -125,10 +82,10 @@ jobs: | |
base_path: ./bitwarden_license/src | ||
node: true | ||
steps: | ||
- name: Checkout repo | ||
- name: Check out repo | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | ||
|
||
- name: Set up dotnet | ||
- name: Set up .NET | ||
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0 | ||
|
||
- name: Set up Node | ||
|
@@ -228,7 +185,7 @@ jobs: | |
base_path: ./bitwarden_license/src | ||
dotnet: true | ||
steps: | ||
- name: Checkout repo | ||
- name: Check out repo | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | ||
|
||
- name: Check Branch to Publish | ||
|
@@ -245,15 +202,15 @@ jobs: | |
fi | ||
|
||
########## ACRs ########## | ||
- name: Login to Azure - PROD Subscription | ||
withinfocus marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: Log in to Azure - production subscription | ||
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 | ||
with: | ||
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }} | ||
|
||
- name: Login to PROD ACR | ||
run: az acr login -n bitwardenprod | ||
|
||
- name: Login to Azure - CI Subscription | ||
- name: Log in to Azure - CI subscription | ||
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 | ||
with: | ||
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} | ||
|
@@ -275,7 +232,7 @@ jobs: | |
fi | ||
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT | ||
|
||
- name: Setup project name | ||
- name: Set up project name | ||
id: setup | ||
run: | | ||
PROJECT_NAME=$(echo "${{ matrix.project_name }}" | awk '{print tolower($0)}') | ||
|
@@ -303,7 +260,7 @@ jobs: | |
with: | ||
name: ${{ matrix.project_name }}.zip | ||
|
||
- name: Setup build artifact | ||
- name: Set up build artifact | ||
if: ${{ matrix.dotnet }} | ||
run: | | ||
mkdir -p ${{ matrix.base_path}}/${{ matrix.project_name }}/obj/build-output/publish | ||
|
@@ -326,13 +283,13 @@ jobs: | |
runs-on: ubuntu-22.04 | ||
needs: build-docker | ||
steps: | ||
- name: Checkout repo | ||
- name: Check out repo | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | ||
|
||
- name: Set up dotnet | ||
- name: Set up .NET | ||
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0 | ||
|
||
- name: Login to Azure - PROD Subscription | ||
- name: Log in to Azure - production subscription | ||
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 | ||
with: | ||
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }} | ||
|
@@ -445,7 +402,7 @@ jobs: | |
if-no-files-found: error | ||
|
||
build-mssqlmigratorutility: | ||
name: Build MsSqlMigratorUtility | ||
name: Build MSSQL migrator utility | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⛏️ Here's another case where I think it's better to stick with the package name being built/installed. Or, barring that, fully spell out Microsoft SQL Server. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a few places where "MSSQL" is used and this is traditionally the shorthand and image name, at least in a lot of places. |
||
runs-on: ubuntu-22.04 | ||
needs: lint | ||
defaults: | ||
|
@@ -460,10 +417,10 @@ jobs: | |
- linux-x64 | ||
- win-x64 | ||
steps: | ||
- name: Checkout repo | ||
- name: Check out repo | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | ||
|
||
- name: Set up dotnet | ||
- name: Set up .NET | ||
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0 | ||
|
||
- name: Print environment | ||
|
@@ -478,7 +435,7 @@ jobs: | |
dotnet publish -c "Release" -o obj/build-output/publish -r ${{ matrix.target }} -p:PublishSingleFile=true \ | ||
-p:IncludeNativeLibrariesForSelfExtract=true --self-contained true | ||
|
||
- name: Upload project artifact Windows | ||
- name: Upload project artifact for Windows | ||
if: ${{ contains(matrix.target, 'win') == true }} | ||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | ||
with: | ||
|
@@ -499,7 +456,7 @@ jobs: | |
runs-on: ubuntu-22.04 | ||
needs: build-docker | ||
steps: | ||
- name: Login to Azure - CI Subscription | ||
- name: Log in to Azure - CI subscription | ||
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 | ||
with: | ||
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} | ||
|
@@ -532,7 +489,7 @@ jobs: | |
runs-on: ubuntu-22.04 | ||
needs: build-docker | ||
steps: | ||
- name: Login to Azure - CI Subscription | ||
- name: Log in to Azure - CI subscription | ||
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 | ||
with: | ||
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} | ||
|
@@ -567,7 +524,6 @@ jobs: | |
needs: | ||
- cloc | ||
- lint | ||
- testing | ||
- build-artifacts | ||
- build-docker | ||
- upload | ||
|
@@ -611,7 +567,7 @@ jobs: | |
exit 1 | ||
fi | ||
|
||
- name: Login to Azure - CI subscription | ||
- name: Log in to Azure - CI subscription | ||
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 | ||
if: failure() | ||
with: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ The way I read this is that you want to build on any push to main/rc/hotfix-rc, and all pull requests? The main thing I'm concerned about is that with nothing listed under
pull_requests
, that it's not clear PR branches will be built. Assuming I read it correctly, a comment indicating the behavior being relied upon here would be nice.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's correct, that an open-ended trigger applies to all of that type.