Skip to content

Commit 1e171e8

Browse files
committed
new setup
1 parent f127ca1 commit 1e171e8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1066
-14395
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.editorconfig

Lines changed: 0 additions & 36 deletions
This file was deleted.

.eslintignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.eslintrc

Lines changed: 0 additions & 48 deletions
This file was deleted.

.eslintrc.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
const fs = require('fs');
2+
const projectRootPath = __dirname;
3+
const AddonConfigurationRegistry = require('@plone/registry/src/addon-registry');
4+
5+
let coreLocation;
6+
if (fs.existsSync(`${projectRootPath}/core`))
7+
coreLocation = `${projectRootPath}/core`;
8+
else if (fs.existsSync(`${projectRootPath}/../../core`))
9+
coreLocation = `${projectRootPath}/../../core`;
10+
11+
const registry = new AddonConfigurationRegistry(
12+
`${coreLocation}/packages/volto`,
13+
);
14+
15+
// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
16+
const addonAliases = Object.keys(registry.packages).map((o) => [
17+
o,
18+
registry.packages[o].modulePath,
19+
]);
20+
21+
module.exports = {
22+
extends: `${coreLocation}/packages/volto/.eslintrc`,
23+
rules: {
24+
'import/no-unresolved': 1,
25+
},
26+
settings: {
27+
'import/resolver': {
28+
alias: {
29+
map: [
30+
['@plone/volto', `${coreLocation}/packages/volto/src`],
31+
[
32+
'@plone/volto-slate',
33+
`${coreLocation}/core/packages/volto-slate/src`,
34+
],
35+
['@plone/registry', `${coreLocation}/packages/registry/src`],
36+
[
37+
'@kitconcept/volto-highlight-block',
38+
'./packages/volto-highlight-block/src',
39+
],
40+
...addonAliases,
41+
],
42+
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
43+
},
44+
},
45+
},
46+
};

.github/workflows/acceptance.yml

Lines changed: 77 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,101 @@
11
name: Acceptance tests
2-
on: [push]
2+
on:
3+
push:
4+
paths:
5+
- "*.js"
6+
- "*.json"
7+
- "*.yaml"
8+
- "cypress/**"
9+
- "packages/**"
10+
- ".github/workflows/acceptance.yml"
311

412
env:
5-
ADDON_NAME: "@kitconcept/volto-highlight-block"
6-
ADDON_PATH: "volto-highlight-block"
7-
VOLTO_VERSION: "17.0.0-alpha.27"
13+
NODE_VERSION: 20.x
14+
CYPRESS_RETRIES: 2
815

916
jobs:
1017

1118
acceptance:
1219
runs-on: ubuntu-latest
1320
steps:
14-
- name: Checkout
15-
uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
1622

17-
- name: Set up Docker Buildx
18-
uses: docker/setup-buildx-action@v2
23+
- name: Use Node.js ${{ env.NODE_VERSION }}
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: ${{ env.NODE_VERSION }}
27+
28+
- name: Enable corepack
29+
run: corepack enable
1930

