Skip to content

Commit

Permalink
Non-docker based standalone add-on setup (#17)
Browse files Browse the repository at this point in the history
* Checkpoint

* Checkpoint

* At last

* Fix CI

* Fix CI 2

* Updated lock

* Fix CI 3

* Fix tests

* Fix Cy tests

* Fix Cy tests

* Fix 2

* Fix 3

* Fix cy

* Fix cy 2

* Fix cy 3

* Fix cy 4

* Fix cy 4

* Add cypress to public hoist, try to run locally

* F*ck it

* F*ck it 2

* F*ck it 3

* F*ck it 4

* F*ck it 5

* Slight improvement

* Last touches

* remove no longer needed public-hoist-pattern

* Changelog

* Changelog

* improve gha

* Polishment, i18n and README

* Get back -ci server

* improve README
  • Loading branch information
sneridagh authored Mar 21, 2024
1 parent e0f68d9 commit a0791fc
Show file tree
Hide file tree
Showing 67 changed files with 34,002 additions and 10,115 deletions.
14 changes: 14 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
extends: './core/packages/volto/.eslintrc',
rules: {
'import/no-unresolved': 1,
},
settings: {
'import/resolver': {
alias: {
map: [['@plone/volto', './core/packages/volto/src']],
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
},
},
},
};
117 changes: 94 additions & 23 deletions .github/workflows/acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,112 @@ 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 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x

- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: 8
# We don't want to install until later,
# when the cache and Cypress are in place
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Install Cypress
- 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-20.x-${{ hashFiles('pnpm-lock.yaml') }}

- name: Install dependencies
run: |
cd acceptance
yarn
- name: "Cypress: Acceptance tests"
uses: cypress-io/github-action@v5
env:
BABEL_ENV: production
CYPRESS_RETRIES: 2
pnpm i
make install
pnpm i
- 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 start-test-acceptance-server-ci &
make start-test-acceptance-frontend &
# 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
# failure = exit-early or timeout

# working-directory: backend

- run: make test-acceptance-headless

# - name: "Cypress: Acceptance tests"
# uses: cypress-io/github-action@v6
# env:
# BABEL_ENV: production
# CYPRESS_RETRIES: 2
# with:
# # working-directory: core/packages/volto
# # project: ../../../.
# # config-file: ../../../cypress.config.js
# browser: chrome
# spec: cypress/tests/**/*.{js,jsx,ts,tsx}
# install: false
# start: |
# make start-test-acceptance-server-ci
# make start-test-acceptance-frontend
# wait-on: 'npx wait-on --httpTimeout 20000 http-get://localhost:55001/plone http://localhost:3000'

# 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
43 changes: 33 additions & 10 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,62 @@ on:
pull_request:
types: [assigned, opened, synchronize, reopened, labeled, unlabeled]
branches:
- master
- main

env:
node-version: 18.x
node-version: 20.x

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

- name: Use Node.js ${{ env.node-version }}
uses: actions/setup-node@v3
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: ${{ env.node-version }}
cache: 'yarn'
node-version: 20.x

- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: 8
# We don't want to install until later,
# when the cache and Cypress are in place
run_install: false

- 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: yarn
run: |
pnpm i
make install
pnpm i
- 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 master
towncrier check --compare-with origin/master
git fetch --no-tags origin main
towncrier check --compare-with origin/main
env:
BASE_BRANCH: ${{ github.base_ref }}
if: github.event_name == 'pull_request'
36 changes: 34 additions & 2 deletions .github/workflows/code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,43 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
node-version: [20.x]

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

- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x

- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: 8
# We don't want to install until later,
# when the cache and Cypress are in place
run_install: false

- 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: |
pnpm i
make install
pnpm i
- name: Linting
run: make lint
44 changes: 44 additions & 0 deletions .github/workflows/i18n.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: i18n
on: [push]
jobs:
unit:
runs-on: ubuntu-latest

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

- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x

- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: 8
# We don't want to install until later,
# when the cache and Cypress are in place
run_install: false

- 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: |
pnpm i
make install
pnpm i
- name: test i18n command
run: make i18n
37 changes: 33 additions & 4 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,42 @@ on: [push]
jobs:
unit:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]

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

- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x

- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: 8
# We don't want to install until later,
# when the cache and Cypress are in place
run_install: false

- 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: |
pnpm i
make install
pnpm i
- name: Unit tests
run: make test-ci
11 changes: 2 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
node_modules

# yarn 3
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
build
core
4 changes: 4 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
public-hoist-pattern[]=*eslint*
public-hoist-pattern[]=*prettier*
public-hoist-pattern[]=*stylelint*
public-hoist-pattern[]=*parcel*
12 changes: 12 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"trailingComma": "all",
"singleQuote": true,
"overrides": [
{
"files": "*.overrides",
"options": {
"parser": "less"
}
}
]
}
Loading

0 comments on commit a0791fc

Please sign in to comment.