Skip to content

Commit

Permalink
chore: add generate test report action (#6205)
Browse files Browse the repository at this point in the history
* chore: add generate test report action

* chore: add temporary push trigger

* chore: test

* chore: rename job

* chore: remove skip branch

* chore: change file path

* chore: debug command

* chore: remove if

* chore: update test script command

* chore: use node 18

* chore: remove temp push trigger

* chore: add push to main trigger

* chore: include test names

* chore: add commmit url

* chore: fix commit echo

* chore: remove temp push trigger
  • Loading branch information
PatrykBuniX authored May 13, 2024
1 parent 2d940cf commit 4f453aa
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/generate_test_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Generate test reports

on:
push:
branches: [main]
workflow_dispatch:

jobs:
generate_test_report:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Set environment variables
run: |
echo "BRANCH_NAME=$(git branch --show-current)" >> $GITHUB_ENV
echo "COMMIT_URL=${{github.event.head_commit.url}}" >> $GITHUB_ENV
- name: Set TITLE
env:
PR_TITLE: ${{github.event.pull_request.title || env.COMMIT_MESSAGE}}
run: echo "TITLE=$PR_TITLE" >> $GITHUB_ENV

- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{github.token}}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: 'yarn'

- name: Authenticate git clone
env:
GH_TOKEN: ${{secrets.OTTO_THE_BOT_GH_TOKEN}}
run: echo -e "machine github.com\n login ${GH_TOKEN}" > ~/.netrc

- name: Install JS dependencies
run: yarn --immutable

- name: Build
run: yarn dist

- name: Test
run: |
set -o pipefail
yarn test:all --stream -- --verbose --coverage --coverage_reporters=lcov 2>&1 | tee ./unit-tests.log
- name: Print environment variables
run: |
echo -e "BRANCH_NAME = ${BRANCH_NAME}" >> ./unit-tests.log
echo -e "COMMIT_URL = ${COMMIT_URL}" >> ./unit-tests.log
- name: Save test coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: ./unit-tests.log
1 change: 1 addition & 0 deletions unit-tests.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test

0 comments on commit 4f453aa

Please sign in to comment.