f-bader / SentinelARConverter

Sentinel Analytics Rule converter PowerShell module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Test: Do crossplatform checks

Manbearpiet opened this issue · comments

Summary of the new feature / enhancement

As a user
It would be great if we could have tests done on each platform
So that the module becomes more reliable cross-platform

Proposed technical implementation details (optional)

We could use a matrix strategy to test on all supported OS's.
Which would run on each pull request

jobs:
  example_matrix:
    strategy:
      matrix:
        version: [10, 12, 14]
        os: [ubuntu-latest, windows-latest]

Something borrowing logic from:
https://github.com/devblackops/Stucco/blob/main/Stucco/template/cicd/github-actions.yml

name: CI
on: [pull_request]
jobs:
  test:
    name: Run Tests
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest, macOS-latest]
    steps:
    - uses: actions/checkout@v1
    - name: Test
      shell: pwsh
      run: ./build.ps1 -Task Test -Bootstrap

We should not forget to test for both pwsh and PowerShell to prevent #18 it's scenario.

We use something like this:

name: Tests
on: [pull_request]
jobs:
  test:
    name: Run Tests
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest, macOS-latest]
    steps:
      - uses: actions/checkout@v3
      - name: Test
        shell: pwsh
        run: |
          $config = New-PesterConfiguration -Hashtable @{TestResult = @{Enabled = $true }; Run = @{Exit = $false }; Output = @{ Verbosity = 'Detailed' }}
          Invoke-Pester -Configuration $config

This just doesn't account for Windows PowerShell, which runs with shell: powershell

Fixed in #21

Windows PowerShell adds quite some test time and makes the code a bit more complex.

image