Skip to content

Commit 490da0d

Browse files
authored
Reorganize repository to use new Volto add-on format based on cookiecutter-volto (#23)
1 parent dc9b657 commit 490da0d

File tree

90 files changed

+30429
-3017
lines changed

Some content is hidden

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

90 files changed

+30429
-3017
lines changed

.eslintrc.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module.exports = {
2+
extends: './core/packages/volto/.eslintrc',
3+
rules: {
4+
'import/no-unresolved': 1,
5+
},
6+
settings: {
7+
'import/resolver': {
8+
alias: {
9+
map: [
10+
['@plone/volto', './core/packages/volto/src'],
11+
['@plone/volto-slate', './core/packages/volto-slate/src'],
12+
['@plone/registry', './core/packages/registry/src'],
13+
[
14+
'@plonegovbr/volto-code-block',
15+
'./packages/volto-code-block/src',
16+
],
17+
],
18+
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
19+
},
20+
},
21+
},
22+
};

.github/workflows/acceptance.yml

Lines changed: 81 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,105 @@
11
name: Acceptance tests
2-
on: [push]
2+
on:
3+
push:
4+
paths:
5+
- "*.js"
6+
- "*.json"
7+
- "*.yaml"
8+
- "cypress/**"
9+
- "packages/**"
310

411
env:
5-
ADDON_NAME: "@plonegovbr/volto-code-block"
6-
ADDON_PATH: "volto-code-block"
7-
VOLTO_VERSION: "17"
12+
NODE_VERSION: 20.x
13+
CYPRESS_RETRIES: 2
814

915
jobs:
1016

1117
acceptance:
1218
runs-on: ubuntu-latest
1319
steps:
14-
- name: Checkout
15-
uses: actions/checkout@v4
20+
- uses: actions/checkout@v4
1621

17-
- name: Set up Docker Buildx
18-
uses: docker/setup-buildx-action@v3
22+
- name: Use Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: ${{ env.NODE_VERSION }}
26+
27+
- uses: pnpm/action-setup@v3
28+
name: Install pnpm
29+
with:
30+
version: 8
31+
# We don't want to install until later,
32+
# when the cache and Cypress are in place
33+
run_install: false
1934

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

3994
# Upload Cypress screenshots
40-
- uses: actions/upload-artifact@v3
95+
- uses: actions/upload-artifact@v4
4196
if: failure()
4297
with:
4398
name: cypress-screenshots-acceptance
4499
path: acceptance/cypress/screenshots
45100

46101
# Upload Cypress videos
47-
- uses: actions/upload-artifact@v3
102+
- uses: actions/upload-artifact@v4
48103
if: failure()
49104
with:
50105
name: cypress-videos-acceptance

.github/workflows/changelog.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Changelog check
2+
on:
3+
pull_request:
4+
types: [assigned, opened, synchronize, reopened, labeled, unlabeled]
5+
branches:
6+
- main
7+
8+
env:
9+
NODE_VERSION: 20.x
10+
ADDON_NAME: volto-code-block
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
# Fetch all history
19+
fetch-depth: '0'
20+
21+
- name: Install pipx
22+
run: pip install towncrier
23+
24+
- name: Use Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: ${{ env.NODE_VERSION }}
28+
29+
- uses: pnpm/action-setup@v3
30+
name: Install pnpm
31+
with:
32+
version: 8
33+
# We don't want to install until later,
34+
# when the cache and Cypress are in place
35+
run_install: false
36+
37+
- name: Get pnpm store directory
38+
shell: bash
39+
run: |
40+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
41+
42+
- uses: actions/cache@v4
43+
name: Setup pnpm cache
44+
with:
45+
path: ${{ env.STORE_PATH }}
46+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
47+
restore-keys: |
48+
${{ runner.os }}-pnpm-store-
49+
50+
- name: Install dependencies
51+
run: |
52+
make install
53+
54+
- name: Check for presence of a Change Log fragment (only pull requests)
55+
run: |
56+
# Fetch the pull request' base branch so towncrier will be able to
57+
# compare the current branch with the base branch.
58+
# Source: https://github.com/actions/checkout/#fetch-all-branches.
59+
git fetch --no-tags origin ${BASE_BRANCH}
60+
towncrier check --dir packages/${ADDON_NAME}
61+
env:
62+
BASE_BRANCH: ${{ github.base_ref }}
63+
if: github.event_name == 'pull_request'

.github/workflows/code.yml

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
name: Code analysis checks
2-
on: [push]
2+
on:
3+
push:
4+
paths:
5+
- "*.js"
6+
- "*.json"
7+
- "*.yaml"
8+
- "packages/**"
9+
10+
env:
11+
NODE_VERSION: 20.x
12+
313
jobs:
414
codeanalysis:
515
runs-on: ubuntu-latest
@@ -8,5 +18,34 @@ jobs:
818
- name: Main checkout
919
uses: actions/checkout@v4
1020

21+
- name: Use Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: ${{ env.NODE_VERSION }}
25+
26+
- uses: pnpm/action-setup@v3
27+
name: Install pnpm
28+
with:
29+
version: 8
30+
# We don't want to install until later,
31+
# when the cache is in place
32+
run_install: false
33+
34+
- name: Get pnpm store directory
35+
shell: bash
36+
run: |
37+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
38+
39+
- uses: actions/cache@v4
40+
name: Setup pnpm cache
41+
with:
42+
path: ${{ env.STORE_PATH }}
43+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
44+
restore-keys: |
45+
${{ runner.os }}-pnpm-store-
46+
47+
- name: Install dependencies
48+
run: make install
49+
1150
- name: Linting
1251
run: make lint

.github/workflows/i18n.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: i18n
2+
on:
3+
push:
4+
paths:
5+
- "*.js"
6+
- "*.json"
7+
- "*.yaml"
8+
- "packages/**"
9+
10+
env:
11+
NODE_VERSION: 20.x
12+
13+
jobs:
14+
unit:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Main checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Use Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: ${{ env.NODE_VERSION }}
25+
26+
- uses: pnpm/action-setup@v3
27+
name: Install pnpm
28+
with:
29+
version: 8
30+
# We don't want to install until later,
31+
# when the cache and Cypress are in place
32+
run_install: false
33+
34+
- name: Get pnpm store directory
35+
shell: bash
36+
run: |
37+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
38+
39+
- uses: actions/cache@v4
40+
name: Setup pnpm cache
41+
with:
42+
path: ${{ env.STORE_PATH }}
43+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
44+
restore-keys: |
45+
${{ runner.os }}-pnpm-store-
46+
47+
- name: Install dependencies
48+
run: make install
49+
50+
- name: test i18n command
51+
run: make i18n

.github/workflows/storybook.yml

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
name: Storybook
22
on:
33
push:
4-
branches:
5-
- main
4+
paths:
5+
- "*.js"
6+
- "*.json"
7+
- "*.yaml"
8+
- "packages/**"
9+
- ".github/workflows/storybook.yml"
10+
11+
env:
12+
NODE_VERSION: 20.x
613

714
jobs:
815
build-and-deploy:
@@ -11,14 +18,42 @@ jobs:
1118
- name: Checkout
1219
uses: actions/checkout@v4
1320

21+
- name: Use Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: ${{ env.NODE_VERSION }}
25+
26+
- uses: pnpm/action-setup@v3
27+
name: Install pnpm
28+
with:
29+
version: 8
30+
# We don't want to install until later,
31+
# when the cache and Cypress are in place
32+
run_install: false
33+
34+
- name: Get pnpm store directory
35+
shell: bash
36+
run: |
37+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
38+
39+
- uses: actions/cache@v4
40+
name: Setup pnpm cache
41+
with:
42+
path: ${{ env.STORE_PATH }}
43+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
44+
restore-keys: |
45+
${{ runner.os }}-pnpm-store-
46+
47+
- name: Install dependencies
48+
run: make install
49+
1450
- name: Generate Storybook
1551
run: |
16-
mkdir -p .storybook
17-
chmod -R 777 .storybook
18-
make build-storybook
52+
make storybook-build
1953
2054
- name: Deploy to GitHub pages
2155
uses: JamesIves/github-pages-deploy-action@v4
56+
if: ${{ github.ref == 'refs/heads/main' }}
2257
with:
2358
branch: gh-pages
24-
folder: .storybook
59+
folder: .storybook-build

0 commit comments

Comments
 (0)