From 0ff566895412f7ec9f2d08b33c040e1db6b9fdbe Mon Sep 17 00:00:00 2001 From: eli-iser Date: Wed, 15 May 2024 14:43:57 -0400 Subject: [PATCH] Attempting to fix CI for ARM Mac and older dotnet format tool compatbility (#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 e873e5513d41712a2689b1c462f5ecc69c3ee988. * Revert "Bumping version of Newtonsoft.Json and jQuery.Validation" This reverts commit 8d6669d71077dbabef73f7daacd689837469a78e. --------- Co-authored-by: Eli Iser --- .github/workflows/ci.yml | 28 ++++++++++++++----- CONTRIBUTING.md | 12 +------- .../Examples/SimpleTest/Program.cs | 2 +- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a4c0a1a81..c82e4b8b6d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 }} @@ -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/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 801fe26589..350f3f7fd9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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`. diff --git a/dropbox-sdk-dotnet/Examples/SimpleTest/Program.cs b/dropbox-sdk-dotnet/Examples/SimpleTest/Program.cs index ff3c49034b..c2d500c6e2 100644 --- a/dropbox-sdk-dotnet/Examples/SimpleTest/Program.cs +++ b/dropbox-sdk-dotnet/Examples/SimpleTest/Program.cs @@ -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