Skip to content

Commit

Permalink
feat(code-coverage): Add toggle to enable/disable postgres log checking
Browse files Browse the repository at this point in the history
  • Loading branch information
RasmusSkytte committed Sep 18, 2024
1 parent d172006 commit fefa3ab
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/code-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
backend_exclude:
type: string
default: ''
check_postgres_logs:
type: boolean
default: true


jobs:
Expand Down Expand Up @@ -268,13 +271,13 @@ jobs:


- name: Collect docker logs
if: always()
if: always() && ${{ inputs.check_postgres_logs }}
uses: jwalton/gh-docker-logs@v2
with:
dest: '${{ runner.workspace }}/logs-docker'

- name: Check docker logs for PostgreSQL ERRORs
if: always()
if: always() && ${{ inputs.check_postgres_logs }}
run: |
## --------------------------------------------------------------------
log=$(find ${{ runner.workspace }}/logs-docker/ -name '*postgres*.log')
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/workflow-dispatcher.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ on:
backend_exclude:
required: false
type: string
check_postgres_logs:
required: false
type: boolean
default: true


jobs:
Expand Down Expand Up @@ -259,6 +263,7 @@ jobs:
cache_version: ${{ needs.trigger.outputs.cache_version }}
schemas: ${{ inputs.schemas }}
backend_exclude: ${{ inputs.backend_exclude }}
check_postgres_logs: ${{ inputs.check_postgres_logs }}
secrets: inherit
concurrency:
group: code-coverage-${{ needs.trigger.outputs.branch_name }}
Expand Down
20 changes: 12 additions & 8 deletions workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,24 @@ Determine the degree of [code coverage](https://en.wikipedia.org/wiki/Code_cover
Code coverage results are uploaded to [codecov.io](https://about.codecov.io/).
This enables you to add the code coverage badge to your `README.md`.

| Arguments | Description | Default | Example |
|-------------------|---------------------------------------|-------------|---------------|
| `schemas` | Schemas to create (optional) | '' | test,test.one |
| `backend_exclude` | data base backends to skip (optional) | '' | postgres |

| Arguments | Description | Default | Example |
|----------------------|----------------------------------------------------------|-------------|---------------|
| `schemas` | Schemas to create (optional) | '' | test,test.one |
| `backend_exclude` | Data base backends to skip (optional) | '' | postgres |
| `check_postgres_logs`| Should PostgreSQL logs be checked for errors? (optional) | true | false |

> [!NOTE]
> To conserve resources, only the `code-coverage` workflow is configured with data bases.
> This means that your `R-CMD-check` may not fail when `code-coverage` fails.
> If this is the case, the cause is likely a data base specific issue in your code base.
> PostgreSQL logs errors to a log file during the tests. Checking these for errors can help detect uncaught
> errors in your test workflow.
#### Exit status
If any tests fail to run, the workflow will give an error.

> [!IMPORTANT]
> To conserve resources, only the `code-coverage` workflow is configured with data bases.
> This means that your `R-CMD-check` may not fail when `code-coverage` fails.
> If this is the case, the cause is likely a data base specific issue in your code base.

## document.yaml
#### Trigger
Expand Down

0 comments on commit fefa3ab

Please sign in to comment.