Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 110 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,17 @@
- run: bun run typecheck
- run: bun run check:deps

lint-dotnet:
name: .NET Lint
needs: [changes]
if: needs.changes.outputs.code == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
- run: dotnet format src/dotnet/Sentry.Cli.slnx --verify-no-changes

test-unit:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
name: Unit Tests
needs: [changes]
if: needs.changes.outputs.code == 'true'
Expand Down Expand Up @@ -198,7 +208,68 @@
name: sentry-${{ matrix.target }}
path: dist-bin/sentry-*

build-nuget:
name: Pack NuGet (${{ matrix.name }})
needs: [changes, lint-dotnet, build-binary]
if: needs.changes.outputs.code == 'true'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: linux-x64
os: ubuntu-latest
pack-target: linux-x64
pack-agnostic: true
- name: linux-arm64
os: ubuntu-24.04-arm
pack-target: linux-arm64
pack-agnostic: false
- name: macos-arm64
os: macos-latest
pack-target: darwin-arm64
pack-agnostic: false
- name: macos-x64
os: macos-latest
pack-target: darwin-x64
pack-agnostic: false
- name: windows-x64
os: windows-latest
pack-target: windows-x64
pack-agnostic: false
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- uses: actions/cache@v4
id: cache
with:
path: node_modules
key: node-modules-${{ matrix.os }}-${{ hashFiles('bun.lock', 'patches/**') }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
run: bun install --frozen-lockfile
- uses: actions/setup-dotnet@v4
- name: Download binary
uses: actions/download-artifact@v4
with:
name: sentry-${{ matrix.pack-target }}
path: dist-bin
- name: Make binary executable
if: runner.os != 'Windows'
run: chmod +x dist-bin/sentry-*
- name: Pack NuGet packages
run: bun run script/pack.ts --target ${{ matrix.pack-target }}
- name: Pack agnostic NuGet packages
if: matrix.pack-agnostic
run: bun run script/pack.ts --no-clean --agnostic
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: nuget-${{ matrix.name }}
path: dist-pkg/*.nupkg

test-e2e:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
name: E2E Tests
needs: [build-binary]
runs-on: ubuntu-latest
Expand All @@ -224,7 +295,36 @@
SENTRY_CLI_BINARY: ${{ github.workspace }}/dist-bin/sentry-linux-x64
run: bun run test:e2e

test-dotnet:
name: .NET Tests (${{ matrix.target }})
needs: [changes, lint-dotnet, build-binary]
if: needs.changes.outputs.code == 'true'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: darwin-arm64
os: macos-latest
- target: linux-x64
os: ubuntu-latest
- target: windows-x64
os: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
- name: Download binary
uses: actions/download-artifact@v4
with:
name: sentry-${{ matrix.target }}
path: dist-bin
- name: Make binary executable
if: runner.os != 'Windows'
run: chmod +x dist-bin/sentry-${{ matrix.target }}
- name: .NET Tests
run: dotnet test --project src/dotnet/Sentry.Cli.Tests/Sentry.Cli.Tests.csproj

build-npm:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
name: Build npm Package (Node ${{ matrix.node }})
needs: [lint, test-unit]
runs-on: ubuntu-latest
Expand Down Expand Up @@ -286,14 +386,14 @@
ci-status:
name: CI Status
if: always()
needs: [changes, check-skill, build-binary, build-npm, build-docs, test-e2e]
needs: [changes, check-skill, build-binary, build-npm, build-docs, test-e2e, test-dotnet, build-nuget]
runs-on: ubuntu-latest
permissions: {}
steps:
- name: Check CI status
run: |
# Check for explicit failures or cancellations in all jobs
results="${{ needs.check-skill.result }} ${{ needs.build-binary.result }} ${{ needs.build-npm.result }} ${{ needs.build-docs.result }} ${{ needs.test-e2e.result }}"
results="${{ needs.check-skill.result }} ${{ needs.build-binary.result }} ${{ needs.build-npm.result }} ${{ needs.build-docs.result }} ${{ needs.test-e2e.result }} ${{ needs.test-dotnet.result }} ${{ needs.build-nuget.result }}"
for result in $results; do
if [[ "$result" == "failure" || "$result" == "cancelled" ]]; then
echo "::error::CI failed"
Expand All @@ -307,6 +407,14 @@
echo "::error::CI failed - upstream job failed causing test-e2e to be skipped"
exit 1
fi
if [[ "${{ needs.changes.outputs.code }}" == "true" && "${{ needs.test-dotnet.result }}" == "skipped" ]]; then
echo "::error::CI failed - upstream job failed causing test-dotnet to be skipped"
exit 1
fi
if [[ "${{ needs.changes.outputs.code }}" == "true" && "${{ needs.build-nuget.result }}" == "skipped" ]]; then
echo "::error::CI failed - upstream job failed causing build-nuget to be skipped"
exit 1
fi
if [[ "${{ needs.changes.outputs.skill }}" == "true" && "${{ needs.check-skill.result }}" == "skipped" ]]; then
echo "::error::CI failed - upstream job failed causing check-skill to be skipped"
exit 1
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@ docs/.astro

# Finder (MacOS) folder config
.DS_Store

# .NET & NuGet
dist-pkg
dotnet-tools.json
9 changes: 9 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"sdk": {
"version": "10.0.100",
"rollForward": "latestFeature"
},
"test": {
"runner": "Microsoft.Testing.Platform"
}
}
7 changes: 7 additions & 0 deletions nuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@
"build": "bun run script/build.ts --single",
"build:all": "bun run script/build.ts",
"bundle": "bun run script/bundle.ts",
"pack": "bun run script/pack.ts",
"pack:agnostic": "bun run script/pack.ts --agnostic",
"typecheck": "tsc --noEmit",
"lint": "bunx ultracite check",
"lint:fix": "bunx ultracite fix",
"lint:dotnet": "bun run script/dotnet-lint.ts --check",
"lint:dotnet:fix": "bun run script/dotnet-lint.ts",
"test": "bun test",
"test:unit": "bun test test/lib test/commands test/types --coverage --coverage-reporter=lcov",
"test:isolated": "bun test test/isolated",
"test:e2e": "bun test test/e2e",
"test:dotnet": "dotnet test --project src/dotnet/Sentry.Cli.Tests/Sentry.Cli.Tests.csproj",
"generate:skill": "bun run script/generate-skill.ts",
"check:skill": "bun run script/check-skill.ts",
"check:deps": "bun run script/check-no-deps.ts"
Expand Down
28 changes: 28 additions & 0 deletions script/dotnet-lint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bun

/**
* Lint script for the .NET source code
*
* Runs `dotnet format` against the solution and optionally verifies that no
* changes are needed (useful in CI to enforce formatting without auto-fixing).
*
* Usage:
* bun run script/dotnet-lint.ts # Format in place
* bun run script/dotnet-lint.ts --check # Exit non-zero if any changes would be made
*/

import { $ } from "bun";

const SOLUTION = "src/dotnet/Sentry.Cli.slnx";

const check = process.argv.includes("--check");

try {
if (check) {
await $`dotnet format ${SOLUTION} --verify-no-changes`;
} else {
await $`dotnet format ${SOLUTION}`;
}
} catch {
process.exit(1);
}
Loading
Loading