Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring Module #2

Merged
merged 41 commits into from
Jul 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
8d95a61
initial commit
santisq Aug 7, 2023
9af2e65
a bit of progress
santisq Jul 10, 2024
fd9c0f2
some progress with pingasync
santisq Jul 13, 2024
42c8610
some progress with pingasync
santisq Jul 15, 2024
08db1fd
done with pingasync
santisq Jul 15, 2024
2a0afdf
adding base classes to use in tcp command
santisq Jul 16, 2024
339639c
adding a few pester tests. updating readme
santisq Jul 16, 2024
85e6765
adding a more pester tests.
santisq Jul 16, 2024
cc51187
adding more parameters and refactoring logic to ping async command.
santisq Jul 16, 2024
788a094
almost done with testtcpasync
santisq Jul 18, 2024
2a3a9a3
updating parameter name
santisq Jul 18, 2024
dbf6360
updating parameter name
santisq Jul 18, 2024
c66c84d
tidying up
santisq Jul 18, 2024
991314b
setcap cap_net_raw=eip for linux worker
santisq Jul 18, 2024
044e0b1
damnit linux
santisq Jul 18, 2024
b36e310
damnit linux
santisq Jul 18, 2024
31970d6
damnit linux
santisq Jul 18, 2024
858f265
damnit linux
santisq Jul 18, 2024
5342b19
ok we're good now :)
santisq Jul 18, 2024
7fa7dee
ok we're good now :)
santisq Jul 19, 2024
0987a61
ok we're good now :)
santisq Jul 19, 2024
5105fb8
ok we're good now :)
santisq Jul 19, 2024
544deec
ok we're good now :)
santisq Jul 19, 2024
019ecc7
ok we're good now :)
santisq Jul 19, 2024
212040e
adding tcp tests
santisq Jul 19, 2024
1d241e9
changing timeout for linux worker
santisq Jul 19, 2024
0ab8fc4
changing timeout for test
santisq Jul 19, 2024
73bc8e6
adding default timeout delay task to tcp command
santisq Jul 20, 2024
d1d6b8b
incrementing timeout for tests
santisq Jul 20, 2024
42ef14f
changing logic for connectiontimeout
santisq Jul 20, 2024
cb73d69
few changes with enum tcp status
santisq Jul 20, 2024
453bf18
few changes with enum tcp status
santisq Jul 20, 2024
82fd063
few more tests
santisq Jul 21, 2024
1bb56a3
few more tests
santisq Jul 21, 2024
d9e74de
few more tests
santisq Jul 21, 2024
4c110df
few more tests
santisq Jul 21, 2024
f704f3b
few changes. adding formatting for tcp async
santisq Jul 21, 2024
258183f
few changes. adding formatting for tcp async
santisq Jul 21, 2024
f41e22b
typo in test
santisq Jul 21, 2024
e5549c6
almost done
santisq Jul 21, 2024
fcbe2ce
few more changes
santisq Jul 21, 2024
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
149 changes: 149 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
name: PSNetScanners Workflow
on:
push:
branches:
- main

pull_request:
branches:
- main

release:
types:
- published

env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
POWERSHELL_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
BUILD_CONFIGURATION: ${{ fromJSON('["Debug", "Release"]')[startsWith(github.ref, 'refs/tags/v')] }}

jobs:
build:
name: build
runs-on: windows-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Build module - Debug
shell: pwsh
run: ./build.ps1 -Configuration $env:BUILD_CONFIGURATION -Task Build
if: ${{ env.BUILD_CONFIGURATION == 'Debug' }}

- name: Build module - Publish
shell: pwsh
run: ./build.ps1 -Configuration $env:BUILD_CONFIGURATION -Task Build
if: ${{ env.BUILD_CONFIGURATION == 'Release' }}

- name: Capture PowerShell Module
uses: actions/upload-artifact@v4
with:
name: PSModule
path: output/*.nupkg

test:
name: test
needs:
- build
runs-on: ${{ matrix.info.os }}
strategy:
fail-fast: false
matrix:
info:
- name: PS-5.1
psversion: '5.1'
os: windows-latest
- name: PS-7_Windows
psversion: '7'
os: windows-latest
- name: PS-7_Linux
psversion: '7'
os: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Restore Built PowerShell Module
uses: actions/download-artifact@v4
with:
name: PSModule
path: output

- name: Install Built PowerShell Module
shell: pwsh
run: |
$manifestItem = Get-Item ([IO.Path]::Combine('module', '*.psd1'))
$moduleName = $manifestItem.BaseName
$manifest = Test-ModuleManifest -Path $manifestItem.FullName -ErrorAction SilentlyContinue -WarningAction Ignore

$destPath = [IO.Path]::Combine('output', $moduleName, $manifest.Version)
if (-not (Test-Path -LiteralPath $destPath)) {
New-Item -Path $destPath -ItemType Directory | Out-Null
}

Get-ChildItem output/*.nupkg | Rename-Item -NewName { $_.Name -replace '.nupkg', '.zip' }
Expand-Archive -Path output/*.zip -DestinationPath $destPath -Force -ErrorAction Stop

- name: Run Tests - PowerShell 5.1
if: ${{ matrix.info.psversion == '5.1' }}
shell: powershell
run: ./build.ps1 -Configuration $env:BUILD_CONFIGURATION -Task Test

- name: setcap
if: ${{ matrix.info.name == 'PS-7_Linux' }}
shell: pwsh
run: sudo setcap cap_net_raw=eip /opt/microsoft/powershell/7/pwsh

- name: Run Tests - PowerShell 7
if: ${{ matrix.info.psversion != '5.1' }}
shell: pwsh
run: ./build.ps1 -Configuration $env:BUILD_CONFIGURATION -Task Test

- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Unit Test Results (${{ matrix.info.name }})
path: ./output/TestResults/Pester.xml

- name: Upload Coverage Results
if: always() && !startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v4
with:
name: Coverage Results (${{ matrix.info.name }})
path: ./output/TestResults/Coverage.xml

- name: Upload Coverage to codecov
if: always() && !startsWith(github.ref, 'refs/tags/v')
uses: codecov/codecov-action@v4
with:
files: ./output/TestResults/Coverage.xml
flags: ${{ matrix.info.name }}
token: ${{ secrets.CODECOV_TOKEN }}

publish:
name: publish
if: startsWith(github.ref, 'refs/tags/v')
needs:
- build
- test
runs-on: windows-latest
steps:
- name: Restore Built PowerShell Module
uses: actions/download-artifact@v4
with:
name: PSModule
path: ./

- name: Publish to Gallery
if: github.event_name == 'release'
shell: pwsh
run: >-
dotnet nuget push '*.nupkg'
--api-key $env:PSGALLERY_TOKEN
--source 'https://www.powershellgallery.com/api/v2/package'
--no-symbols
env:
PSGALLERY_TOKEN: ${{ secrets.PSGALLERY_TOKEN }}
Loading