20-
- name: Install Cypress
31+
- name: Get pnpm store directory
32+
shell: bash
2133
run: |
22-
cd acceptance
23-
yarn
24-
25-
- name: "Cypress: Acceptance tests"
26-
uses: cypress-io/github-action@v5
27-
env:
28-
BABEL_ENV: production
29-
CYPRESS_RETRIES: 2
34+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
35+
36+
- uses: actions/cache@v4
37+
name: Setup pnpm cache
38+
with:
39+
path: ${{ env.STORE_PATH }}
40+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
41+
restore-keys: |
42+
${{ runner.os }}-pnpm-store-
43+
44+
- name: Cache Cypress Binary
45+
id: cache-cypress-binary
46+
uses: actions/cache@v4
47+
with:
48+
path: ~/.cache/Cypress
49+
key: binary-${{ env.NODE_VERSION }}-${{ hashFiles('pnpm-lock.yaml') }}
50+
51+
- name: Install dependencies
52+
run: make install
53+
54+
- name: Install Cypress if not in cache
55+
if: steps.cache-cypress-binary.outputs.cache-hit != 'true'
56+
working-directory: core/packages/volto
57+
run: make cypress-install
58+
59+
- uses: JarvusInnovations/background-action@v1
60+
name: Start Servers
3061
with:
31-
parallel: false
32-
browser: chrome
33-
working-directory: acceptance
34-
spec: cypress/tests/*.js
35-
install: false
36-
start: |
37-
docker compose -f ci.yml --profile prod up
38-
wait-on: 'npx wait-on --httpTimeout 20000 http-get://localhost:55001/plone http://localhost:3000'
62+
run: |
63+
make ci-acceptance-backend-start &
64+
make acceptance-frontend-prod-start &
65+
# your step-level and job-level environment variables are available to your commands as-is
66+
# npm install will count towards the wait-for timeout
67+
# whenever possible, move unrelated scripts to a different step
68+
# to background multiple processes: add & to the end of the command
69+
70+
wait-on: |
71+
http-get://localhost:55001/plone
72+
http://localhost:3000
73+
# IMPORTANT: to use environment variables in wait-on, you must use this form: ${{ env.VAR }}
74+
# See wait-on section below for all resource types and prefixes
75+
76+
tail: true # true = stderr,stdout
77+
# This will allow you to monitor the progress live
78+
79+
log-output-resume: stderr
80+
# Eliminates previosuly output stderr log entries from post-run output
81+
82+
wait-for: 10m
83+
84+
log-output: stderr,stdout # same as true
85+
86+
log-output-if: failure
87+
88+
- run: make ci-acceptance-test
3989

4090
# Upload Cypress screenshots
41-
- uses: actions/upload-artifact@v3
91+
- uses: actions/upload-artifact@v4
4292
if: failure()
4393
with:
4494
name: cypress-screenshots-acceptance
4595
path: acceptance/cypress/screenshots
4696

4797
# Upload Cypress videos
48-
- uses: actions/upload-artifact@v3
98+
- uses: actions/upload-artifact@v4
4999
if: failure()
50100
with:
51101
name: cypress-videos-acceptance

.github/workflows/changelog.yml

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,53 @@ on:
66
- main
77

88
env:
9-
node-version: 16.x
9+
NODE_VERSION: 20.x
10+
ADDON_NAME: volto-highlight-block
1011

1112
jobs:
1213
build:
1314
runs-on: ubuntu-latest
1415
steps:
15-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1617
with:
1718
# Fetch all history
1819
fetch-depth: '0'
1920

2021
- name: Install pipx
2122
run: pip install towncrier
2223

23-
# node setup
24-
- name: Use Node.js ${{ env.node-version }}
25-
uses: actions/setup-node@v3
24+
- name: Use Node.js
25+
uses: actions/setup-node@v4
2626
with:
27-
node-version: ${{ env.node-version }}
28-
cache: 'yarn'
27+
node-version: ${{ env.NODE_VERSION }}
28+
29+
- name: Enable corepack
30+
run: corepack enable
31+
32+
- name: Get pnpm store directory
33+
shell: bash
34+
run: |
35+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
36+
37+
- uses: actions/cache@v4
38+
name: Setup pnpm cache
39+
with:
40+
path: ${{ env.STORE_PATH }}
41+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
42+
restore-keys: |
43+
${{ runner.os }}-pnpm-store-
2944
30-
# node install
3145
- name: Install dependencies
32-
run: yarn
46+
run: |
47+
make install
3348
3449
- name: Check for presence of a Change Log fragment (only pull requests)
3550
run: |
3651
# Fetch the pull request' base branch so towncrier will be able to
3752
# compare the current branch with the base branch.
3853
# Source: https://github.com/actions/checkout/#fetch-all-branches.
39-
git fetch --no-tags origin main
40-
towncrier check --compare-with origin/main
54+
git fetch --no-tags origin ${BASE_BRANCH}
55+
towncrier check --dir packages/${ADDON_NAME}
4156
env:
4257
BASE_BRANCH: ${{ github.base_ref }}
4358
if: github.event_name == 'pull_request'

.github/workflows/code.yml

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,47 @@
11
name: Code analysis checks
2-
on: [push]
2+
on:
3+
push:
4+
paths:
5+
- "*.js"
6+
- "*.json"
7+
- "*.yaml"
8+
- "packages/**"
9+
- ".github/workflows/code.yml"
10+
11+
env:
12+
NODE_VERSION: 20.x
13+
314
jobs:
415
codeanalysis:
516
runs-on: ubuntu-latest
6-
strategy:
7-
matrix:
8-
node-version: [18.x]
917

1018
steps:
1119
- name: Main checkout
12-
uses: actions/checkout@v3
20+
uses: actions/checkout@v4
21+
22+
- name: Use Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: ${{ env.NODE_VERSION }}
26+
27+
- name: Enable corepack
28+
run: corepack enable
29+
30+
- name: Get pnpm store directory
31+
shell: bash
32+
run: |
33+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
34+
35+
- uses: actions/cache@v4
36+
name: Setup pnpm cache
37+
with:
38+
path: ${{ env.STORE_PATH }}
39+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
40+
restore-keys: |
41+
${{ runner.os }}-pnpm-store-
42+
43+
- name: Install dependencies
44+
run: make install
1345

1446
- name: Linting
1547
run: make lint

0 commit comments

Comments
 (0)