Skip to content

chore(repo): Back-merge master into minor #5375

chore(repo): Back-merge master into minor

chore(repo): Back-merge master into minor #5375

name: Build & Test
on:
workflow_dispatch:
push:
branches:
- master
- minor
- major
paths:
- 'packages/**'
- 'package.json'
- 'package-lock.json'
pull_request:
branches:
- master
- major
- minor
paths:
- 'packages/**'
- 'package.json'
- 'package-lock.json'
env:
CI: true
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
# NOTE: The Elasticsearch and Redis service definitions are duplicated across the e2e-* jobs
# because GitHub Actions does not support YAML anchors or service definition reuse.
# When updating these services (version bumps, env changes, health checks), update ALL four copies:
# e2e-sqljs, e2e-mariadb, e2e-mysql, e2e-postgres.
jobs:
codegen:
uses: ./.github/workflows/codegen.yml
build:
name: build
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Build
run: npm run build
unit-tests:
name: unit tests
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
node: [20.x, 22.x, 24.x]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
node-version: ${{ matrix.node }}
- name: Build
run: npx lerna run ci
- name: Unit tests
run: npm run test
dashboard-changes:
name: check dashboard changes
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
changed: ${{ steps.check.outputs.changed }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for dashboard changes
id: check
run: |
base="${{ github.event.pull_request.base.sha }}"
if [ -z "$base" ]; then base="${{ github.event.before }}"; fi
if [ -z "$base" ]; then base="HEAD~1"; fi
if git diff --name-only "$base" HEAD | grep -q '^packages/dashboard/'; then
echo "changed=true" >> "$GITHUB_OUTPUT"
else
echo "changed=false" >> "$GITHUB_OUTPUT"
fi
dashboard-e2e:
name: dashboard e2e
needs: dashboard-changes
if: needs.dashboard-changes.outputs.changed == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Build
run: npx lerna run ci
- name: Cache Playwright browsers
id: playwright-cache
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: Install Playwright browsers
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npx playwright install chromium
working-directory: packages/dashboard
- name: Install Playwright system deps
run: npx playwright install-deps chromium
working-directory: packages/dashboard
- name: Dashboard e2e tests
run: npm run e2e:pw
working-directory: packages/dashboard
e2e-sqljs:
name: e2e (sqljs)
runs-on: ubuntu-latest
permissions:
contents: read
services:
elastic:
image: docker.elastic.co/elasticsearch/elasticsearch:9.1.0
env:
node.name: es
cluster.name: es-docker-cluster
xpack.security.enabled: false
xpack.security.http.ssl.enabled: false
xpack.security.transport.ssl.enabled: false
xpack.license.self_generated.type: basic
discovery.type: single-node
bootstrap.memory_lock: true
ES_JAVA_OPTS: -Xms512m -Xmx512m
# Elasticsearch will force read-only mode when total available disk space is less than 5%. Since we will
# be running on a shared Azure instance with 84GB SSD, we easily go below 5% available even when there are still
# > 3GB free. So we set this value to an absolute one rather than a percentage to prevent all the Elasticsearch
# e2e tests from failing.
cluster.routing.allocation.disk.watermark.low: 500mb
cluster.routing.allocation.disk.watermark.high: 200mb
cluster.routing.allocation.disk.watermark.flood_stage: 100mb
ports:
- 9200
options: --health-cmd="curl --silent --fail localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=3
redis:
image: redis:7.4.1
ports:
- 6379
strategy:
fail-fast: false
matrix:
node: ${{ github.event_name == 'pull_request' && fromJSON('["22.x"]') || fromJSON('["20.x", "22.x", "24.x"]') }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
node-version: ${{ matrix.node }}
- name: Build
run: npx lerna run ci
- name: e2e tests
env:
E2E_ELASTIC_PORT: ${{ job.services.elastic.ports['9200'] }}
E2E_REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
DB: sqljs
run: npm run e2e
e2e-mariadb:
name: e2e (mariadb)
runs-on: ubuntu-latest
permissions:
contents: read
services:
mariadb:
# With v11.6.2+, a default was changed, (https://mariadb.com/kb/en/innodb-system-variables/#innodb_snapshot_isolation)
# which causes e2e test failures currently
image: mariadb:11.5
env:
MARIADB_ROOT_PASSWORD: password
ports:
- 3306
options: --health-cmd="mariadb-admin ping -h localhost -u vendure -ppassword" --health-interval=10s --health-timeout=5s --health-retries=3
elastic:
image: docker.elastic.co/elasticsearch/elasticsearch:9.1.0
env:
node.name: es
cluster.name: es-docker-cluster
xpack.security.enabled: false
xpack.security.http.ssl.enabled: false
xpack.security.transport.ssl.enabled: false
xpack.license.self_generated.type: basic
discovery.type: single-node
bootstrap.memory_lock: true
ES_JAVA_OPTS: -Xms512m -Xmx512m
cluster.routing.allocation.disk.watermark.low: 500mb
cluster.routing.allocation.disk.watermark.high: 200mb
cluster.routing.allocation.disk.watermark.flood_stage: 100mb
ports:
- 9200
options: --health-cmd="curl --silent --fail localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=3
redis:
image: redis:7.4.1
ports:
- 6379
strategy:
fail-fast: false
matrix:
node: ${{ github.event_name == 'pull_request' && fromJSON('["22.x"]') || fromJSON('["20.x", "22.x", "24.x"]') }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
node-version: ${{ matrix.node }}
- name: Build
run: npx lerna run ci
- name: e2e tests
env:
E2E_MARIADB_PORT: ${{ job.services.mariadb.ports['3306'] }}
E2E_ELASTIC_PORT: ${{ job.services.elastic.ports['9200'] }}
E2E_REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
DB: mariadb
run: npm run e2e
e2e-mysql:
name: e2e (mysql)
runs-on: ubuntu-latest
permissions:
contents: read
services:
mysql:
image: vendure/mysql-8-native-auth:latest
env:
MYSQL_ROOT_PASSWORD: password
ports:
- 3306
options: --health-cmd="mysqladmin ping --silent" --health-interval=10s --health-timeout=20s --health-retries=10
elastic:
image: docker.elastic.co/elasticsearch/elasticsearch:9.1.0
env:
node.name: es
cluster.name: es-docker-cluster
xpack.security.enabled: false
xpack.security.http.ssl.enabled: false
xpack.security.transport.ssl.enabled: false
xpack.license.self_generated.type: basic
discovery.type: single-node
bootstrap.memory_lock: true
ES_JAVA_OPTS: -Xms512m -Xmx512m
cluster.routing.allocation.disk.watermark.low: 500mb
cluster.routing.allocation.disk.watermark.high: 200mb
cluster.routing.allocation.disk.watermark.flood_stage: 100mb
ports:
- 9200
options: --health-cmd="curl --silent --fail localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=3
redis:
image: redis:7.4.1
ports:
- 6379
strategy:
fail-fast: false
matrix:
node: ${{ github.event_name == 'pull_request' && fromJSON('["22.x"]') || fromJSON('["20.x", "22.x", "24.x"]') }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
node-version: ${{ matrix.node }}
- name: Build
run: npx lerna run ci
- name: e2e tests
env:
E2E_MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }}
E2E_ELASTIC_PORT: ${{ job.services.elastic.ports['9200'] }}
E2E_REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
DB: mysql
run: npm run e2e
e2e-postgres:
name: e2e (postgres)
runs-on: ubuntu-latest
permissions:
contents: read
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: vendure
POSTGRES_PASSWORD: password
ports:
- 5432
options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3
elastic:
image: docker.elastic.co/elasticsearch/elasticsearch:9.1.0
env:
node.name: es
cluster.name: es-docker-cluster
xpack.security.enabled: false
xpack.security.http.ssl.enabled: false
xpack.security.transport.ssl.enabled: false
xpack.license.self_generated.type: basic
discovery.type: single-node
bootstrap.memory_lock: true
ES_JAVA_OPTS: -Xms512m -Xmx512m
cluster.routing.allocation.disk.watermark.low: 500mb
cluster.routing.allocation.disk.watermark.high: 200mb
cluster.routing.allocation.disk.watermark.flood_stage: 100mb
ports:
- 9200
options: --health-cmd="curl --silent --fail localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=3
redis:
image: redis:7.4.1
ports:
- 6379
strategy:
fail-fast: false
matrix:
node: ${{ github.event_name == 'pull_request' && fromJSON('["22.x"]') || fromJSON('["20.x", "22.x", "24.x"]') }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
node-version: ${{ matrix.node }}
- name: Build
run: npx lerna run ci
- name: e2e tests
env:
E2E_POSTGRES_PORT: ${{ job.services.postgres.ports['5432'] }}
E2E_ELASTIC_PORT: ${{ job.services.elastic.ports['9200'] }}
E2E_REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
DB: postgres
run: npm run e2e