Skip to content

fix(flags): align presence operator semantics (#305) #950

fix(flags): align presence operator semantics (#305)

fix(flags): align presence operator semantics (#305) #950

Workflow file for this run

name: Build PostHog .NET SDK
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
PackageDirectory: ${{ github.workspace }}/build/packages/Release
DOTNET_VERSION: 9.0.102
permissions:
checks: write
contents: read
jobs:
detect-markdown-only:
uses: PostHog/.github/.github/workflows/detect-markdown-only.yml@ec25337d9fae0100622cbfea1bd5bd88284ac10b
permissions:
pull-requests: read
build:
needs: detect-markdown-only
name: Build and package
runs-on: ubuntu-latest
steps:
- name: Complete markdown-only PR check
if: needs.detect-markdown-only.outputs.markdown_only == 'true'
run: echo "Only Markdown files changed; no additional work is required for this check."
- name: Checkout main branch
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup .NET Core
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore NuGet Packages
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
run: dotnet restore --locked-mode
shell: bash
# This builds the solution, creates NuGet packages, and runs PublicApiAnalyzers.
# If a public API change is intentional, run `dotnet build --configuration Release`
# locally and commit the relevant PublicAPI.Shipped.txt/PublicAPI.Unshipped.txt updates.
- name: Build
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
run: dotnet build --configuration Release --no-restore --nologo
shell: bash
package:
needs: detect-markdown-only
name: Package (${{ matrix.name }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: PostHog
project: src/PostHog/PostHog.csproj
- name: PostHog.AI
project: src/PostHog.AI/PostHog.AI.csproj
- name: PostHog.AspNetCore
project: src/PostHog.AspNetCore/PostHog.AspNetCore.csproj
steps:
- name: Complete markdown-only PR check
if: needs.detect-markdown-only.outputs.markdown_only == 'true'
run: echo "Only Markdown files changed; no additional work is required for this check."
- name: Checkout main branch
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup .NET Core
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore NuGet Packages
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
run: dotnet restore --locked-mode
shell: bash
- name: Pack ${{ matrix.name }}
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
run: dotnet pack "${{ matrix.project }}" --configuration Release --no-restore --nologo --output "${{ env.PackageDirectory }}" /p:GeneratePackageOnBuild=false
shell: bash
test:
needs: detect-markdown-only
name: Test
runs-on: ubuntu-latest
# Run tests independently so build, test, and format feedback can complete in parallel.
steps:
- name: Complete markdown-only PR check
if: needs.detect-markdown-only.outputs.markdown_only == 'true'
run: echo "Only Markdown files changed; no additional work is required for this check."
- name: Checkout main branch
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup .NET Core
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore NuGet Packages
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
run: dotnet restore --locked-mode
shell: bash
- name: Run Tests
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
run: dotnet test --logger "trx;LogFileName=test-results.trx" --configuration Release --no-restore --nologo
shell: bash
- name: Collect Test Results
if: ${{ needs.detect-markdown-only.outputs.markdown_only != 'true' && (github.actor != 'dependabot[bot]' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)) }}
uses: dorny/test-reporter@a53e41438c2381e621dc719a47a57180e30c7075 # v1
with:
name: "xUnit Tests"
path: "tests/*/TestResults/test-results.trx"
reporter: 'dotnet-trx'
- name: Upload Test Snapshots
if: ${{ needs.detect-markdown-only.outputs.markdown_only != 'true' && (failure()) }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: verify-test-results
retention-days: 7
path: |
**/*.received.*
format:
needs: detect-markdown-only
name: Format
runs-on: ubuntu-latest
steps:
- name: Complete markdown-only PR check
if: needs.detect-markdown-only.outputs.markdown_only == 'true'
run: echo "Only Markdown files changed; no additional work is required for this check."
- name: Checkout main branch
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup .NET
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore NuGet Packages
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
run: dotnet restore --locked-mode
shell: bash
- name: Set up dotnet-format problem matcher
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/problemMatchers/dotnet-format.json"
shell: bash
- name: Format!
if: needs.detect-markdown-only.outputs.markdown_only != 'true'
run: bin/fmt --check
shell: bash