Skip to content

fix: marking transaction as failed (#66) #124

fix: marking transaction as failed (#66)

fix: marking transaction as failed (#66) #124

Workflow file for this run

name: Build and Test
on:
push:
branches:
- 'main'
- 'release/**'
pull_request:
paths-ignore:
- '**.md'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup dependencies
uses: ./.github/actions/setup-dependencies
- name: Create module archive
run: Compress-Archive -Path modules/Sentry/* -DestinationPath modules/Sentry.zip
shell: pwsh
- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: ${{ github.sha }}
path: modules/*.zip
test:
name: ${{ matrix.os }} - ${{ matrix.shell }} ${{ matrix.version }}
runs-on: ${{ matrix.os == 'ubuntu' && 'ubuntu-latest' || matrix.os == 'macos' && 'macos-latest' || matrix.os == 'windows' && 'windows-latest' || matrix.os }}
needs: build
strategy:
fail-fast: false
matrix:
os: [ubuntu]
shell: [pwsh]
version:
- '7.4.0'
- '7.3.0'
- '7.2.0'
# And test all built-in PowerShell/Windows Powershell versions on latest CI runner images
include:
- os: ubuntu
shell: pwsh
- os: macos
shell: pwsh
- os: windows
shell: pwsh
- os: windows-2019
shell: powershell
- os: windows-2022 # same as windows-latest as of 02/2024
shell: powershell
defaults:
run:
shell: ${{ matrix.shell }}
steps:
- uses: actions/checkout@v4
- name: Download release artifact
uses: actions/download-artifact@v4
with:
name: ${{ github.sha }}
- name: Extract module archives
run: |
Remove-Item -Recurse -Force modules/Sentry
Expand-Archive -Path Sentry.zip -DestinationPath modules/Sentry
- name: Setup PowerShell ${{ matrix.version }}
if: ${{ matrix.version != '' }}
uses: ./.github/actions/setup-powershell
with:
version: ${{ matrix.version }}
- run: $PSVersionTable
# We don't test module loading with Pester because we're unable to unload the module between tests.
# Testing as a separate step allows unloads it automatically at the step end.
- name: Module loading
run: |
. ./scripts/settings.ps1
# Loading the first time
Get-Item ./modules/Sentry/Sentry.psd1 | Import-Module -PassThru
# This needs to return actual types (method overloads)
[Sentry.SentrySdk]::init
# Loading the second time must be possible, without errors
Get-Item ./modules/Sentry/Sentry.psd1 | Import-Module
# And accessing APIs must still work too
[Sentry.SentrySdk]::init
- name: Unit tests
run: |
. ./scripts/settings.ps1
Get-Item ./modules/Sentry/Sentry.psd1 | Import-Module
$config = New-PesterConfiguration
$config.Run.Path = "tests"
$config.TestResult.Enabled = $true
Invoke-Pester -Configuration $config