Skip to content

Commit

Permalink
ci: вынес тестирование в отдельный action
Browse files Browse the repository at this point in the history
  • Loading branch information
alkoleft committed Aug 27, 2024
1 parent 1c9fc48 commit edb4298
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 126 deletions.
73 changes: 73 additions & 0 deletions .github/actions/run-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Загрузка расширения
description: Загрузка расширения в информационную базу с использованием ibcmd
inputs:
locale:
required: true
short_locale:
required: true
job_name:
required: true
check_name:
required: true
runs:
using: "composite"
steps:
- name: Создание информационной базы
run: |
mkdir file-db\file-db
ibcmd.exe infobase create --data=file-db --load=binary\configuration.cf --apply --force
timeout-minutes: 5

- name: Загрузка расширения YAxUnit
uses: ./.github/actions/load-extension
with:
name: YAXUNIT
path: binary\yaxunit.cfe

- name: Загрузка расширения c тестами
uses: ./.github/actions/load-extension
with:
name: tests
path: binary\tests.cfe

- name: Создание файла конфигурации тестирования
uses: DamianReeves/write-file-action@master
with:
path: yaxunit-config.json
contents: |
{
"reportFormat": "jUnit",
"reportPath": "report.xml",
"closeAfterTests": true,
"exitCode": "exit-code.txt",
"logging": {
"console": true
}
}
- name: Запуск сервера (ibsrv)
run: ibsrv --db-path=file-db --daemon

- name: Запуск тестирования
run: 1cv8c /WS "http://localhost:8314" /C"RunUnitTests=yaxunit-config.json" /L ${{ inputs.short_locale }} /VL ${{ inputs.locale }} /DisableStartupDialogs /DisableStartupMessages /DisableUnrecoverableErrorMessage /Out output.log
timeout-minutes: 5
env:
DISPLAY: :99
LANG: "${{ inputs.locale }}.UTF-8"

- name: Сохранение файла отчета
uses: actions/upload-artifact@v4
if: always()
with:
name: Tests report. Linux ${{ inputs.v8_version }} ${{ inputs.locale }}
path: report.xml

- name: Публикация отчета о тестировании
uses: 1CDevFlow/action-onec-junit-report@main
if: always()
with:
job_name: ${{ inputs.job_name }}
check_name: ${{ inputs.check_name }}
report_paths: report.xml
fail_on_failure: true
require_passed_tests: true
2 changes: 1 addition & 1 deletion .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
secrets: inherit

build_artifacts:
name: Сборка артифактов
name: Сборка артефактов
runs-on: ubuntu-latest
needs: export_to_designer

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
secrets: inherit

build_artifacts:
name: Сборка артифактов
name: Сборка артефактов
uses: ./.github/workflows/step-build-artifacts-windows.yml
needs: export_to_designer
with:
Expand Down
68 changes: 5 additions & 63 deletions .github/workflows/step-run-tests-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,68 +104,10 @@ jobs:
run: sudo X :99 -config dummy-1920x1080.conf &
timeout-minutes: 5

- name: Создание информационной базы
run: ibcmd infobase create --db-path=file-db --load=binary/configuration.cf --apply --force
timeout-minutes: 5

- name: Загрузка расширения YAxUnit
uses: ./.github/actions/load-extension
with:
name: YAXUNIT
path: binary/yaxunit.cfe

- name: Загрузка расширения c тестами
uses: ./.github/actions/load-extension
with:
name: tests
path: binary/tests.cfe

- name: Запуск сервера (ibsrv)
run: ibsrv --db-path=file-db --daemon

- name: Создание файла конфигурации тестирования
uses: DamianReeves/write-file-action@master
with:
path: unit.json
contents: |
{
"reportFormat": "jUnit",
"reportPath": "reports/report.xml",
"closeAfterTests": true,
"exitCode": "exit-code.txt",
"logging": {
"console": true
}
}
- name: Запуск тестирования
run: 1cv8c /WS "http://localhost:8314" /C"RunUnitTests=${{github.workspace}}/unit.json" /DisableStartupDialogs /DisableStartupMessages /DisableUnrecoverableErrorMessage /Out ${{github.workspace}}/output.log
timeout-minutes: 5
env:
DISPLAY: :99
LANG: "${{ inputs.locale }}.UTF-8"

