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 #109

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 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
12 changes: 0 additions & 12 deletions .editorConfig

This file was deleted.

35 changes: 35 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

# EditorConfig Configurtaion file, for more details see:
# https://EditorConfig.org
# EditorConfig is a convention description, that could be interpreted
# by multiple editors to enforce common coding conventions for specific
# file types

# top-most EditorConfig file:
# Will ignore other EditorConfig files in Home directory or upper tree level.
root = true


[*] # For All Files
# Unix-style newlines with a newline ending every file
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
# Set default charset
charset = utf-8
# Indent style default
indent_style = space

[*.{py,cfg,ini}]
# 4 space indentation
indent_size = 4

[*.{html,dtml,pt,zpt,xml,zcml,js,json,ts,less,css,sass,yml,yaml}]
# 2 space indentation
indent_size = 2

[{Makefile,.gitmodules}]
# Tab indentation (no size specified, but view as 4 spaces)
indent_style = tab
indent_size = unset
tab_width = unset
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

45 changes: 0 additions & 45 deletions .eslintrc.js

This file was deleted.

158 changes: 158 additions & 0 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
name: Backend CI

on:
push:
paths:
- "backend/**"
- ".github/workflows/backend.yml"
workflow_dispatch:

env:
IMAGE_NAME_PREFIX: ghcr.io/collective/volto-form-block
IMAGE_NAME_SUFFIX: backend
PYTHON_VERSION: "3.11"

jobs:

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

- name: Set Env Vars
id: vars
run: |
echo "PLONE_VERSION=$(cat backend/version.txt)" >> $GITHUB_OUTPUT

black:
runs-on: ubuntu-latest
steps:
- name: Checkout codebase
uses: actions/checkout@v4

- name: Run check
uses: plone/code-analysis-action@v2
with:
base_dir: 'backend'
check: 'black'

flake8:
runs-on: ubuntu-latest
steps:
- name: Checkout codebase
uses: actions/checkout@v4

- name: Run check
uses: plone/code-analysis-action@v2
with:
base_dir: 'backend'
check: 'flake8'

isort:
runs-on: ubuntu-latest
steps:
- name: Checkout codebase
uses: actions/checkout@v4

- name: Run check
uses: plone/code-analysis-action@v2
with:
base_dir: 'backend'
check: 'isort'

zpretty:
runs-on: ubuntu-latest
steps:
- name: Checkout codebase
uses: actions/checkout@v4

- name: Run check
uses: plone/code-analysis-action@v2
with:
base_dir: 'backend'
check: 'zpretty'

tests:
runs-on: ubuntu-latest
needs:
- meta
defaults:
run:
working-directory: ./backend

steps:
- uses: actions/checkout@v4

- name: Setup Plone ${{ needs.meta.outputs.PLONE_VERSION }} with Python ${{ env.PYTHON_VERSION }}
uses: plone/[email protected]
with:
python-version: ${{ env.PYTHON_VERSION }}
plone-version: ${{ needs.meta.outputs.PLONE_VERSION }}

- name: Install package
run: |
pip install mxdev
mxdev -c mx.ini
pip install -r requirements-mxdev.txt

- name: Run tests
run: |
pytest --disable-warnings src/collective.voltoformblock/tests

release:
runs-on: ubuntu-latest
needs:
- black
- flake8
- isort
- zpretty
- tests
permissions:
contents: read
packages: write

steps:

- name: Checkout
uses: actions/checkout@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.IMAGE_NAME_PREFIX }}-${{ env.IMAGE_NAME_SUFFIX }}
labels: |
org.label-schema.docker.cmd=docker run -d -p 8080:8080 ${{ env.IMAGE_NAME_PREFIX }}-${{ env.IMAGE_NAME_SUFFIX }}:latest
flavor:
latest=false
tags: |
type=ref,event=branch
type=sha
type=raw,value=latest,enable={{is_default_branch}}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
context: backend
file: backend/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Loading
Loading