Skip to content

Commit

Permalink
Merge pull request #54 from plone/fixrelease
Browse files Browse the repository at this point in the history
Fix release I
  • Loading branch information
sneridagh authored May 3, 2024
2 parents 28496e4 + 667867a commit bfb2752
Show file tree
Hide file tree
Showing 14 changed files with 210 additions and 135 deletions.
26 changes: 25 additions & 1 deletion .github/workflows/backend-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,28 @@ on:
workflow_dispatch:

jobs:
meta:
runs-on: ubuntu-latest
outputs:
TAG: ${{ steps.vars.outputs.TAG }}
VOLTO_VERSION: ${{ steps.vars.outputs.VOLTO_VERSION }}
PLONE_VERSION: ${{ steps.vars.outputs.PLONE_VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set Env Vars
id: vars
run: |
echo "TAG=$(cat version.txt)" >> $GITHUB_OUTPUT
python3 -c 'import json; data = json.load(open("frontend/package.json")); print("VOLTO_VERSION=" + data["dependencies"]["@plone/volto"])' >> $GITHUB_OUTPUT
echo "PLONE_VERSION=$(cat backend/version.txt)" >> $GITHUB_OUTPUT
- name: Test vars
run: |
echo "TAG=${{ steps.vars.outputs.TAG }}"
echo "VOLTO_VERSION=${{ steps.vars.outputs.VOLTO_VERSION }}"
echo "PLONE_VERSION=${{ steps.vars.outputs.PLONE_VERSION }}"
black:
if: github.ref_type == 'branch'
runs-on: ubuntu-latest
Expand Down Expand Up @@ -96,7 +118,7 @@ jobs:
release:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
needs: [black, flake8, isort, zpretty, tests]
needs: [meta, black, flake8, isort, zpretty, tests]

steps:
- name: Checkout
Expand Down Expand Up @@ -131,6 +153,8 @@ jobs:
platforms: linux/amd64
context: backend
file: backend/Dockerfile
build-args: |
PLONE_VERSION=${{ needs.meta.outputs.PLONE_VERSION }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/codeanalysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ jobs:
- name: Checkout codebase
uses: actions/checkout@v3

- name: Install packages
run: make install

- name: Run Prettier
run: npx [email protected] --single-quote --check 'src/**/*.{js,jsx,ts,tsx,css,scss}' --config=package.json
run: yarn run prettier

i18n:
name: i18n sync
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/deploy-tag-release-live.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
runs-on: ubuntu-latest
outputs:
TAG: ${{ steps.vars.outputs.TAG }}
VOLTO_VERSION: ${{ steps.vars.outputs.VOLTO_VERSION }}
PLONE_VERSION: ${{ steps.vars.outputs.PLONE_VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -25,7 +27,13 @@ jobs:
id: vars
run: |
echo "TAG=$(cat version.txt)" >> $GITHUB_OUTPUT
python3 -c 'import json; data = json.load(open("frontend/package.json")); print("VOLTO_VERSION=" + data["dependencies"]["@plone/volto"])' >> $GITHUB_OUTPUT
echo "PLONE_VERSION=$(cat backend/version.txt)" >> $GITHUB_OUTPUT
- name: Test vars
run: |
echo "TAG=${{ steps.vars.outputs.TAG }}"
echo "VOLTO_VERSION=${{ steps.vars.outputs.VOLTO_VERSION }}"
echo "PLONE_VERSION=${{ steps.vars.outputs.PLONE_VERSION }}"
release-frontend:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -60,6 +68,8 @@ jobs:
platforms: linux/amd64
context: frontend
file: frontend/Dockerfile
build-args: |
VOLTO_VERSION=${{ needs.meta.outputs.VOLTO_VERSION }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down Expand Up @@ -100,6 +110,8 @@ jobs:
platforms: linux/amd64
context: backend
file: backend/Dockerfile
build-args: |
PLONE_VERSION=${{ needs.meta.outputs.PLONE_VERSION }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
35 changes: 32 additions & 3 deletions .github/workflows/frontend-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,37 @@ on:
- 'frontend/**'

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

defaults:
run:
working-directory: ./frontend

jobs:
meta:
runs-on: ubuntu-latest
outputs:
TAG: ${{ steps.vars.outputs.TAG }}
VOLTO_VERSION: ${{ steps.vars.outputs.VOLTO_VERSION }}
PLONE_VERSION: ${{ steps.vars.outputs.PLONE_VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set Env Vars
working-directory: "."
id: vars
run: |
echo "TAG=$(cat version.txt)" >> $GITHUB_OUTPUT
python3 -c 'import json; data = json.load(open("frontend/package.json")); print("VOLTO_VERSION=" + data["dependencies"]["@plone/volto"])' >> $GITHUB_OUTPUT
echo "PLONE_VERSION=$(cat backend/version.txt)" >> $GITHUB_OUTPUT
- name: Test vars
working-directory: "."
run: |
echo "TAG=${{ steps.vars.outputs.TAG }}"
echo "VOLTO_VERSION=${{ steps.vars.outputs.VOLTO_VERSION }}"
echo "PLONE_VERSION=${{ steps.vars.outputs.PLONE_VERSION }}"
eslint:
if: github.ref_type == 'branch'
runs-on: ubuntu-latest
Expand Down Expand Up @@ -41,8 +65,11 @@ jobs:
- name: Checkout codebase
uses: actions/checkout@v3

- name: Install packages
run: make install

- name: Run Prettier
run: npx [email protected] --single-quote --check 'src/**/*.{js,jsx,ts,tsx,css,scss}' --config=package.json
run: yarn run prettier

i18n:
if: github.ref_type == 'branch'
Expand Down Expand Up @@ -88,7 +115,7 @@ jobs:
release:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
needs: [eslint, prettier, i18n, unit]
needs: [meta, eslint, prettier, i18n, unit]

steps:
- name: Checkout
Expand Down Expand Up @@ -123,6 +150,8 @@ jobs:
platforms: linux/amd64
context: frontend/
file: frontend/Dockerfile
build-args: |
VOLTO_VERSION=${{ needs.meta.outputs.VOLTO_VERSION }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: $${{ steps.meta.outputs.labels }}
Expand Down
36 changes: 25 additions & 11 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
# syntax=docker/dockerfile:1
ARG PLONE_VERSION=6.0.10.1
FROM plone/plone-backend:${PLONE_VERSION}
ARG PLONE_VERSION
FROM plone/server-builder:${PLONE_VERSION:-6} as builder

LABEL maintainer="Simples Consultoria <[email protected]>" \
org.label-schema.name="plone.de-backend" \
org.label-schema.description="Simples Consultoria backend image." \
org.label-schema.vendor="Simples Consultoria"
WORKDIR /app

# Add local code
COPY . .

# Install local requirements and fix permissions
# Install local requirements and pre-compile mo files
RUN <<EOT
./bin/pip install mxdev
set -e
bin/pip install mxdev
mv requirements-docker.txt requirements.txt
./bin/mxdev -c mx.ini
./bin/pip install -r requirements-mxdev.txt
chown -R plone: /app
bin/mxdev -c mx.ini
bin/pip install -r requirements-mxdev.txt
bin/python /compile_mo.py
rm -Rf src/
EOT

FROM plone/server-prod-config:${PLONE_VERSION:-6}

LABEL maintainer="kitconcept GmbH <[email protected]>" \
org.label-schema.name="kitconcept.com-backend" \
org.label-schema.description="kitconcept website backend image." \
org.label-schema.vendor="kitconcept GmbH"

# Copy /app from builder
COPY --from=builder /app /app

RUN <<EOT
set -e
ln -s /data /app/var
EOT
5 changes: 5 additions & 0 deletions frontend/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
> 1%
last 4 versions
Firefox ESR
not ie 11
not dead
12 changes: 12 additions & 0 deletions frontend/.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"
}
}
]
}
23 changes: 23 additions & 0 deletions frontend/.stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": ["stylelint-config-idiomatic-order"],
"plugins": ["stylelint-prettier"],
"overrides": [
{
"files": ["**/*.less"],
"customSyntax": "postcss-less"
},
{
"files": ["**/*.overrides"],
"customSyntax": "postcss-less"
},
{
"files": ["**/*.scss"],
"customSyntax": "postcss-scss"
}
],
"rules": {
"prettier/prettier": true,
"order/properties-alphabetical-order": null
},
"ignoreFiles": "theme/themes/default/**/*.overrides"
}
49 changes: 15 additions & 34 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,20 @@
FROM node:16-slim as base
FROM base as builder
# syntax=docker/dockerfile:1
ARG VOLTO_VERSION
FROM plone/frontend-builder:${VOLTO_VERSION} as builder

RUN apt-get update \
&& buildDeps="python3 build-essential git ca-certificates" \
&& apt-get install -y --no-install-recommends $buildDeps \
&& rm -rf /var/lib/apt/lists/*
COPY --chown=node . /app/

COPY --chown=node .yarnrc.yml Makefile package.json mrs.developer.json jsconfig.json yarn.lock /build/
COPY --chown=node .yarn /build/.yarn
RUN corepack enable
USER node
WORKDIR /build
RUN <<EOT
make install
yarn build
rm -rf cache omelette .yarn/cache
EOT

RUN mkdir -p src/addons && make install
FROM plone/frontend-prod-config:${VOLTO_VERSION}

COPY --chown=node . /build/
RUN yarn build
LABEL maintainer="kitconcept GmbH <[email protected]>" \
org.label-schema.name="kitconcept.com-frontend" \
org.label-schema.description="kitconcept website frontend image." \
org.label-schema.vendor="kitconcept GmbH"


FROM base

LABEL maintainer="Jonas Piterek <[email protected]>" \
org.label-schema.name="plonede-frontend" \
org.label-schema.description="Plonede frontend image." \
org.label-schema.vendor="Jonas Piterek"

RUN apt-get update \
&& buildDeps="busybox" \
&& apt-get install -y --no-install-recommends $buildDeps \
&& busybox --install -s \
&& rm -rf /var/lib/apt/lists/*

USER node
COPY --from=builder /build/ /app/

WORKDIR /app
EXPOSE 3000
CMD ["yarn", "start:prod"]
COPY --from=builder /app/ /app/
12 changes: 6 additions & 6 deletions frontend/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# https://tech.davis-hansson.com/p/make/
SHELL:=bash
.ONESHELL:
.SHELLFLAGS:=-xeu -o pipefail -O inherit_errexit -c
.SHELLFLAGS:=-eu -o pipefail -c
.SILENT:
.DELETE_ON_ERROR:
MAKEFLAGS+=--warn-undefined-variables
MAKEFLAGS+=--no-builtin-rules
IMAGE_NAME=collective/jonasproject-frontend
IMAGE_NAME=ghcr.io/kitconcept/kitconcept.com-frontend
IMAGE_TAG=latest

NODEBIN = ./node_modules/.bin
Expand All @@ -21,7 +21,6 @@ help: ## This help message
.PHONY: clean
clean: ## Clean installation
@echo "Clean installation"
rm -Rf yarn.lock
rm -Rf node_modules

.PHONY: build
Expand All @@ -46,7 +45,7 @@ format-lint: ## Format Code with Lint
yarn run lint:fix

.PHONY: format
format: format-prettier format-stylelint format-lint ## Format the codebase according to our standards
format: format-prettier format-lint format-stylelint ## Format the codebase according to our standards

.PHONY: install
install: ## Install the frontend
Expand All @@ -61,7 +60,8 @@ preinstall: ## Preinstall task, checks if missdev (mrs-developer) is present and

.PHONY: develop
develop: ## Runs missdev in the local project (mrs.developer.json should be present)
npx -p mrs-developer missdev --config=jsconfig.json --output=addons --fetch-https
if [ -f $$(pwd)/jsconfig.json ]; then npx -p mrs-developer missdev --config=jsconfig.json --output=addons --fetch-https; fi
if [ ! -f $$(pwd)/jsconfig.json ]; then npx -p mrs-developer missdev --output=addons --fetch-https; fi

.PHONY: omelette
omelette: ## Creates the omelette folder that contains a link to the installed version of Volto (a softlink pointing to node_modules/@plone/volto)
Expand Down Expand Up @@ -90,7 +90,7 @@ storybook: ## Generate Storybook

.PHONY: build-image
build-image: ## Build Docker Image
@docker build . -t $(IMAGE_NAME):$(IMAGE_TAG) -f Dockerfile
@DOCKER_BUILDKIT=1 docker build . -t $(IMAGE_NAME):$(IMAGE_TAG) -f Dockerfile

# Acceptance tests

Expand Down
10 changes: 0 additions & 10 deletions frontend/jsconfig.json

This file was deleted.

Loading

0 comments on commit bfb2752

Please sign in to comment.