From 4422f70ad9512d6aa3eed397e99ec0801a4ba7e1 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 9 Oct 2023 12:59:55 +0300 Subject: [PATCH 1/2] Add github actions workflow for test-runner --- .github/workflows/ci.yml | 38 +++++++++++++++++++++++++++++++ .github/workflows/test-report.yml | 23 +++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/test-report.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..61a748a0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +name: CI +run-name: 'Run tests: Commit ${{ github.sha }}' + +on: + pull_request: + types: [opened, reopened, edited] + branches: + - master + workflow_dispatch: + +jobs: + linux-test-runner: + name: Linux Test Runner + timeout-minutes: 30 + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + - uses: actions/setup-node@v3 + with: + node-version: 18.17.1 + - name: Setup configs + run: | + cp config/common.json.example config/common.json \ + && cp config/service.report.json.example config/service.report.json \ + && cp config/facs/grc.config.json.example config/facs/grc.config.json \ + && cp config/facs/grc-slack.config.json.example config/facs/grc-slack.config.json + - name: Install deps + run: npm i + - name: Run tests + run: npm test -- --reporter=json --reporter-option output=test-report.json + - uses: actions/upload-artifact@v3 + if: success() || failure() + with: + name: test-results + path: test-report.json diff --git a/.github/workflows/test-report.yml b/.github/workflows/test-report.yml new file mode 100644 index 00000000..eb50c5e6 --- /dev/null +++ b/.github/workflows/test-report.yml @@ -0,0 +1,23 @@ +name: 'Test Report' + +on: + workflow_run: + workflows: ['CI'] + types: + - completed + +permissions: + contents: read + actions: read + checks: write + +jobs: + report: + runs-on: ubuntu-22.04 + steps: + - uses: dorny/test-reporter@v1 + with: + artifact: test-results + name: Test Report + path: test-report.json + reporter: mocha-json From 28ada1a2ec5022554c4a512cb323d22e374da960 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 10 Oct 2023 15:17:43 +0300 Subject: [PATCH 2/2] Add summary with web page link to test report workflow --- .github/workflows/test-report.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-report.yml b/.github/workflows/test-report.yml index eb50c5e6..925aaf43 100644 --- a/.github/workflows/test-report.yml +++ b/.github/workflows/test-report.yml @@ -1,4 +1,5 @@ name: 'Test Report' +run-name: 'Test Report: Commit ${{ github.sha }}' on: workflow_run: @@ -12,12 +13,18 @@ permissions: checks: write jobs: - report: + web-page-report: + name: Web Page Report runs-on: ubuntu-22.04 steps: - uses: dorny/test-reporter@v1 + id: test-results with: artifact: test-results - name: Test Report + name: Mocha Tests path: test-report.json reporter: mocha-json + - name: Test Report Summary + run: | + echo "### Test Report page is ready! :rocket:" >> $GITHUB_STEP_SUMMARY + echo "And available at the following [Link](${{ steps.test-results.outputs.url_html }})" >> $GITHUB_STEP_SUMMARY