mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 06:34:05 -08:00
127 lines
3.4 KiB
YAML
127 lines
3.4 KiB
YAML
name: Test Master
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
install-and-build:
|
|
runs-on: ubuntu-latest
|
|
|
|
timeout-minutes: 30
|
|
|
|
strategy:
|
|
matrix:
|
|
node-version: [18.x, 20.x]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3.5.3
|
|
|
|
- uses: pnpm/action-setup@v2.4.0
|
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v3.7.0
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: pnpm
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build
|
|
run: pnpm build
|
|
|
|
- name: Cache build artifacts
|
|
uses: actions/cache/save@v3.3.1
|
|
with:
|
|
path: ./packages/**/dist
|
|
key: ${{ github.sha }}-base:${{ matrix.node-version }}-test-lint
|
|
|
|
unit-test:
|
|
name: Unit tests
|
|
runs-on: ubuntu-latest
|
|
needs: install-and-build
|
|
strategy:
|
|
matrix:
|
|
node-version: [18.x, 20.x]
|
|
steps:
|
|
- uses: actions/checkout@v3.5.3
|
|
with:
|
|
repository: n8n-io/n8n
|
|
ref: ${{ inputs.branch }}
|
|
|
|
- uses: pnpm/action-setup@v2.4.0
|
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v3.7.0
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: pnpm
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Restore cached build artifacts
|
|
uses: actions/cache/restore@v3.3.1
|
|
with:
|
|
path: ./packages/**/dist
|
|
key: ${{ github.sha }}-base:${{ matrix.node-version }}-test-lint
|
|
|
|
- name: Test
|
|
run: pnpm test
|
|
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
files: packages/@n8n/client-oauth2/coverage/cobertura-coverage.xml,packages/cli/coverage/cobertura-coverage.xml,packages/core/coverage/cobertura-coverage.xml,packages/design-system/coverage/cobertura-coverage.xml,packages/editor-ui/coverage/cobertura-coverage.xml,packages/nodes-base/coverage/cobertura-coverage.xml,packages/workflow/coverage/cobertura-coverage.xml
|
|
|
|
lint:
|
|
name: Lint changes
|
|
runs-on: ubuntu-latest
|
|
needs: install-and-build
|
|
strategy:
|
|
matrix:
|
|
node-version: [18.x, 20.x]
|
|
steps:
|
|
- uses: actions/checkout@v3.5.3
|
|
with:
|
|
repository: n8n-io/n8n
|
|
ref: ${{ inputs.branch }}
|
|
|
|
- uses: pnpm/action-setup@v2.4.0
|
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v3.7.0
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: pnpm
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Restore cached build artifacts
|
|
uses: actions/cache/restore@v3.3.1
|
|
with:
|
|
path: ./packages/**/dist
|
|
key: ${{ github.sha }}-base:${{ matrix.node-version }}-test-lint
|
|
|
|
- name: Lint
|
|
env:
|
|
CI_LINT_MASTER: true
|
|
run: pnpm lint
|
|
|
|
notify-on-failure:
|
|
name: Notify Slack on failure
|
|
runs-on: ubuntu-latest
|
|
needs: [unit-test, lint]
|
|
steps:
|
|
- name: Notify Slack on failure
|
|
uses: act10ns/slack@v2.0.0
|
|
if: failure()
|
|
with:
|
|
status: ${{ job.status }}
|
|
channel: '#updates-build-alerts'
|
|
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
|
|
message: Master branch (build or test or lint) failed (${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
|