Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New setup #16

Merged
merged 3 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const fs = require('fs');
const projectRootPath = __dirname;

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

module.exports = {
extends: `${coreLocation}/packages/volto/.eslintrc`,
rules: {
'import/no-unresolved': 1,
},
settings: {
'import/resolver': {
alias: {
map: [
['@plone/volto', `${coreLocation}/packages/volto/src`],
[
'@plone/volto-slate',
`${coreLocation}/core/packages/volto-slate/src`,
],
['@plone/registry', `${coreLocation}/packages/registry/src`],
[
'@kitconcept/volto-separator-block',
'./packages/volto-separator-block/src',
],
],
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
},
},
},
};
103 changes: 76 additions & 27 deletions .github/workflows/acceptance.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,100 @@
name: Acceptance tests
on: [push]
on:
push:
paths:
- "*.js"
- "*.json"
- "*.yml"
- "cypress/**"
- "packages/**"

env:
ADDON_NAME: "@kitconcept/volto-separator-block"
ADDON_PATH: "volto-separator-block"
VOLTO_VERSION: "16"
NODE_VERSION: 20.x
CYPRESS_RETRIES: 2

jobs:

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

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Enable corepack
run: corepack enable

- name: Install Cypress
- name: Get pnpm store directory
shell: bash
run: |
cd acceptance
yarn

- name: "Cypress: Acceptance tests"
uses: cypress-io/github-action@v5
env:
BABEL_ENV: production
CYPRESS_RETRIES: 2
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:
parallel: false
browser: chrome
working-directory: acceptance
spec: cypress/tests/*.js
install: false
start: |
docker compose -f ci.yml --profile prod up
wait-on: 'npx wait-on --httpTimeout 20000 http-get://localhost:55001/plone http://localhost:3000'
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 test-acceptance-headless

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

# Upload Cypress videos
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-videos-acceptance
Expand Down
37 changes: 26 additions & 11 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,53 @@ on:
- main

env:
node-version: 16.x
NODE_VERSION: 20.x
ADDON_NAME: volto-separator-block

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

- name: Install pipx
run: pip install towncrier

# node setup
- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@v3
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}
cache: 'yarn'
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-

# node install
- name: Install dependencies
run: yarn
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 main
towncrier check --compare-with origin/main
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'
42 changes: 36 additions & 6 deletions .github/workflows/code.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,46 @@
name: Code analysis checks
on: [push]
on:
push:
paths:
- "*.js"
- "*.json"
- "*.yml"
- "packages/**"

env:
NODE_VERSION: 20.x

jobs:
codeanalysis:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
python-version: [3.8]

steps:
- name: Main checkout
uses: actions/checkout@v3
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
46 changes: 46 additions & 0 deletions .github/workflows/i18n.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: i18n
on:
push:
paths:
- "*.js"
- "*.json"
- "*.yml"
- "packages/**"

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
57 changes: 57 additions & 0 deletions .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Storybook
on:
push:
paths:
- "*.js"
- "*.json"
- "*.yml"
- "packages/**"
- ".github/workflows/storybook.yml"

env:
NODE_VERSION: 20.x

permissions:
contents: write

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: 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: Generate Storybook
run: |
make storybook-build

- name: Deploy to GitHub pages
uses: JamesIves/github-pages-deploy-action@v4
if: ${{ github.ref == 'refs/heads/main' }}
with:
branch: gh-pages
folder: .storybook-build
Loading