diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml index add6e858a36c2..fe2f3908a53cb 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -8,7 +8,7 @@ on: - synchronize branches: - '**' - - '!release/*' + - '!release/v**' jobs: check-pr-title: diff --git a/.github/workflows/check-tests.yml b/.github/workflows/check-tests.yml index 97f380974a172..7cd2849da8d8b 100644 --- a/.github/workflows/check-tests.yml +++ b/.github/workflows/check-tests.yml @@ -4,7 +4,7 @@ on: pull_request: branches: - '**' - - '!release/*' + - '!release/v**' pull_request_target: branches: - master diff --git a/.github/workflows/ci-master.yml b/.github/workflows/ci-master.yml index 5e828a702249a..77bce1a84cb6d 100644 --- a/.github/workflows/ci-master.yml +++ b/.github/workflows/ci-master.yml @@ -45,7 +45,7 @@ jobs: with: ref: ${{ inputs.branch }} nodeVersion: ${{ matrix.node-version }} - cacheKey: ${{ github.sha }}-base:build + cache-key: ${{ github.sha }}-base:build collectCoverage: ${{ matrix.node-version == '20.x' }} secrets: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} @@ -56,7 +56,7 @@ jobs: needs: install-and-build with: ref: ${{ inputs.branch }} - cacheKey: ${{ github.sha }}-base:build + cache-key: ${{ github.sha }}-base:build notify-on-failure: name: Notify Slack on failure diff --git a/.github/workflows/ci-postgres-mysql.yml b/.github/workflows/ci-postgres-mysql.yml index d5abf1fa2652f..4ded997ad4e45 100644 --- a/.github/workflows/ci-postgres-mysql.yml +++ b/.github/workflows/ci-postgres-mysql.yml @@ -9,10 +9,6 @@ on: - packages/cli/src/databases/** - .github/workflows/ci-postgres-mysql.yml -concurrency: - group: db-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - jobs: build: name: Install & Build @@ -38,113 +34,17 @@ jobs: path: ./packages/**/dist key: ${{ github.sha }}:db-tests - sqlite-pooled: - name: SQLite Pooled - runs-on: ubuntu-latest - needs: build - timeout-minutes: 20 - env: - DB_TYPE: sqlite - DB_SQLITE_POOL_SIZE: 4 - 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 }}:db-tests - - - name: Test SQLite Pooled - working-directory: packages/cli - run: pnpm jest - - mysql: - name: MySQL - runs-on: ubuntu-latest - needs: build - timeout-minutes: 20 - env: - DB_MYSQLDB_PASSWORD: password - 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 }}:db-tests - - - name: Start MySQL - uses: isbang/compose-action@v2.0.0 - with: - compose-file: ./.github/docker-compose.yml - services: | - mysql - - - name: Test MySQL - working-directory: packages/cli - run: pnpm test:mysql --testTimeout 20000 - - postgres: - name: Postgres - runs-on: ubuntu-latest + db-tests: + name: DB tests + uses: ./.github/workflows/db-tests-reusable.yml needs: build - timeout-minutes: 20 - env: - DB_POSTGRESDB_PASSWORD: password - DB_POSTGRESDB_POOL_SIZE: 1 # Detect connection pooling deadlocks - 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 }}:db-tests - - - name: Start Postgres - uses: isbang/compose-action@v2.0.0 - with: - compose-file: ./.github/docker-compose.yml - services: | - postgres - - - name: Test Postgres - working-directory: packages/cli - run: pnpm test:postgres + with: + cache-key: ${{ github.sha }}:db-tests notify-on-failure: name: Notify Slack on failure runs-on: ubuntu-latest - needs: [mysql, postgres] + needs: [db-tests] steps: - name: Notify Slack on failure uses: act10ns/slack@v2.0.0 diff --git a/.github/workflows/ci-pull-requests.yml b/.github/workflows/ci-pull-requests.yml index 78a5388950d51..5dce01c91fac2 100644 --- a/.github/workflows/ci-pull-requests.yml +++ b/.github/workflows/ci-pull-requests.yml @@ -1,6 +1,10 @@ name: Build, unit test and lint branch -on: [pull_request] +on: + pull_request: + branches: + - '**' + - '!release/v**' jobs: install-and-build: @@ -42,7 +46,7 @@ jobs: needs: install-and-build with: ref: refs/pull/${{ github.event.pull_request.number }}/merge - cacheKey: ${{ github.sha }}-base:build + cache-key: ${{ github.sha }}-base:build lint: name: Lint @@ -50,4 +54,4 @@ jobs: needs: install-and-build with: ref: refs/pull/${{ github.event.pull_request.number }}/merge - cacheKey: ${{ github.sha }}-base:build + cache-key: ${{ github.sha }}-base:build diff --git a/.github/workflows/db-tests-reusable.yml b/.github/workflows/db-tests-reusable.yml new file mode 100644 index 0000000000000..433caacde1872 --- /dev/null +++ b/.github/workflows/db-tests-reusable.yml @@ -0,0 +1,113 @@ +name: Reusable DB test workflow + +on: + workflow_call: + inputs: + cache-key: + description: Cache key for modules and build artifacts. + required: true + type: string + +jobs: + sqlite-pooled: + name: SQLite Pooled + runs-on: ubuntu-latest + needs: build + timeout-minutes: 20 + env: + DB_TYPE: sqlite + DB_SQLITE_POOL_SIZE: 4 + 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: ${{ inputs.cache-key }} + + - name: Test SQLite Pooled + working-directory: packages/cli + run: pnpm jest + + mysql: + name: MySQL + runs-on: ubuntu-latest + needs: build + timeout-minutes: 20 + env: + DB_MYSQLDB_PASSWORD: password + 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: ${{ inputs.cache-key }} + + - name: Start MySQL + uses: isbang/compose-action@v2.0.0 + with: + compose-file: ./.github/docker-compose.yml + services: | + mysql + + - name: Test MySQL + working-directory: packages/cli + run: pnpm test:mysql --testTimeout 20000 + + postgres: + name: Postgres + runs-on: ubuntu-latest + needs: build + timeout-minutes: 20 + env: + DB_POSTGRESDB_PASSWORD: password + DB_POSTGRESDB_POOL_SIZE: 1 # Detect connection pooling deadlocks + 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: ${{ inputs.cache-key }} + + - name: Start Postgres + uses: isbang/compose-action@v2.0.0 + with: + compose-file: ./.github/docker-compose.yml + services: | + postgres + + - name: Test Postgres + working-directory: packages/cli + run: pnpm test:postgres diff --git a/.github/workflows/docker-images.yml b/.github/workflows/docker-images.yml deleted file mode 100644 index fe5770252b214..0000000000000 --- a/.github/workflows/docker-images.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Docker Image CI - -on: - push: - tags: - - 'n8n@*' - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4.1.1 - - - name: Get the version - id: vars - run: echo ::set-output name=tag::$(echo ${GITHUB_REF:14}) - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3.0.0 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3.0.0 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3.0.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Login to DockerHub - uses: docker/login-action@v3.0.0 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Build - uses: docker/build-push-action@v5.1.0 - with: - context: ./docker/images/n8n - build-args: | - N8N_VERSION=${{ steps.vars.outputs.tag }} - platforms: linux/amd64,linux/arm64 - provenance: false - push: true - tags: | - ${{ secrets.DOCKER_USERNAME }}/n8n:${{ steps.vars.outputs.tag }} - ghcr.io/${{ github.repository_owner }}/n8n:${{ steps.vars.outputs.tag }} diff --git a/.github/workflows/linting-reusable.yml b/.github/workflows/linting-reusable.yml index 2650622bd04e4..7c5278810e054 100644 --- a/.github/workflows/linting-reusable.yml +++ b/.github/workflows/linting-reusable.yml @@ -8,7 +8,7 @@ on: required: false type: string default: master - cacheKey: + cache-key: description: Cache key for modules and build artifacts. required: false default: '' @@ -37,15 +37,15 @@ jobs: uses: rharkor/caching-for-turbo@v1.5 - name: Build - if: ${{ inputs.cacheKey == '' }} + if: ${{ inputs.cache-key == '' }} run: pnpm build - name: Restore cached build artifacts - if: ${{ inputs.cacheKey != '' }} + if: ${{ inputs.cache-key != '' }} uses: actions/cache/restore@v4.0.0 with: path: ./packages/**/dist - key: ${{ inputs.cacheKey }} + key: ${{ inputs.cache-key }} - name: Lint Backend run: pnpm lint:backend diff --git a/.github/workflows/release-create-pr.yml b/.github/workflows/release-create-pr.yml index a17fa1bf89984..19f095d0ca1b4 100644 --- a/.github/workflows/release-create-pr.yml +++ b/.github/workflows/release-create-pr.yml @@ -53,15 +53,16 @@ jobs: - name: Push the base branch run: | - git push -f origin refs/remotes/origin/${{ github.event.inputs.base-branch }}:refs/heads/release/${{ env.NEXT_RELEASE }} + git push -f origin refs/remotes/origin/${{ github.event.inputs.base-branch }}:refs/heads/release/v${{ env.NEXT_RELEASE }} - name: Push the release branch, and Create the PR - uses: peter-evans/create-pull-request@v5 + uses: peter-evans/create-pull-request@v6 with: - base: 'release/${{ env.NEXT_RELEASE }}' - branch: '${{ env.NEXT_RELEASE }}-pr' + token: ${{ secrets.RELEASE_PAT }} + base: 'release/v${{ env.NEXT_RELEASE }}' + branch: 'release-pr/v${{ env.NEXT_RELEASE }}' commit-message: ':rocket: Release ${{ env.NEXT_RELEASE }}' delete-branch: true - labels: 'release' + labels: release,release:${{ github.event.inputs.release-type }} title: ':rocket: Release ${{ env.NEXT_RELEASE }}' body-path: 'CHANGELOG-${{ env.NEXT_RELEASE }}.md' diff --git a/.github/workflows/release-pr-checks.yml b/.github/workflows/release-pr-checks.yml new file mode 100644 index 0000000000000..001921273c3c4 --- /dev/null +++ b/.github/workflows/release-pr-checks.yml @@ -0,0 +1,49 @@ +name: 'Release: PR Checks' + +on: + pull_request: + types: + - opened + branches: + - 'release/v**' + +jobs: + build: + name: Build + runs-on: ubuntu-latest + 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: Build + run: pnpm build + + - name: Run typecheck + run: pnpm typecheck + + - name: Cache build artifacts + uses: actions/cache/save@v4.0.0 + with: + path: ./packages/**/dist + key: ${{ github.sha }}-base:build + + db-tests: + name: DB tests + uses: ./.github/workflows/db-tests-reusable.yml + needs: build + with: + cache-key: ${{ github.sha }}-base:build + + e2e-tests: + name: E2E Tests + uses: ./.github/workflows/e2e-reusable.yml + needs: build + with: + cache-key: ${{ github.sha }}-base:build + secrets: + CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index 239c18b51223e..2a1defbe0a6e2 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -5,18 +5,14 @@ on: types: - closed branches: - - 'release/*' + - 'release/v**' jobs: - publish-release: + publish-to-npm: + name: Publish to NPM if: github.event.pull_request.merged == true runs-on: ubuntu-latest - - permissions: - contents: write - id-token: write - - timeout-minutes: 60 + timeout-minutes: 10 env: NPM_CONFIG_PROVENANCE: true @@ -51,6 +47,66 @@ jobs: pnpm publish -r --publish-branch ${{github.event.pull_request.base.ref}} --access public --tag rc --no-git-checks npm dist-tag rm n8n rc + publish-to-docker-hub: + name: Publish to DockerHub + needs: [publish-to-npm] + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Checkout + uses: actions/checkout@v4.1.1 + with: + fetch-depth: 0 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3.0.0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3.0.0 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3.0.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Login to DockerHub + uses: docker/login-action@v3.0.0 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Set release version in env + run: echo "RELEASE=$(node -e 'console.log(require("./package.json").version)')" >> $GITHUB_ENV + + - name: Build + uses: docker/build-push-action@v5.1.0 + with: + context: ./docker/images/n8n + build-args: | + N8N_VERSION=${{ env.RELEASE }} + platforms: linux/amd64,linux/arm64 + provenance: false + push: true + tags: | + ${{ secrets.DOCKER_USERNAME }}/n8n:${{ env.RELEASE }} + ghcr.io/${{ github.repository_owner }}/n8n:${{ env.RELEASE }} + + create-github-release: + name: Create a GitHub Release + needs: [publish-to-npm, publish-to-docker-hub] + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + timeout-minutes: 10 + + permissions: + contents: write + id-token: write + + steps: - name: Create a Release on GitHub uses: ncipollo/release-action@v1 with: diff --git a/.github/workflows/units-tests-reusable.yml b/.github/workflows/units-tests-reusable.yml index 1f64b2e27c6c3..6bed7c2fdcb89 100644 --- a/.github/workflows/units-tests-reusable.yml +++ b/.github/workflows/units-tests-reusable.yml @@ -13,7 +13,7 @@ on: required: false type: string default: 20.x - cacheKey: + cache-key: description: Cache key for modules and build artifacts. required: false default: '' @@ -54,15 +54,15 @@ jobs: uses: rharkor/caching-for-turbo@v1.5 - name: Build - if: ${{ inputs.cacheKey == '' }} + if: ${{ inputs.cache-key == '' }} run: pnpm build - name: Restore cached build artifacts - if: ${{ inputs.cacheKey != '' }} + if: ${{ inputs.cache-key != '' }} uses: actions/cache/restore@v4.0.0 with: path: ./packages/**/dist - key: ${{ inputs.cacheKey }} + key: ${{ inputs.cache-key }} - name: Test Backend run: pnpm test:backend