Skip to content

Commit

Permalink
New setup in place
Browse files Browse the repository at this point in the history
  • Loading branch information
sneridagh committed Jul 4, 2024
1 parent d7221de commit f4492b2
Show file tree
Hide file tree
Showing 111 changed files with 35,744 additions and 16,732 deletions.
12 changes: 0 additions & 12 deletions .editorConfig

This file was deleted.

4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

78 changes: 38 additions & 40 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,43 @@
const fs = require('fs');
const projectRootPath = __dirname;
const AddonConfigurationRegistry = require('@plone/registry/src/addon-registry');

let coreLocation;
if (fs.existsSync(`${projectRootPath}/core`))
coreLocation = `${projectRootPath}/core`;
else if (fs.existsSync(`${projectRootPath}/../../core`))
coreLocation = `${projectRootPath}/../../core`;

const registry = new AddonConfigurationRegistry(
`${coreLocation}/packages/volto`,
);

// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
const addonAliases = Object.keys(registry.packages).map((o) => [
o,
registry.packages[o].modulePath,
]);

module.exports = {
extends: ['react-app', 'prettier', 'plugin:jsx-a11y/recommended'],
plugins: ['prettier', 'react-hooks', 'jsx-a11y'],
env: {
es6: true,
browser: true,
node: true,
mocha: true,
jasmine: true,
},
parser: '@babel/eslint-parser',
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true,
},
},
extends: `${coreLocation}/packages/volto/.eslintrc`,
rules: {
'import/no-unresolved': 0,
'no-alert': 1,
'no-console': 1,
'no-debugger': 1,
'prettier/prettier': ['error', { trailingComma: 'all', singleQuote: true }],
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'react/react-in-jsx-scope': 'off',
'import/no-unresolved': 1,
},
globals: {
root: true,
__DEVELOPMENT__: true,
__CLIENT__: true,
__SERVER__: true,
__DISABLE_SSR__: true,
__DEVTOOLS__: true,
__DEBUG__: true,
__SSR__: true,
__SENTRY__: true,
cy: true,
Cypress: true,
jest: true,
socket: true,
webpackIsomorphicTools: true,
settings: {
'import/resolver': {
alias: {
map: [
['@plone/volto', `${coreLocation}/packages/volto/src`],
['@plone/volto-slate', `${coreLocation}/packages/volto-slate/src`],
['@plone/registry', `${coreLocation}/packages/registry/src`],
[
'volto-form-block',
'./packages/volto-form-block/src',
],
...addonAliases,
],
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
},
},
},
};
102 changes: 102 additions & 0 deletions .github/workflows/acceptance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Acceptance tests
on:
push:
paths:
- "*.js"
- "*.json"
- "*.yaml"
- "cypress/**"
- "packages/**"
- ".github/workflows/acceptance.yml"

env:
NODE_VERSION: 20.x
CYPRESS_RETRIES: 2

jobs:

acceptance:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Enable corepack
run: corepack enable

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Cache Cypress Binary
id: cache-cypress-binary
uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: binary-${{ env.NODE_VERSION }}-${{ hashFiles('pnpm-lock.yaml') }}

- name: Install dependencies
run: make install

- name: Install Cypress if not in cache
if: steps.cache-cypress-binary.outputs.cache-hit != 'true'
working-directory: core/packages/volto
run: make cypress-install

- uses: JarvusInnovations/background-action@v1
name: Start Servers
with:
run: |
make ci-acceptance-backend-start &
make acceptance-frontend-prod-start &
# your step-level and job-level environment variables are available to your commands as-is
# npm install will count towards the wait-for timeout
# whenever possible, move unrelated scripts to a different step
# to background multiple processes: add & to the end of the command

wait-on: |
http-get://localhost:55001/plone
http://localhost:3000
# IMPORTANT: to use environment variables in wait-on, you must use this form: ${{ env.VAR }}
# See wait-on section below for all resource types and prefixes

tail: true # true = stderr,stdout
# This will allow you to monitor the progress live

log-output-resume: stderr
# Eliminates previosuly output stderr log entries from post-run output

wait-for: 10m

log-output: stderr,stdout # same as true

log-output-if: failure

- run: make ci-acceptance-test

# Upload Cypress screenshots
- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots-acceptance
path: acceptance/cypress/screenshots

# Upload Cypress videos
- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-videos-acceptance
path: acceptance/cypress/videos
58 changes: 58 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Changelog check
on:
pull_request:
types: [assigned, opened, synchronize, reopened, labeled, unlabeled]
branches:
- main

env:
NODE_VERSION: 20.x
ADDON_NAME: volto-form-block

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Fetch all history
fetch-depth: '0'

- name: Install pipx
run: pip install towncrier

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Enable corepack
run: corepack enable

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: |
make install
- name: Check for presence of a Change Log fragment (only pull requests)
run: |
# Fetch the pull request' base branch so towncrier will be able to
# compare the current branch with the base branch.
# Source: https://github.com/actions/checkout/#fetch-all-branches.
git fetch --no-tags origin ${BASE_BRANCH}
towncrier check --dir packages/${ADDON_NAME}
env:
BASE_BRANCH: ${{ github.base_ref }}
if: github.event_name == 'pull_request'
47 changes: 47 additions & 0 deletions .github/workflows/code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Code analysis checks
on:
push:
paths:
- "*.js"
- "*.json"
- "*.yaml"
- "packages/**"
- ".github/workflows/code.yml"

env:
NODE_VERSION: 20.x

jobs:
codeanalysis:
runs-on: ubuntu-latest

steps:
- name: Main checkout
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Enable corepack
run: corepack enable

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: make install

- name: Linting
run: make lint
47 changes: 47 additions & 0 deletions .github/workflows/i18n.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: i18n
on:
push:
paths:
- "*.js"
- "*.json"
- "*.yaml"
- "packages/**"
- ".github/workflows/i18n.yml"

env:
NODE_VERSION: 20.x

jobs:
unit:
runs-on: ubuntu-latest

steps:
- name: Main checkout
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Enable corepack
run: corepack enable

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: make install

- name: test i18n command
run: make i18n
Loading

0 comments on commit f4492b2

Please sign in to comment.