Skip to content

Bypass implicit Permissions mixin dependencies #6789

Bypass implicit Permissions mixin dependencies

Bypass implicit Permissions mixin dependencies #6789

Workflow file for this run

name: Tests
on:
push:
branches:
- main
- maintenance
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check-changes:
name: Verify changes
runs-on: ubuntu-latest
outputs:
run_backend_tests: ${{ steps.changed-files.outputs.backend_changed }}
run_postgres_tests: ${{ steps.changed-files.outputs.postgres_changed }}
run_ui_tests: ${{ steps.changed-files.outputs.ui_changed }}
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
- name: Find changed files
id: changed-files
run: |
./.github/scripts/detect_changed_files.sh
backend-tests:
if: ${{ needs.check-changes.outputs.run_backend_tests == 'true' }}
name: Backend tests
needs: check-changes
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
node-version: [20.x]
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm ci
- name: Build the forge
run: npm run build
- name: Run forge unit tests
run: npm run cover:unit:forge
- name: Run forge system tests
run: npm run cover:system
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@fdcc8476540edceab3de004e990f80d881c6cc00 # v5.5.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: backend
postgres-tests:
if: ${{ needs.check-changes.outputs.run_postgres_tests == 'true' }}
name: Postgres tests
needs: check-changes
runs-on: ubuntu-latest
timeout-minutes: 45
services:
postgres:
image: postgres:14
env:
POSTGRES_PASSWORD: secret
POSTGRES_USER: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
-m 3GB
ports:
- 5432:5432
strategy:
matrix:
node-version: [20.x]
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Setup NodeJS ${{ matrix.node-version }}
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: ${{ matrix.node-version }}
- name: Install Dependencies
run: npm ci
- name: Build the forge
run: npm run build
- name: Test the forge (with PostgreSQL)
env:
FF_TEST_DB_POSTGRES: true
FF_TEST_DB_POSTGRES_HOST: localhost
FF_TEST_DB_POSTGRES_PORT: 5432
FF_TEST_DB_POSTGRES_USER: postgres
FF_TEST_DB_POSTGRES_PASSWORD: secret
FF_TEST_DB_POSTGRES_DATABASE: flowforge
NODE_OPTIONS: "--max-old-space-size=6144"
run: npm run test
ui-tests:
if: ${{ needs.check-changes.outputs.run_ui_tests == 'true' }}
name: UI tests
needs: check-changes
runs-on: ubuntu-latest
services:
email-service:
image: axllent/mailpit
ports:
- 8025:8025
- 1025:1025
options: >-
--env MP_MAX_MESSAGES=5000
--env MP_SMTP_AUTH_ACCEPT_ANY=1
--env MP_SMTP_AUTH_ALLOW_INSECURE=1
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Install Dependencies
run: npm ci
- name: Run Linting Tests
run: npm run lint
- name: Run UI Unit Tests
run: npm run test:unit:frontend
- name: Run UI E2E (Cypress) Tests - OS
uses: cypress-io/github-action@b8ba51a856ba5f4c15cf39007636d4ab04f23e3c # v6.10.2
with:
install: false
config-file: config/cypress-os.config.js
build: npm run build
start: npm run cy:web-server:os
env:
NO_SMTP_SERVER: 'true'
SMTP_HOST: 'localhost'
SMTP_PORT: '1025'
SMTP_WEB_PORT: '8025'
- name: Run UI E2E (Cypress) Tests - EE
uses: cypress-io/github-action@b8ba51a856ba5f4c15cf39007636d4ab04f23e3c # v6.10.2
with:
install: false
config-file: config/cypress-ee.config.js
build: npm run build
start: npm run cy:web-server:ee
env:
NO_SMTP_SERVER: 'true'
SMTP_HOST: 'localhost'
SMTP_PORT: '1025'
SMTP_WEB_PORT: '8025'
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: failure()
with:
name: cypress-output
path: |
test/e2e/frontend/cypress/screenshots
test/e2e/frontend/cypress/videos
# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v5
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# flags: frontend
notify-slack:
name: Notify on failure
needs: [backend-tests, postgres-tests, ui-tests]
if: failure()
runs-on: ubuntu-latest
steps:
- name: Map users
id: map-actor-to-slack
uses: icalia-actions/map-github-actor@e568d1dd6023e406a1db36db4e1e0b92d9dd7824 # v0.0.2
with:
actor-map: ${{ vars.SLACK_GITHUB_USERS_MAP }}
default-mapping: C067BD0377F
- name: Generate payload variables
run: |
if [[ "${{ github.ref_name }}" == 'main' || "${{ github.ref_name }}" == 'maintenance' ]] ; then
echo "HEADER_MESSAGE=Tests failed against ${{ github.ref_name }} branch" >> $GITHUB_ENV
echo "SUMMARY_ICON=no_entry" >> $GITHUB_ENV
echo "SUMMARY_MESSAGE= Deployment to FFC environments will not happen until this issue is resolved." >> $GITHUB_ENV
echo "LAST_COMMIT_SHA=${{ github.sha}}" >> $GITHUB_ENV
echo "PR_LINK=*Branch:* ${{ github.ref_name }}" >> $GITHUB_ENV
else
echo "HEADER_MESSAGE=Tests failed against ${{ github.event.number }} pull request" >> $GITHUB_ENV
echo "SUMMARY_ICON=warning" >> $GITHUB_ENV
echo "SUMMARY_MESSAGE= Please resolve the problem before merging your changes into the main branch." >> $GITHUB_ENV
echo "LAST_COMMIT_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
echo "PR_LINK=*Pull request:* <https://github.com/FlowFuse/flowfuse/pull/${{ github.event.pull_request.number }}|${{ github.event.pull_request.number }}>" >> $GITHUB_ENV
fi
- name: Send notification
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
with:
method: chat.postMessage
token: ${{ secrets.SLACK_GHBOT_TOKEN }}
payload: |
{
"channel": "C067BD0377F",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":x: ${{ env.HEADER_MESSAGE }}",
"emoji": true
}
},
{
"type": "divider"
},
{
"type": "rich_text",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "emoji",
"name": "${{ env.SUMMARY_ICON }}"
},
{
"type": "text",
"text": " ${{ env.SUMMARY_MESSAGE }}",
"style": {
"bold": true
}
}
]
}
]
},
{
"type": "divider"
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Author:* <@${{ steps.map-actor-to-slack.outputs.actor-mapping }}>"
},
{
"type": "mrkdwn",
"text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View failed workflow>"
},
{
"type": "mrkdwn",
"text": "*Last commit:* <${{ github.server_url }}/${{ github.repository }}/commit/${{ env.LAST_COMMIT_SHA }}|${{ env.LAST_COMMIT_SHA }}>"
},
{
"type": "mrkdwn",
"text": "${{ env.PR_LINK }}"
}
]
}
]
}