From d2a4f7dd22b7facac36f524de6b3f47a2e3185bc Mon Sep 17 00:00:00 2001 From: "Sergey S. Betke" Date: Mon, 25 Oct 2021 11:49:31 +0300 Subject: [PATCH 1/3] =?UTF-8?q?test(github-actions):=20:white=5Fcheck=5Fma?= =?UTF-8?q?rk:=20=D1=80=D0=B0=D1=81=D1=88=D0=B8=D1=80=D0=B8=D1=82=D1=8C=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D1=83=20PowerShell?= =?UTF-8?q?=20=D1=81=D1=86=D0=B5=D0=BD=D0=B0=D1=80=D0=B8=D0=B5=D0=B2=20(?= =?UTF-8?q?=D1=81=D1=86=D0=B5=D0=BD=D0=B0=D1=80=D0=B8=D0=B8=20=D1=81=D0=B1?= =?UTF-8?q?=D0=BE=D1=80=D0=BA=D0=B8,=20=D1=82=D0=B5=D1=81=D1=82=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-and-test.yml | 18 +++++++++-------- .github/workflows/powershell.yml | 30 ++++++++++++++++++---------- CHANGELOG.md | 9 ++++++++- security.md | 4 ++-- 4 files changed, 40 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index fb245f2c..45d1e7c8 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -3,17 +3,19 @@ name: Build and test on: push: paths: - - ".github/workflows/build-and-test.yml" - - "src/**" - - "tools/**" - - ".build.ps1" + - .github/workflows/build-and-test.yml + - src/** + - tools/** + - tests/** + - .build.ps1 pull_request: paths: - - ".github/workflows/build-and-test.yml" - - "src/**" - - "tools/**" - - ".build.ps1" + - .github/workflows/build-and-test.yml + - src/** + - tools/** + - tests/** + - .build.ps1 jobs: build: diff --git a/.github/workflows/powershell.yml b/.github/workflows/powershell.yml index 4363e0fe..06497f7b 100644 --- a/.github/workflows/powershell.yml +++ b/.github/workflows/powershell.yml @@ -6,15 +6,25 @@ name: Check PowerShell code quality on: push: paths: - - "tools/**/*.ps1" - - "tools/**/*.psm1" - - "tools/**/*.psd1" + - .github/workflows/powershell.yml + - .build.ps1 + - src/**/*.ps1 + - tests/**/*.ps1 + - tests/**/*.psd1 + - tools/**/*.ps1 + - tools/**/*.psm1 + - tools/**/*.psd1 pull_request: paths: - - "tools/**/*.ps1" - - "tools/**/*.psm1" - - "tools/**/*.psd1" + - .github/workflows/powershell.yml + - .build.ps1 + - src/**/*.ps1 + - tests/**/*.ps1 + - tests/**/*.psd1 + - tools/**/*.ps1 + - tools/**/*.psm1 + - tools/**/*.psd1 jobs: analyze: @@ -27,18 +37,18 @@ jobs: steps: - uses: actions/checkout@v2.3.5 - - name: Run PSScriptAnalyzer + - name: Check tools, build and tests PowerShell scripts quality uses: microsoft/psscriptanalyzer-action@v1.0 with: # Check https://github.com/microsoft/psscriptanalyzer-action for more info about the options. - # The below set up runs PSScriptAnalyzer to your entire repository and runs some basic security rules. includeDefaultRules: true severity: '"Error", "Warning"' - path: .\tools\ + path: .\ + ignorePattern: "install" recurse: true output: results.sarif - - name: Upload SARIF results file + - name: Upload tools, build and tests PowerShell scripts checking results uses: github/codeql-action/upload-sarif@v1 with: sarif_file: results.sarif diff --git a/CHANGELOG.md b/CHANGELOG.md index 08da85d0..bd02a835 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ ## [Unreleased] Неопубликованные изменения (не вошедшие в релиз) +## [2.9.5] + +### Изменено + +- расширена проверка PowerShell сценариев (сценарии сборки, тестирования) + ## [2.9.4] ### Изменено @@ -877,7 +883,8 @@ - шаблона переписки, внутренней и внешней (писем, служебных, докладных и объяснительных записок) -[Unreleased]: https://github.com/test-st-petersburg/DocTemplates/compare/2.9.4...HEAD +[Unreleased]: https://github.com/test-st-petersburg/DocTemplates/compare/2.9.5...HEAD +[2.9.5]: https://github.com/test-st-petersburg/DocTemplates/compare/2.9.4...2.9.5 [2.9.4]: https://github.com/test-st-petersburg/DocTemplates/compare/2.9.3...2.9.4 [2.9.3]: https://github.com/test-st-petersburg/DocTemplates/compare/2.9.2...2.9.3 [2.9.2]: https://github.com/test-st-petersburg/DocTemplates/compare/2.9.1...2.9.2 diff --git a/security.md b/security.md index 3785665a..c1906b51 100644 --- a/security.md +++ b/security.md @@ -4,8 +4,8 @@ | Version | Supported | | ------- | ------------------ | -| 2.8.x | :white_check_mark: | -| < 2.8 | :x: | +| 2.9.x | :white_check_mark: | +| < 2.9 | :x: | ## Уведомления об уязвимостях From 1b811d3138805d0af77350af7d0a85b167e70a9a Mon Sep 17 00:00:00 2001 From: "Sergey S. Betke" Date: Mon, 25 Oct 2021 13:00:29 +0300 Subject: [PATCH 2/3] test: :white_check_mark: Add tests results publication to GitHub MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Публикация результатов тестирования на GitHub (в комментариях к запуску workflow) --- .../{build-and-test.yml => tests.yml} | 20 ++++++++++--------- .vscode/cSpell.json | 3 ++- CHANGELOG.md | 4 ++++ readme.md | 2 +- 4 files changed, 18 insertions(+), 11 deletions(-) rename .github/workflows/{build-and-test.yml => tests.yml} (82%) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/tests.yml similarity index 82% rename from .github/workflows/build-and-test.yml rename to .github/workflows/tests.yml index 45d1e7c8..697f734d 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/tests.yml @@ -1,9 +1,9 @@ -name: Build and test +name: Tests on: push: paths: - - .github/workflows/build-and-test.yml + - .github/workflows/tests.yml - src/** - tools/** - tests/** @@ -11,7 +11,7 @@ on: pull_request: paths: - - .github/workflows/build-and-test.yml + - .github/workflows/tests.yml - src/** - tools/** - tests/** @@ -19,7 +19,7 @@ on: jobs: build: - name: Build + name: Tests runs-on: windows-latest steps: - name: Checkout repository @@ -67,11 +67,13 @@ jobs: Write-Information "Templates version: ${{ steps.gitversion.outputs.semVer }}" -InformationAction Continue; Invoke-Build -Task Build -Verbose; - - name: Validate .ott and .odt files - shell: powershell - run: | - Import-Module -Name InvokeBuild | Out-Null; - Invoke-Build -Task Test -Verbose; + - name: Validate documents and templates + uses: zyborg/pester-tests-report@v1 + with: + include_paths: tests + report_title: Результаты тестирования + tests_fail_step: true + github_token: ${{ secrets.GITHUB_TOKEN }} - name: Upload .ott files uses: actions/upload-artifact@v2 diff --git a/.vscode/cSpell.json b/.vscode/cSpell.json index 55478966..f14ce6d2 100644 --- a/.vscode/cSpell.json +++ b/.vscode/cSpell.json @@ -120,7 +120,8 @@ "wagoid", "xcard", "xforms", - "xlink" + "xlink", + "zyborg" ], "ignoreRegExpList": [ "эскалаци(я|и|ю|ей)", diff --git a/CHANGELOG.md b/CHANGELOG.md index bd02a835..b4c7ff99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ ## [2.9.5] +### Добавлено + +- публикация результатов тестирования на GitHub (в комментариях к запуску workflow) + ### Изменено - расширена проверка PowerShell сценариев (сценарии сборки, тестирования) diff --git a/readme.md b/readme.md index 0a001e26..2bee444d 100644 --- a/readme.md +++ b/readme.md @@ -1,7 +1,7 @@ # Libre Office шаблоны документов [![GitHub release](https://img.shields.io/github/v/release/test-st-petersburg/DocTemplates.svg?sort=semver&logo=github)](https://github.com/test-st-petersburg/DocTemplates/releases) -[![Build and Test Status](https://github.com/test-st-petersburg/DocTemplates/workflows/Build%20and%20test/badge.svg?branch=master)](https://github.com/test-st-petersburg/DocTemplates/actions/workflows/build-and-test.yml) +[![Build and Test Status](https://github.com/test-st-petersburg/DocTemplates/workflows/Tests/badge.svg?branch=master)](https://github.com/test-st-petersburg/DocTemplates/actions/workflows/tests.yml) [![Semantic Versioning](https://img.shields.io/static/v1?label=Semantic%20Versioning&message=v2.0.0&color=green&logo=semver)](https://semver.org/lang/ru/spec/v2.0.0.html) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-v1.0.0-yellow.svg?logo=git)](https://conventionalcommits.org) From 007d263f31400d945c16ca453ac762b408b01232 Mon Sep 17 00:00:00 2001 From: "Sergey S. Betke" Date: Mon, 25 Oct 2021 13:59:08 +0300 Subject: [PATCH 3/3] test: :white_check_mark: Rename documents tests (with relative document path name) --- tests/doc/Documents.Tests.ps1 | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/doc/Documents.Tests.ps1 b/tests/doc/Documents.Tests.ps1 index f30c3fec..fc2cc47e 100644 --- a/tests/doc/Documents.Tests.ps1 +++ b/tests/doc/Documents.Tests.ps1 @@ -46,7 +46,21 @@ Describe 'Open Documents' { Describe '' -ForEach @( $DestinationDocFile | Get-Item | - ForEach-Object { @{ Name = $_.Name; FullName = $_.FullName } } + ForEach-Object { + Push-Location -LiteralPath $DestinationDocumentsPath; + try + { + [System.String] $DocumentRelativePath = ( Resolve-Path -LiteralPath ( $_.FullName ) -Relative ); + } + finally + { + Pop-Location; + }; + @{ + Name = $DocumentRelativePath; + FullName = $_.FullName; + }; + } ) { It 'is valid (by ODFValidator)' -Tag 'ODFValidator' { # chcp 866 > $null;