Skip to content

Merge pull request #739 from contember/fix/binding-reset-tree-id #2793

Merge pull request #739 from contember/fix/binding-reset-tree-id

Merge pull request #739 from contember/fix/binding-reset-tree-id #2793

Workflow file for this run

name: CI
on:
push:
branches: ['main']
tags: ['**']
pull_request:
paths-ignore:
- docs/**
workflow_dispatch:
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- job_name: eslint
run_script: yarn run eslint:lint
- job_name: build
run_script: yarn run build
- job_name: test
run_script: yarn run test
- job_name: api-exporter
run_script: |
yarn run ts:build
yarn run ae:test
- job_name: lint-imports
run_script: yarn tsx ./scripts/lint/module-import-linter.ts
- job_name: dedupe
run_script: yarn dedupe --check
container: node:20-alpine
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get yarn cache directory path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
id: yarn-cache-dir-path
- name: Install GNU tar
run: apk add --no-cache tar
- name: Set up yarn cache
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install yarn deps
run: |
yarn --version
yarn install --immutable
- name: Run ${{ matrix.job_name }}
run: ${{ matrix.run_script }}
playwright:
if: false
needs: [ test ]
runs-on: ubuntu-latest
container: mcr.microsoft.com/playwright:v1.40.1-focal
services:
postgres:
image: postgres:13-alpine
env:
POSTGRES_PASSWORD: 'contember'
POSTGRES_USER: 'contember'
POSTGRES_DB: 'contember'
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
contember-engine:
image: contember/engine:1.4.0-beta.1
env:
NODE_ENV: 'development'
CONTEMBER_PORT: '4000'
CONTEMBER_ROOT_EMAIL: 'superadmin@localhost'
CONTEMBER_ROOT_PASSWORD: 'superadmin@localhost'
CONTEMBER_ROOT_TOKEN: '0000000000000000000000000000000000000000'
CONTEMBER_LOGIN_TOKEN: '1111111111111111111111111111111111111111'
CONTEMBER_ENCRYPTION_KEY: '0000000000000000000000000000000000000000000000000000000000000000'
DEFAULT_DB_HOST: 'postgres'
DEFAULT_DB_PORT: '5432'
DEFAULT_DB_USER: 'contember'
DEFAULT_DB_PASSWORD: 'contember'
TENANT_DB_NAME: 'contember'
DEFAULT_S3_ENDPOINT: 'http://minio:9000'
DEFAULT_S3_PROVIDER: 'minio'
DEFAULT_S3_REGION: ''
DEFAULT_S3_BUCKET: 'contember'
DEFAULT_S3_PREFIX: 'data'
DEFAULT_S3_KEY: 'contember'
DEFAULT_S3_SECRET: 'contember'
minio:
image: bitnami/minio
env:
MINIO_ROOT_USER: 'contember'
MINIO_ROOT_PASSWORD: 'contember'
MINIO_DEFAULT_BUCKETS: 'contember:download'
env:
VITE_CONTEMBER_ADMIN_API_BASE_URL: 'http://contember-engine:4000'
VITE_CONTEMBER_ADMIN_SESSION_TOKEN: '0000000000000000000000000000000000000000'
HOME: '/root'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Set up yarn cache
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install yarn deps
run: |
yarn --version
yarn install --immutable
- name: Prepare for playwright tests
run: |
yarn run admin:pw:build
- name: Run playwright tests
run: yarn run admin:pw:test --forbid-only
- uses: jakejarvis/s3-sync-action@master
if: always()
with:
args: --acl public-read
env:
AWS_S3_BUCKET: 'contember-admin'
AWS_ACCESS_KEY_ID: ${{ secrets.PLAYWRIGHT_S3_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.PLAYWRIGHT_S3_SECRET }}
AWS_S3_ENDPOINT: 'https://fra1.digitaloceanspaces.com'
SOURCE_DIR: 'packages/admin/tests/playwright/report'
DEST_DIR: ${{ github.sha }}
- uses: phulsechinmay/[email protected]
if: always() && github.event_name == 'pull_request'
with:
message: '[Playwright Test Report](https://contember-admin.fra1.digitaloceanspaces.com/${{ github.sha }}/index.html)'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-npm:
if: github.event_name == 'push' && github.ref_type == 'tag'
needs: [test]
runs-on: ubuntu-latest
container: node:20-alpine
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Install GNU tar
run: apk add --no-cache tar
- name: Set up yarn cache
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Extract version from tag
run: echo "PACKAGE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
- name: Install yarn deps
run: |
yarn --version
yarn install --immutable
- name: Build
run: yarn run build
- name: Publish
run: |
yarn config set npmAuthToken "$NPM_TOKEN"
yarn workspaces foreach -t version "${GITHUB_REF:11}"
# Extract the npm-tag from package.json
NPM_TAG=$(sed -n 's/.*"npm-tag": "\(.*\)",/\1/p' package.json)
if [ -z "$NPM_TAG" ]; then
echo "npm-tag not found in package.json"
exit 1
fi
# Use the extracted npm-tag in the npm publish command
yarn workspaces foreach -pt --no-private npm publish --tag $NPM_TAG --access public