-
Notifications
You must be signed in to change notification settings - Fork 367
100 lines (86 loc) · 3.07 KB
/
platform.ci-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: ".Platform - Run CI tests"
on:
workflow_dispatch:
inputs:
testFileRegex:
type: string
description: "The regex of the test file(s) to run"
required: false
default: '.*'
push:
branches:
- main
paths:
- ".github/workflows/platform.ci-tests.yml"
- "avm/utilities/**"
- "!*/**/README.md"
schedule:
- cron: "0 0 * * Sun" # Every Sunday
env:
workflowPath: ".github/workflows/platform.ci-tests.yml"
jobs:
###########################
# Initialize pipeline #
###########################
job_initialize_pipeline:
runs-on: ubuntu-latest
name: "Initialize pipeline"
steps:
- name: "Checkout"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Set input parameters to output variables"
id: get-workflow-param
uses: ./.github/actions/templates/avm-getWorkflowInput
with:
workflowPath: "${{ env.workflowPath}}"
outputs:
workflowInput: ${{ steps.get-workflow-param.outputs.workflowInput }}
###############
# Removal #
###############
job_run_tests:
runs-on: ubuntu-latest
name: "Run CI tests"
needs:
- job_initialize_pipeline
steps:
- name: "Checkout"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set environment
uses: ./.github/actions/templates/avm-setEnvironment
- name: Run CI tests
id: pester_run_step
uses: azure/powershell@v2
with:
inlineScript: |
# Load used functions
. (Join-Path $env:GITHUB_WORKSPACE 'avm' 'utilities' 'tests' 'Test-CI.ps1')
$functionInput = @{
RepoRootPath = $env:GITHUB_WORKSPACE
BranchName = $env:GITHUB_REF
GitHubRepository = $env:GITHUB_REPOSITORY
TestFileRegex = '${{ (fromJson(needs.job_initialize_pipeline.outputs.workflowInput)).testFileRegex }}'
}
Write-Verbose "Invoke task with" -Verbose
Write-Verbose ($functionInput | ConvertTo-Json | Out-String) -Verbose
$outputsFilePath = Test-CI @functionInput
Write-Output ('{0}={1}' -f 'formattedPesterResultsPath', $outputsFilePath) >> $env:GITHUB_OUTPUT
azPSVersion: "latest"
- name: "Output to GitHub job summaries"
if: always()
shell: pwsh
run: |
# Grouping task logs
Write-Output '::group::Output to GitHub job summaries'
$mdPesterOutputFilePath = '${{ steps.pester_run_step.outputs.formattedPesterResultsPath }}'
if (-not (Test-Path $mdPesterOutputFilePath)) {
Write-Warning ('Input file [{0}] not found. Please check if the previous task threw an error and try again.' -f $mdPesterOutputFilePath)
} else {
Get-Content $mdPesterOutputFilePath >> $env:GITHUB_STEP_SUMMARY
Write-Verbose ('Successfully printed out file [{0}] to Job Summaries' -f $mdPesterOutputFilePath) -Verbose
}
Write-Output '::endgroup::'