# - name: view log
# if: always()
# run: cat ./execute.log

# - name: view output
# if: always()
# run: cat ./output.log

- name: Сохранение файла отчета
uses: actions/upload-artifact@v4
if: always()
with:
name: Tests report. Linux ${{ inputs.v8_version }} ${{ inputs.locale }}
path: reports/*.*

- name: Публикация отчета о тестировании
uses: 1CDevFlow/action-onec-junit-report@main
if: always()
- name: Тестирование
uses: alkoleft/yaxunit/.github/actions/run-tests@develop
with:
locale: ${{ inputs.locale }}
short_locale: ${{ inputs.locale }}
job_name: Tests Linux ${{ inputs.v8_version }} ${{ inputs.locale }}
check_name: Tests report. Linux ${{ inputs.v8_version }} ${{ inputs.locale }}
report_paths: reports/report.xml
fail_on_failure: ${{ inputs.fail_on_failure }}
require_passed_tests: true
check_name: Tests report. Linux ${{ inputs.v8_version }} ${{ inputs.locale }}
67 changes: 6 additions & 61 deletions .github/workflows/step-run-tests-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ jobs:
execute-tests:
name: Тестирование
runs-on: windows-latest
defaults:
run:
shell: pwsh

steps:

Expand All @@ -53,69 +50,17 @@ jobs:
ONEC_PASSWORD: ${{ secrets.ONEC_PASSWORD }}
timeout-minutes: 10

- name: Создание информационной базы
run: |
mkdir file-db\data
ibcmd.exe infobase create --data=file-db --load=binary\configuration.cf --apply --force
timeout-minutes: 5

- name: Загрузка расширения YAxUnit
uses: ./.github/actions/load-extension
with:
name: YAXUNIT
path: binary\yaxunit.cfe

- name: Загрузка расширения c тестами
uses: ./.github/actions/load-extension
with:
name: tests
path: binary\tests.cfe

- name: Создание файла конфигурации тестирования
uses: DamianReeves/write-file-action@master
with:
path: unit.json
contents: |
{
"reportFormat": "jUnit",
"reportPath": "reports\\report.xml",
"closeAfterTests": true,
"exitCode": "exit-code.txt",
"logging": {
"console": true
}
}
- name: Определение "короткой" локали
id: short_locale
run: |
Write-Output "substring=$('${{ inputs.locale }}'.Substring(0, 2))" >> $Env:GITHUB_OUTPUT
- name: Запуск тестирования
run: |
Start-Process ibsrv.exe -ArgumentList "--data=file-db"
Start-Process -NoNewWindow -PassThru -Wait 1cv8c.exe -ArgumentList '/WS "http://localhost:8314" /C"RunUnitTests=unit.json" /L ${{ steps.short_locale.outputs.substring }} /VL ${{ inputs.locale }} /DisableStartupDialogs /DisableStartupMessages /DisableUnrecoverableErrorMessage /Out 1cv8c-output.log'
timeout-minutes: 10

# - name: view log
# if: always()
# run: type execute.log
set var=${{ inputs.locale }}
echo "substring=%var:~0,2%" >> $Env:GITHUB_OUTPUT
# - name: view output
# if: always()
# run: type 1cv8c-output.log
- name: Сохранение файла отчета
uses: actions/upload-artifact@v4
with:
name: Tests report. Windows ${{ inputs.v8_version }} ${{ inputs.locale }}
path: reports/

- name: Публикация отчета о тестировании
uses: 1CDevFlow/action-onec-junit-report@main
- name: Тестирование
uses: alkoleft/yaxunit/.github/actions/run-tests@develop
with:
locale: ${{ inputs.locale }}
short_locale: ${{ steps.short_locale.outputs.substring }}
job_name: Tests Windows ${{ inputs.v8_version }} ${{ inputs.locale }}
check_name: Tests report. Windows ${{ inputs.v8_version }} ${{ inputs.locale }}
report_paths: reports/report.xml
fail_on_failure: ${{ inputs.fail_on_failure }}
require_passed_tests: true

0 comments on commit edb4298

Please sign in to comment.