Skip to content

Commit

Permalink
New test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
codaamok committed Feb 24, 2022
1 parent 0f4a4af commit 384c329
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 91 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/pester.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: "Run Pester tests"

on:
push:
branches:
- donotexist
repository_dispatch:
types:
- webhook

jobs:
job-main:
name: Build and Test
runs-on: ubuntu-latest
services:
shlink:
image: shlinkio/shlink:stable
ports:
- 80:8080
env:
IS_HTTPS_ENABLED: false
DEFAULT_DOMAIN: psshlink.codaamok
options: --name shlink
steps:
- name: Modify DNS
run: echo "127.0.0.1 psshlink.codaamok" | sudo tee -a /etc/hosts

- name: Checkout repository
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'

- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true

- name: Install codaamok.build and dependent modules, and set environment variables
run: |
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted
Install-Module "InvokeBuild" -Force
$Username, $ProjectName = $env:GITHUB_REPOSITORY -split "/"
Invoke-Build -File "invoke.build.ps1" -ModuleName $ProjectName -Author $Username -Task "InstallDependencies","ImportBuildModule","SetGitHubActionEnvironmentVariables"
shell: pwsh

- name: Build
run: |
$Params = @{
ModuleName = $env:GH_PROJECTNAME
Author = $env:GH_USERNAME
Version = $env:GitVersion_MajorMinorPatch
NewRelease = $true
}
Invoke-Build -File "custom.build.ps1" @Params -Task PreBuild
Invoke-Build -File "invoke.build.ps1" @Params
Invoke-Build -File "custom.build.ps1" @Params -Task PostBuild
shell: pwsh

- name: Generate Shlink API key
run: |
New-BuildEnvironmentVariable -Platform "GitHubActions" -Variable @{
"ShlinkAPIKey" = [Regex]::Match((docker exec -t shlink shlink api-key:generate --no-ansi), '([0-9A-Fa-f]{8}(?:-[0-9A-Fa-f]{4}){3}-[0-9A-Fa-f]{12})') |
Select-Object -ExpandProperty Value |
ConvertTo-SecureString -AsPlainText -Force |
ConvertFrom-SecureString
"ShlinkServer" = "http://psshlink.codaamok"
}
shell: pwsh

- name: Pester Acceptance Tests Report
uses: zyborg/[email protected]
with:
include_paths: './tests/Public/New-*.Acceptance.Tests.ps1, ./tests/Public/Get-*.Acceptance.Tests.ps1, ./tests/Public/Save-*.Acceptance.Tests.ps1, ./tests/Public/Set-ShlinkUrl.Acceptance.Tests.ps1, ./tests/Public/Set-ShlinkTag.Acceptance.Tests.ps1, ./tests/Public/Remove-*.Acceptance.Tests.ps1'
report_name: Pester Acceptance Tests Report
report_title: Pester Acceptance Tests Report
output_level: detailed
tests_fail_step: true
github_token: ${{ secrets.GITHUB_TOKEN }}
91 changes: 0 additions & 91 deletions .github/workflows/push.yml.old

This file was deleted.

20 changes: 20 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Test workflow dispatch"

on:
push:
branches:
- main
- master
workflow_dispatch:

jobs:
job-main:
name: Test workflow dispatch
runs-on: ubuntu-latest
steps:
- name: Repository Dispatch
uses: peter-evans/[email protected]
with:
token: ${{ secrets.GH_PAT }}
repository: codaamok/PSShlink
event-type: webhook

0 comments on commit 384c329

Please sign in to comment.