Skip to content

Commit

Permalink
Merge branch 'master' into n8n-3921-switch-client-oauth2-for-own-helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
maspio committed Mar 10, 2023
2 parents 2306957 + 5f238ea commit c2c7004
Show file tree
Hide file tree
Showing 884 changed files with 10,460 additions and 5,950 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
packages/cli/src/databases/migrations/ @n8n-io/migrations-review
5 changes: 4 additions & 1 deletion .github/scripts/bump-versions.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ for (let { name, path, version, private: isPrivate, dependencies } of packages)
packageMap[name] = { path, isDirty, version };
}

assert.ok(packageMap['n8n'].isDirty, 'No changes found since the last release');
assert.ok(
Object.values(packageMap).some(({ isDirty }) => isDirty),
'No changes found since the last release',
);

// Keep the monorepo version up to date with the released version
packageMap['monorepo-root'].version = packageMap['n8n'].version;
Expand Down
117 changes: 101 additions & 16 deletions .github/workflows/ci-pull-requests.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,99 @@
name: Test Pull Requests
name: Build, unit/smoke test and lint branch

on: [pull_request]

jobs:
build:
install:
name: Install & Build
runs-on: ubuntu-latest

timeout-minutes: 30

strategy:
matrix:
node-version: [14.x, 16.x]

steps:
- uses: actions/checkout@v3
with:
repository: n8n-io/n8n
ref: ${{ inputs.branch }}

- uses: pnpm/[email protected]

- name: Use Node.js ${{ matrix.node-version }}
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
node-version: 16.x
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm build

- name: Cache build artifacts
uses: actions/cache@v3
with:
path: |
/github/home/.cache
/github/home/.pnpm-store
./node_modules
./packages
key: ${{ github.sha }}-base:16.18.1-test-lint

unit-test:
name: Unit tests
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v3
with:
repository: n8n-io/n8n
ref: ${{ inputs.branch }}

- name: Restore cached build artifacts
uses: actions/cache@v3
with:
path: |
/github/home/.cache
/github/home/.pnpm-store
./node_modules
./packages
key: ${{ github.sha }}-base:16.18.1-test-lint

- uses: pnpm/[email protected]

- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: pnpm

- name: Test
run: pnpm test

- name: Test E2E
run: |
pnpm cypress:install
pnpm test:e2e:smoke
lint:
name: Lint changes
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v3
with:
repository: n8n-io/n8n
ref: ${{ inputs.branch }}

- name: Restore cached build artifacts
uses: actions/cache@v3
with:
path: |
/github/home/.cache
/github/home/.pnpm-store
./node_modules
./packages
key: ${{ github.sha }}-base:16.18.1-test-lint

- uses: pnpm/[email protected]

- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: pnpm

- name: Fetch base branch for `git diff`
run: git fetch origin ${{ github.event.pull_request.base.ref }}:${{ github.event.pull_request.base.ref }}
Expand All @@ -44,3 +102,30 @@ jobs:
env:
ESLINT_PLUGIN_DIFF_COMMIT: ${{ github.event.pull_request.base.ref }}
run: pnpm lint

smoke-test:
name: E2E [Electron/Node 16]
uses: ./.github/workflows/e2e-reusable.yml
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-e2e') }}
with:
branch: ${{ github.event.pull_request.head.ref }}
user: ${{ github.event.inputs.user || 'PR User' }}
spec: ${{ github.event.inputs.spec || 'e2e/0-smoke.cy.ts' }}
run-env: base:16.18.1
record: false
parallel: false
containers: '[1]'
secrets:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}

checklist_job:
runs-on: ubuntu-latest
name: Checklist job
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Checklist
uses: wyozi/contextual-qa-checklist-action@master
with:
gh-token: ${{ secrets.GITHUB_TOKEN }}
comment-footer: Make sure to check off this list before asking for review.
3 changes: 2 additions & 1 deletion .github/workflows/docker-base-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: ./docker/images/n8n-base
build-args: |
NODE_VERSION=${{github.event.inputs.node_version}}
platforms: linux/amd64,linux/arm64,linux/arm/v7
provenance: false
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/base:${{ github.event.inputs.node_version }}
3 changes: 2 additions & 1 deletion .github/workflows/docker-images-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ jobs:
shell: bash

- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: .
file: ./docker/images/n8n-custom/Dockerfile
platforms: linux/amd64
provenance: false
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/n8n:${{ github.event.inputs.tag || 'nightly' }}
no-cache: true
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: ./docker/images/n8n${{ matrix.docker-context }}
build-args: |
N8N_VERSION=${{ steps.vars.outputs.tag }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
provenance: false
push: true
tags: |
${{ secrets.DOCKER_USERNAME }}/n8n:${{ steps.vars.outputs.tag }}${{ matrix.docker-context }}
Expand Down
150 changes: 150 additions & 0 deletions .github/workflows/e2e-reusable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
name: Reusable e2e workflow

on:
workflow_call:
inputs:
branch:
description: 'GitHub branch to test.'
required: false
type: string
default: 'master'
user:
description: 'User who kicked this off.'
required: false
type: string
default: 'schedule'
spec:
description: 'Specify specs.'
required: false
default: 'e2e/*'
type: string
run-env:
description: 'Node env version to run tests with.'
required: false
default: 'browsers:node16.18.0-chrome90-ff88'
type: string
cache-key:
description: 'Cache key for modules and build artifacts.'
required: false
default: ${{ github.sha }}-${{ inputs.run-env }}-e2e-modules
type: string
record:
description: 'Record test run.'
required: false
default: true
type: boolean
parallel:
description: 'Run tests in parallel.'
required: false
default: true
type: boolean
containers:
description: 'Number of containers to run tests in.'
required: false
default: '[1, 2, 3, 4, 5, 6, 7, 8]'
type: string
secrets:
CYPRESS_RECORD_KEY:
description: 'Cypress record key.'
required: true

jobs:
# single job that generates and outputs a common id
prepare:
runs-on: ubuntu-latest
outputs:
uuid: ${{ steps.uuid.outputs.value }}
steps:
- name: Generate unique ID 💎
id: uuid
# take the current commit + timestamp together
# the typical value would be something like
# "sha-5d3fe...35d3-time-1620841214"
run: echo "value=sha-$GITHUB_SHA-time-$(date +"%s")" >> $GITHUB_OUTPUT

install:
runs-on: ubuntu-latest
needs: ['prepare']
container:
image: cypress/${{ inputs.run-env }}
options: --user 1001
steps:
- uses: actions/checkout@v3
with:
repository: n8n-io/n8n
ref: ${{ inputs.branch }}

- name: Setup pnpm
uses: pnpm/[email protected]
with:
run_install: true

- name: Cache pnpm modules
uses: actions/cache@v3
with:
path: |
/github/home/.cache
/github/home/.pnpm-store
./node_modules
./packages
key: ${{ inputs.cache-key }}

- name: Cypress build
uses: cypress-io/github-action@v5
with:
# Disable running of tests within install job
runTests: false
install: false
build: pnpm build

- name: Cypress install
run: pnpm cypress:install

testing:
runs-on: ubuntu-latest
container:
image: cypress/${{ inputs.run-env }}
options: --user 1001
needs: ['prepare', 'install']
strategy:
fail-fast: false
matrix:
containers: ${{ fromJSON(inputs.containers) }}
steps:
- uses: actions/checkout@v3
with:
repository: n8n-io/n8n
ref: ${{ inputs.branch }}

- name: Setup pnpm
uses: pnpm/[email protected]

- name: Restore cached pnpm modules
uses: actions/cache@v3
with:
path: |
/github/home/.cache
/github/home/.pnpm-store
./node_modules
./packages
key: ${{ inputs.cache-key }}

- name: Cypress run
uses: cypress-io/github-action@v5
with:
install: false
start: pnpm start
wait-on: 'http://localhost:5678'
wait-on-timeout: 120 #
record: ${{ inputs.record }}
parallel: ${{ inputs.parallel }}
# We have to provide custom ci-build-id key to make sure that this workflow could be run multiple times
# in the same parent workflow
ci-build-id: ${{ needs.prepare.outputs.uuid }}
spec: "/__w/n8n/n8n/cypress/${{ inputs.spec }}"
config-file: /__w/n8n/n8n/cypress.config.js
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
E2E_TESTS: true
COMMIT_INFO_MESSAGE: 🌳 ${{ inputs.branch }} 🖥️ ${{ inputs.run-env }} 🤖 ${{ inputs.user }} 🗃️ ${{ inputs.spec }}
Loading

0 comments on commit c2c7004

Please sign in to comment.