Initial commit

This commit is contained in:
Антон Чичков 2024-10-23 22:09:19 +10:00
commit d504950f92
3 changed files with 68 additions and 0 deletions

View File

@ -0,0 +1,29 @@
param(
[Parameter(Mandatory=$true)] [string] $teamCityToken,
[Parameter(Mandatory=$true)] [string] $giteaToken,
[Parameter(Mandatory=$true)] [string] $branch,
[Parameter(Mandatory=$true)] [string] $pullId
)
Write-Output "Starting tests in $branch"
$scriptDir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
& $scriptDir/Run-TeamCityBuild.ps1 -token $teamCityToken -branch $branch -buildId "LU_FullTests"
& $scriptDir/Run-TeamCityBuild.ps1 -token $teamCityToken -branch $branch -buildId "LU_ReleaseBuild"
# Получим теги пулл-реквеста
Invoke-RestMethod -Uri https://sc.lers.ru/api/v1/repos/lers/LersUchet/pulls/$pullId -Headers @{Authorization = "token $giteaToken"}
Write-Output $pull.labels
Write-Output "checking wb"
$webLabel = $pull.labels | Where-Object { $_.name -eq "comp/Web" }
if ($webLabel)
{
Write-Host "Running web tests"
& $scriptDir/Run-TeamCityBuild.ps1 -token $teamCityToken -branch $branch -buildId "LU_Tests_WebTests"
}

16
Run-TeamcityBuild.ps1 Normal file
View File

@ -0,0 +1,16 @@
param(
[Parameter(Mandatory=$true)] [string] $token,
[Parameter(Mandatory=$true)] [string] $branch,
[Parameter(Mandatory=$true)] [string] $buildId
)
$tcUrl = "https://build.lers.ru"
$params=@{
branchName = $branch
buildType = @{
id = $buildId
}
}
Invoke-RestMethod $tcUrl/app/rest/buildQueue -Headers @{Authorization = "Bearer $token"} -Method 'POST' -ContentType 'application/json' -Body ($params|ConvertTo-Json)

23
action.yml Normal file
View File

@ -0,0 +1,23 @@
name: Run Teamcity tests
description: Run teamcity tests
inputs:
teamcity-token:
description: 'Teamcity token'
required: true
gitea-token:
description: 'Gitea token token'
required: true
branch:
description: 'Branch to test'
required: true
pull-id:
description: 'Pull request id'
required: true
runs:
using: "composite"
steps:
- name: Start Teamcity tests
shell: powershell
run: ${{ gitea.action_path }}/Handle-PullRequestComment.ps1 -teamCityToken ${{ inputs.teamcity-token }} -giteaToken ${{ inputs.gitea-token }} -branch ${{ inputs.branch }} -pullId ${{ inputs.pull-id }}