Skip to content

Improve UI tests by running each in isolation (separate Tobira process & DB) with fixed offline data #365

Improve UI tests by running each in isolation (separate Tobira process & DB) with fixed offline data

Improve UI tests by running each in isolation (separate Tobira process & DB) with fixed offline data #365

name: Admin UI API Check
on:
pull_request:
paths:
- "backend/**"
- ".github/workflows/check-admin-ui-api.yml"
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Install GraphQL Inspector
run: |
npm install \
@graphql-inspector/[email protected] \
@graphql-inspector/[email protected] \
@graphql-inspector/[email protected] \
@graphql-inspector/[email protected]
- name: Check for changes to the APIs the admin UI integration uses
id: graphql_inspector
run: |
npx graphql-inspector diff \
--rule .github/workflows/check-admin-ui-api/rule.js \
--onComplete .github/workflows/check-admin-ui-api/onComplete.js \
git:${{ github.event.pull_request.base.sha }}:frontend/src/schema.graphql \
git:${{ github.event.pull_request.head.sha }}:frontend/src/schema.graphql \
| tee >( \
grep -v ^::set-output \
| sed -e 's/\[\(log\|success\|info\|error\|warn\)\] //' \
> diff \
)
- name: Read diff output
id: diff_output
uses: juliangruber/read-file-action@v1
with:
path: diff
trim: true
if: steps.graphql_inspector.outputs.changes == 'true'
- name: Hide previous comments made by this workflow
uses: int128/hide-comment-action@v1
with:
# We have to specify an empty author-filter here so that this step doesn't try to remove
# the deployment comments we create in another step (or any other comments by github-actions
# for that matter).
authors:
starts-with: "<!-- admin-ui-api-check -->"
- name: Add a comment when there are relevant changes
uses: int128/comment-action@v1
with:
post: |
<!-- admin-ui-api-check -->
🚨🚨🚨 This PR changes APIs used by the Opencast Admin UI integration 🚨🚨🚨
```
${{ steps.diff_output.outputs.content }}
```
if: steps.graphql_inspector.outputs.changes == 'true'