Run test workflows #1070
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run test workflows | |
on: | |
schedule: | |
- cron: '0 2 * * *' | |
workflow_dispatch: | |
pull_request: | |
paths: | |
- packages/core/package.json | |
- packages/nodes-base/package.json | |
- packages/@n8n/nodes-langchain/package.json | |
- .github/workflows/test-workflows.yml | |
pull_request_review: | |
types: [submitted] | |
jobs: | |
build: | |
name: Install & Build | |
runs-on: ubuntu-latest | |
if: github.event_name != 'pull_request_review' || startsWith(github.event.pull_request.base.ref, 'release/') | |
steps: | |
- uses: actions/checkout@v4.1.1 | |
- run: corepack enable | |
- uses: actions/setup-node@v4.0.2 | |
with: | |
node-version: 20.x | |
cache: 'pnpm' | |
- run: pnpm install --frozen-lockfile | |
- name: Setup build cache | |
uses: rharkor/caching-for-turbo@v1.5 | |
- name: Build Backend | |
run: pnpm build:backend | |
- name: Cache build artifacts | |
uses: actions/cache/save@v4.0.0 | |
with: | |
path: ./packages/**/dist | |
key: ${{ github.sha }}:workflow-tests | |
run-test-workflows: | |
name: Workflow Tests | |
runs-on: ubuntu-latest | |
needs: build | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4.1.1 | |
- run: corepack enable | |
- uses: actions/setup-node@v4.0.2 | |
with: | |
node-version: 20.x | |
cache: 'pnpm' | |
- run: pnpm install --frozen-lockfile | |
- name: Setup build cache | |
uses: rharkor/caching-for-turbo@v1.5 | |
- name: Restore cached build artifacts | |
uses: actions/cache/restore@v4.0.0 | |
with: | |
path: ./packages/**/dist | |
key: ${{ github.sha }}:workflow-tests | |
- name: Install OS dependencies | |
run: | | |
sudo apt update -y | |
echo 'tzdata tzdata/Areas select Europe' | sudo debconf-set-selections | |
echo 'tzdata tzdata/Zones/Europe select Paris' | sudo debconf-set-selections | |
DEBIAN_FRONTEND="noninteractive" sudo apt-get install -y graphicsmagick | |
- name: Checkout workflows repo | |
uses: actions/checkout@v4.1.1 | |
with: | |
repository: n8n-io/test-workflows | |
path: test-workflows | |
- name: Import credentials | |
run: packages/cli/bin/n8n import:credentials --input=test-workflows/credentials.json | |
env: | |
N8N_ENCRYPTION_KEY: ${{secrets.ENCRYPTION_KEY}} | |
- name: Import workflows | |
run: packages/cli/bin/n8n import:workflow --separate --input=test-workflows/workflows | |
env: | |
N8N_ENCRYPTION_KEY: ${{secrets.ENCRYPTION_KEY}} | |
- name: Copy static assets | |
run: | | |
cp assets/n8n-logo.png /tmp/n8n-logo.png | |
cp assets/n8n-screenshot.png /tmp/n8n-screenshot.png | |
cp test-workflows/testData/pdfs/*.pdf /tmp/ | |
- name: Run tests | |
run: packages/cli/bin/n8n executeBatch --shallow --skipList=test-workflows/skipList.txt --githubWorkflow --shortOutput --concurrency=16 --compare=test-workflows/snapshots | |
id: tests | |
env: | |
N8N_ENCRYPTION_KEY: ${{secrets.ENCRYPTION_KEY}} | |
SKIP_STATISTICS_EVENTS: true | |
DB_SQLITE_POOL_SIZE: 4 | |
N8N_SENTRY_DSN: ${{secrets.CI_SENTRY_DSN}} | |
- name: Notify Slack on failure | |
uses: act10ns/slack@v2.0.0 | |
if: failure() && github.ref == 'refs/heads/master' | |
with: | |
status: ${{ job.status }} | |
channel: '#alerts-build' | |
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} | |
message: | | |
🛑 Workflow test failed 🛑: | |
${{ steps.tests.outputs.slackMessage}} | |
Sent by *Github Action*: <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}| Test workflow> |