Skip to content

Commit

Permalink
Attempting to fix CI for ARM Mac and older dotnet format tool compatb…
Browse files Browse the repository at this point in the history
…ility (#360)

* Attempting to fix CI for ARM Mac and older dotnet format tool compatbility

* Adding CI step to install .NET 5

* Fixed copy-pasta typo

* Testing basic dotnet format functionallity in CI

* Testing basic dotnet format functionallity in CI

* Testing linter commands on Windows only

* Adding some logs to diagnose lint issues

* Attempting to force dotnet tool to use .NET 5

* Moving the .NET config one folder up

* Moving dotnet format installation to local

* Removing local manifests; uninstallating dotnet-format before installing our version

* Diagnostic list

* Moving dotnet-format install to after project resotre

* More verbose logs

* More diagnostics

* Using dotnet-format instead of dotnet format

* Cleanup debug stuff for linter

* Adding missing whitespace for linter

* Updating Codecov upload action

* Temporarly disable code coverage upload

* Bumping version of Newtonsoft.Json and jQuery.Validation

* Updating another jQuery.Validation version

* Restoring Codecov step

* Using Codecov token from secrets

* Revert "Updating another jQuery.Validation version"

This reverts commit e873e55.

* Revert "Bumping version of Newtonsoft.Json and jQuery.Validation"

This reverts commit 8d6669d.

---------

Co-authored-by: Eli Iser <eiser@dropbox.com>
  • Loading branch information
eli-iser and EliIser authored May 15, 2024
1 parent 7be578c commit 0ff5668
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
28 changes: 21 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,38 @@ jobs:
UnitTests:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
os: [macos-13, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Add .Net 5 Framework
uses: actions/setup-dotnet@v4
with:
dotnet-version: '5.x'
- name: Run Unit Tests
# We don't have a good cross-platform way of splitting long lines
run: |
dotnet test dropbox-sdk-dotnet/Dropbox.Api.Unit.Tests --collect:"XPlat Code Coverage" -- 'DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.ExcludeByFile=**/Generated/**/*.cs'
- name: Publish Coverage
uses: codecov/codecov-action@v1.3.2
uses: codecov/codecov-action@v4
if: matrix.os == 'ubuntu-latest'
with:
flags: unit
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
directory: dropbox-sdk-dotnet/Dropbox.Api.Unit.Tests/TestResults/
IntegrationTests:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
os: [macos-13, ubuntu-latest, windows-latest]
max-parallel: 1
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Add .Net 5 Framework
uses: actions/setup-dotnet@v4
with:
dotnet-version: '5.x'
- name: Test Legacy User
env:
DROPBOX_INTEGRATION_appKey: ${{ secrets.LEGACY_APP_KEY }}
Expand All @@ -53,22 +62,27 @@ jobs:
run: |
dotnet test dropbox-sdk-dotnet/Dropbox.Api.Integration.Tests --collect:"XPlat Code Coverage" -- 'DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.ExcludeByFile=**/Generated/**/*.cs'
- name: Publish Coverage
uses: codecov/codecov-action@v1.3.2
uses: codecov/codecov-action@v4
if: matrix.os == 'ubuntu-latest'
with:
flags: integration
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
directory: dropbox-sdk-dotnet/Dropbox.Api.Integration.Tests/TestResults/
Linter:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
os: [macos-13, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Add .Net 5 Framework
uses: actions/setup-dotnet@v4
with:
dotnet-version: '5.x'
- name: Run Linter
run: |
# Install latest dotnet-format
dotnet tool install -g dotnet-format --version 6.0.241801 --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json
dotnet tool install -g dotnet-format --version "5.*" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json
dotnet restore dropbox-sdk-dotnet/
dotnet format --check --fix-whitespace --fix-style warn --fix-analyzers warn dropbox-sdk-dotnet/
dotnet-format --check --fix-whitespace --fix-style warn --fix-analyzers warn dropbox-sdk-dotnet/
12 changes: 1 addition & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,11 @@ You can use [dotnet-format](https://github.com/dotnet/format) to lint from the c

```sh
# Install a recent dotnet-format build
dotnet tool install -g dotnet-format --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json
dotnet tool install -g dotnet-format --version "5.*" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json
# Optionally omit `--check` to auto-fix lint issues
dotnet format --check --fix-whitespace --fix-style info --fix-analyzers info dropbox-sdk-dotnet/
```

### Updating Generated Code

Install PowerShell and execute `./scripts/generate_stone.ps1` to regenerate Stone types.

```sh
git submodule init
git submodule update --remote --recursive
./scripts/generate_stone.ps1
```

### Cutting New Versions (for Dropboxers)

To cut a new version, create a new GitHub release using `vX.Y.Z` as the tag name. GitHub Actions will automatically build the SDK and publish it to NuGet as version `X.Y.Z`.
Expand Down
2 changes: 1 addition & 1 deletion dropbox-sdk-dotnet/Examples/SimpleTest/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ private async Task ChunkUpload(DropboxClient client, string folder, string fileN

if (idx == numChunks - 1)
{
await client.Files.UploadSessionFinishAsync(cursor:cursor, commit:new CommitInfo(folder + "/" + fileName), body:memStream);
await client.Files.UploadSessionFinishAsync(cursor: cursor, commit: new CommitInfo(folder + "/" + fileName), body: memStream);
}

else
Expand Down

0 comments on commit 0ff5668

Please sign in to comment.