diff --git a/.github/workflows/check-documentation-urls.yml b/.github/workflows/check-documentation-urls.yml index 3b634d5435a23..a96779fbe8484 100644 --- a/.github/workflows/check-documentation-urls.yml +++ b/.github/workflows/check-documentation-urls.yml @@ -16,15 +16,21 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2.2.4 + - uses: pnpm/action-setup@v2.4.0 - - uses: actions/setup-node@v3 + - name: Use Node.js 18.x + uses: actions/setup-node@v3.8.1 with: node-version: 18.x - cache: 'pnpm' + + - name: Setup pnpm store cache + uses: actions/cache@v3.3.1 + with: + path: /github/home/.pnpm-store + key: pnpm-store-cache - name: Install dependencies - run: pnpm install + run: pnpm install --frozen-lockfile - name: Build nodes-base run: pnpm --filter @n8n/client-oauth2 --filter n8n-workflow --filter n8n-core --filter n8n-nodes-base build diff --git a/.github/workflows/ci-master.yml b/.github/workflows/ci-master.yml index 80793e13b65e5..29ef8caa593d0 100644 --- a/.github/workflows/ci-master.yml +++ b/.github/workflows/ci-master.yml @@ -6,121 +6,27 @@ on: - 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 - - - uses: pnpm/action-setup@v2.2.4 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - 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@v3 - with: - path: | - /github/home/.cache - /github/home/.pnpm-store - ./node_modules - ./packages - 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 - with: - repository: n8n-io/n8n - ref: ${{ inputs.branch }} + build: + uses: ./.github/workflows/reusable-build.yml + with: + branch: master - - 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:${{ matrix.node-version }}-test-lint - - - uses: pnpm/action-setup@v2.2.4 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: pnpm - - - 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 + unit-tests: + needs: build + uses: ./.github/workflows/reusable-unit-tests.yml + with: + branch: master 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 - 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:${{ matrix.node-version }}-test-lint - - - uses: pnpm/action-setup@v2.2.4 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: pnpm - - - name: Lint - env: - CI_LINT_MASTER: true - run: pnpm lint + needs: build + uses: ./.github/workflows/reusable-lint.yml + with: + branch: master notify-on-failure: name: Notify Slack on failure runs-on: ubuntu-latest - needs: [unit-test, lint] + needs: [unit-tests, lint] steps: - name: Notify Slack on failure uses: act10ns/slack@v2.0.0 diff --git a/.github/workflows/ci-postgres-mysql.yml b/.github/workflows/ci-postgres-mysql.yml index ccd999ee8a516..5cae415ec511a 100644 --- a/.github/workflows/ci-postgres-mysql.yml +++ b/.github/workflows/ci-postgres-mysql.yml @@ -5,45 +5,121 @@ on: - cron: '0 0 * * *' workflow_dispatch: +env: + DB_MYSQLDB_PASSWORD: password + DB_POSTGRESDB_PASSWORD: password + DB_TABLE_PREFIX: test_ + DB_POSTGRESDB_SCHEMA: alt_schema + jobs: - test: + build: runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch }} - timeout-minutes: 60 + - uses: pnpm/action-setup@v2.4.0 - env: - DB_MYSQLDB_PASSWORD: password - DB_POSTGRESDB_PASSWORD: password + - uses: actions/setup-node@v3.8.1 + with: + node-version: 18.x - steps: - - uses: actions/checkout@v3 + - name: Setup pnpm store cache + uses: actions/cache@v3.3.1 + with: + path: /github/home/.pnpm-store + key: pnpm-store-cache + + - name: Install dependencies + run: pnpm install --frozen-lockfile - - uses: pnpm/action-setup@v2.2.4 + - name: Build Backend packages + run: pnpm --filter @n8n/client-oauth2 --filter n8n-workflow --filter n8n-core --filter n8n build - - uses: actions/setup-node@v3 + - name: Cache build artifacts + uses: actions/cache/save@v3.3.1 + with: + path: ./packages + key: build-db-${{ github.sha }} + + test-mysql: + needs: build + runs-on: ubuntu-latest + steps: + - uses: pnpm/action-setup@v2.4.0 + + - name: Use Node.js 18.x + uses: actions/setup-node@v3.8.1 with: node-version: 18.x - cache: 'pnpm' + + - name: Setup pnpm store cache + uses: actions/cache@v3.3.1 + with: + path: /github/home/.pnpm-store + key: pnpm-store-cache - name: Install dependencies run: pnpm install --frozen-lockfile - - name: Start MySQL & Postgres + - name: Restore cached build artifacts + uses: actions/cache/restore@v3.3.1 + with: + path: ./packages + key: build-db-${{ github.sha }} + + - name: Start MySQL uses: isbang/compose-action@v1.3.2 with: compose-file: ./.github/docker-compose.yml - - - name: Build Core, Workflow, and CLI - run: pnpm --filter @n8n/client-oauth2 --filter n8n-workflow --filter n8n-core --filter n8n build + services: mysql - name: Test MySQL working-directory: packages/cli - run: DB_TABLE_PREFIX=test_ pnpm test:mysql + run: pnpm test:mysql + + test-postgres: + needs: build + runs-on: ubuntu-latest + steps: + - uses: pnpm/action-setup@v2.4.0 + + - name: Use Node.js 18.x + uses: actions/setup-node@v3.8.1 + with: + node-version: 18.x + + - name: Setup pnpm store cache + uses: actions/cache@v3.3.1 + with: + path: /github/home/.pnpm-store + key: pnpm-store-cache + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Restore cached build artifacts + uses: actions/cache/restore@v3.3.1 + with: + path: ./packages + key: build-db-${{ github.sha }} + + - name: Start Postres + uses: isbang/compose-action@v1.3.2 + with: + compose-file: ./.github/docker-compose.yml + services: postgres - name: Test Postgres working-directory: packages/cli - run: DB_POSTGRESDB_SCHEMA=alt_schema DB_TABLE_PREFIX=test_ pnpm test:postgres + run: pnpm test:postgres + notify-on-failure: + name: Notify Slack on failure + needs: [test-mysql, test-postgres] + runs-on: ubuntu-latest + steps: - name: Notify Slack on failure uses: act10ns/slack@v2.0.0 if: failure() diff --git a/.github/workflows/ci-pull-requests.yml b/.github/workflows/ci-pull-requests.yml index 714e6b49386e3..f27d3fbd76336 100644 --- a/.github/workflows/ci-pull-requests.yml +++ b/.github/workflows/ci-pull-requests.yml @@ -1,109 +1,22 @@ name: Build, unit test and lint branch -on: [pull_request] +on: + pull_request: jobs: - install: - name: Install & Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - repository: n8n-io/n8n - ref: ${{ inputs.branch }} + build: + uses: ./.github/workflows/reusable-build.yml + with: + branch: ${{ inputs.branch }} - - uses: pnpm/action-setup@v2.2.4 - - - name: Use Node.js 18 - uses: actions/setup-node@v3 - with: - node-version: 18.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:18-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:18-test-lint - - - uses: pnpm/action-setup@v2.2.4 - - - name: Use Node.js 18 - uses: actions/setup-node@v3 - with: - node-version: 18.x - cache: pnpm - - - 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 + unit-tests: + needs: build + uses: ./.github/workflows/reusable-unit-tests.yml + with: + branch: ${{ inputs.branch }} 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:18-test-lint - - - uses: pnpm/action-setup@v2.2.4 - - - name: Use Node.js 18 - uses: actions/setup-node@v3 - with: - node-version: 18.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 }} - - - name: Run ESLint on changes only - env: - ESLINT_PLUGIN_DIFF_COMMIT: ${{ github.event.pull_request.base.ref }} - run: pnpm lint + needs: build + uses: ./.github/workflows/reusable-lint.yml + with: + branch: ${{ inputs.branch }} diff --git a/.github/workflows/e2e-tests-pr.yml b/.github/workflows/e2e-tests-pr.yml index 1d9ead6db8fdc..f96c24f8e1e75 100644 --- a/.github/workflows/e2e-tests-pr.yml +++ b/.github/workflows/e2e-tests-pr.yml @@ -9,7 +9,7 @@ on: jobs: run-e2e-tests: name: E2E [Electron/Node 18] - uses: ./.github/workflows/e2e-reusable.yml + uses: ./.github/workflows/reusable-e2e-tests.yml if: ${{ github.event.review.state == 'approved' && !contains(github.event.pull_request.labels.*.name, 'community') }} with: branch: ${{ github.event.pull_request.head.ref }} diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 1d699ca27ea72..3b5be7f834ace 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -41,7 +41,7 @@ jobs: run-e2e-tests: name: E2E [Electron/Node 18] - uses: ./.github/workflows/e2e-reusable.yml + uses: ./.github/workflows/reusable-e2e-tests.yml with: branch: ${{ github.event.inputs.branch || 'master' }} user: ${{ github.event.inputs.user || 'PR User' }} diff --git a/.github/workflows/release-create-pr.yml b/.github/workflows/release-create-pr.yml index 7617a35476dbf..21f71deb2fb6a 100644 --- a/.github/workflows/release-create-pr.yml +++ b/.github/workflows/release-create-pr.yml @@ -35,8 +35,8 @@ jobs: fetch-depth: 0 ref: ${{ github.event.inputs.base-branch }} - - uses: pnpm/action-setup@v2.2.4 - - uses: actions/setup-node@v3 + - uses: pnpm/action-setup@v2.4.0 + - uses: actions/setup-node@v3.8.1 with: node-version: 18.x diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index 6882b4a9bba2b..f57ed8b746027 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -23,11 +23,17 @@ jobs: with: fetch-depth: 0 - - uses: pnpm/action-setup@v2.2.4 - - uses: actions/setup-node@v3 + - uses: pnpm/action-setup@v2.4.0 + - uses: actions/setup-node@v3.8.1 with: node-version: 18.x - cache: 'pnpm' + + - name: Setup pnpm store cache + uses: actions/cache@v3.3.1 + with: + path: /github/home/.pnpm-store + key: pnpm-store-cache + - run: pnpm install --frozen-lockfile - name: Set release version in env diff --git a/.github/workflows/release-push-to-channel.yml b/.github/workflows/release-push-to-channel.yml index 8ab1e6153cf3e..14b89f6d11005 100644 --- a/.github/workflows/release-push-to-channel.yml +++ b/.github/workflows/release-push-to-channel.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 5 steps: - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.8.1 with: node-version: 18.x - run: | diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml new file mode 100644 index 0000000000000..c892b073b6a33 --- /dev/null +++ b/.github/workflows/reusable-build.yml @@ -0,0 +1,43 @@ +name: Checkout and Build + +on: + workflow_call: + inputs: + branch: + description: 'GitHub branch to build' + type: string + required: true + +jobs: + build: + name: Checkout and Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch }} + + - uses: pnpm/action-setup@v2.4.0 + + - name: Use Node.js 18.x + uses: actions/setup-node@v3.8.1 + with: + node-version: 18.x + + - name: Setup pnpm store cache + uses: actions/cache@v3.3.1 + with: + path: /github/home/.pnpm-store + key: pnpm-store-cache + + - 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 + key: build-${{ github.sha }} diff --git a/.github/workflows/e2e-reusable.yml b/.github/workflows/reusable-e2e-tests.yml similarity index 76% rename from .github/workflows/e2e-reusable.yml rename to .github/workflows/reusable-e2e-tests.yml index 8baa3f0da9cad..dc80faa4d9429 100644 --- a/.github/workflows/e2e-reusable.yml +++ b/.github/workflows/reusable-e2e-tests.yml @@ -23,9 +23,9 @@ on: default: 'browsers:node18.12.0-chrome107' type: string cache-key: - description: 'Cache key for modules and build artifacts.' + description: 'Cache key for build artifacts.' required: false - default: ${{ github.sha }}-${{ inputs.run-env }}-e2e-modules + default: ${{ github.sha }}-e2e type: string record: description: 'Record test run.' @@ -78,7 +78,6 @@ jobs: steps: - uses: actions/checkout@v3 with: - repository: n8n-io/n8n ref: ${{ inputs.branch }} - name: Checkout PR @@ -88,19 +87,21 @@ jobs: git checkout FETCH_HEAD - name: Setup pnpm - uses: pnpm/action-setup@v2.2.4 + uses: pnpm/action-setup@v2.4.0 + + - name: Use Node.js 18 + uses: actions/setup-node@v3.8.1 with: - run_install: true + node-version: 18.x - - name: Cache pnpm modules - uses: actions/cache@v3 + - name: Setup pnpm store cache + uses: actions/cache@v3.3.1 with: - path: | - /github/home/.cache - /github/home/.pnpm-store - ./node_modules - ./packages - key: ${{ inputs.cache-key }} + path: /github/home/.pnpm-store + key: pnpm-store-cache + + - name: Install dependencies + run: pnpm install --frozen-lockfile - name: Cypress build uses: cypress-io/github-action@v5 @@ -110,9 +111,21 @@ jobs: install: false build: pnpm build + - name: Cache build artifacts + uses: actions/cache/save@v3.3.1 + with: + path: ./packages + key: build-${{ github.sha }} + - name: Cypress install run: pnpm cypress:install + - name: Cache Cypress Binary + uses: actions/cache/save@v3.3.1 + with: + path: /github/home/.cache/Cypress + key: cypress-binary-cache + testing: runs-on: ubuntu-latest container: @@ -128,7 +141,6 @@ jobs: steps: - uses: actions/checkout@v3 with: - repository: n8n-io/n8n ref: ${{ inputs.branch }} - name: Checkout PR @@ -138,17 +150,33 @@ jobs: git checkout FETCH_HEAD - name: Setup pnpm - uses: pnpm/action-setup@v2.2.4 + uses: pnpm/action-setup@v2.4.0 + + - name: Use Node.js 18 + uses: actions/setup-node@v3.8.1 + with: + node-version: 18.x + + - name: Setup pnpm store cache + uses: actions/cache@v3.3.1 + with: + path: /github/home/.pnpm-store + key: pnpm-store-cache + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Restore cached build artifacts + uses: actions/cache/restore@v3.3.1 + with: + path: ./packages + key: build-${{ github.sha }} - - name: Restore cached pnpm modules - uses: actions/cache@v3 + - name: Restore Cypress Binary + uses: actions/cache/restore@v3.3.1 with: - path: | - /github/home/.cache - /github/home/.pnpm-store - ./node_modules - ./packages - key: ${{ inputs.cache-key }} + path: /github/home/.cache/Cypress + key: cypress-binary-cache - name: Cypress run uses: cypress-io/github-action@v5 diff --git a/.github/workflows/reusable-lint.yml b/.github/workflows/reusable-lint.yml new file mode 100644 index 0000000000000..07623302f4cd0 --- /dev/null +++ b/.github/workflows/reusable-lint.yml @@ -0,0 +1,50 @@ +name: Lint + +on: + workflow_call: + inputs: + branch: + description: 'GitHub branch to lint' + type: string + required: true + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch }} + + - uses: pnpm/action-setup@v2.4.0 + + - name: Use Node.js 18.x + uses: actions/setup-node@v3.8.1 + with: + node-version: 18.x + + - name: Setup pnpm store cache + uses: actions/cache@v3.3.1 + with: + path: /github/home/.pnpm-store + key: pnpm-store-cache + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Fetch base branch for `git diff` + if: ${{ inputs.branch != 'master' }} + run: git fetch origin ${{ github.event.pull_request.base.ref }}:${{ github.event.pull_request.base.ref }} + + - name: Lint Changes + if: ${{ inputs.branch != 'master' }} + env: + ESLINT_PLUGIN_DIFF_COMMIT: ${{ github.event.pull_request.base.ref }} + run: pnpm lint + + - name: Lint Master + if: ${{ inputs.branch == 'master' }} + env: + CI_LINT_MASTER: true + run: pnpm lint diff --git a/.github/workflows/reusable-unit-tests.yml b/.github/workflows/reusable-unit-tests.yml new file mode 100644 index 0000000000000..49651661cdab8 --- /dev/null +++ b/.github/workflows/reusable-unit-tests.yml @@ -0,0 +1,48 @@ +name: Unit tests + +on: + workflow_call: + inputs: + branch: + description: 'GitHub branch to test' + type: string + required: true + +jobs: + unit-test: + name: Unit tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ inputs.branch }} + + - uses: pnpm/action-setup@v2.4.0 + + - name: Use Node.js 18.x + uses: actions/setup-node@v3.8.1 + with: + node-version: 18.x + + - name: Setup pnpm store cache + uses: actions/cache@v3.3.1 + with: + path: /github/home/.pnpm-store + key: pnpm-store-cache + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Restore cached build artifacts + uses: actions/cache/restore@v3.3.1 + with: + path: ./packages + key: build-${{ github.sha }} + + - 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 diff --git a/.github/workflows/test-workflows.yml b/.github/workflows/test-workflows.yml index 78fa52e28a6e0..e64aca74a4647 100644 --- a/.github/workflows/test-workflows.yml +++ b/.github/workflows/test-workflows.yml @@ -23,15 +23,19 @@ jobs: repository: n8n-io/test-workflows path: test-workflows - - uses: pnpm/action-setup@v2.2.4 + - uses: pnpm/action-setup@v2.4.0 with: - version: 8.6.1 + version: 8.6.12 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v3.8.1 with: node-version: 18.x - cache: 'pnpm' - cache-dependency-path: 'n8n/pnpm-lock.yaml' + + - name: Setup pnpm store cache + uses: actions/cache@v3.3.1 + with: + path: /github/home/.pnpm-store + key: pnpm-store-cache - name: Install dependencies run: | diff --git a/package.json b/package.json index c82a095bc3bcc..b3b6c795b166a 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "node": ">=18.10", "pnpm": ">=8.6" }, - "packageManager": "pnpm@8.6.1", + "packageManager": "pnpm@8.6.12", "scripts": { "preinstall": "node scripts/block-npm-install.js", "build": "turbo run build",