Skip to content

Commit 280dc89

Browse files
authored
Refactor repository (#5)
* Refactor repository * Fix changelog * GHA: Fix varnish workflow * GHA: Minor fixes * GHA: Update stack-name * GHA: Fix trigger for main workflow * GHA: Update config * GHA: Update config * Update docker-compose-dev.yml * Fix docker image creation * Docker: Remove Varnish and purger * Upgrade plonegovbr.socialmedia / @plonegovbr/volto-social-media * remove need for multilingual support * Update example content * Atualiza componentes, refatora css
1 parent fd07d04 commit 280dc89

File tree

190 files changed

+14804
-8827
lines changed

Some content is hidden

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

190 files changed

+14804
-8827
lines changed

.github/workflows/backend.yml

Lines changed: 60 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -1,158 +1,73 @@
11
name: Backend CI
22

33
on:
4-
push:
5-
paths:
6-
- "backend/**"
7-
- ".github/workflows/backend.yml"
8-
workflow_dispatch:
9-
10-
env:
11-
IMAGE_NAME_PREFIX: ghcr.io/pythonbrasil/pybr25-site
12-
IMAGE_NAME_SUFFIX: backend
13-
PYTHON_VERSION: "3.11"
4+
workflow_call:
5+
inputs:
6+
base-tag:
7+
required: true
8+
type: string
9+
image-name-prefix:
10+
required: true
11+
type: string
12+
image-name-suffix:
13+
required: true
14+
type: string
15+
python-version:
16+
required: true
17+
type: string
18+
plone-version:
19+
required: true
20+
type: string
21+
working-directory:
22+
required: false
23+
type: string
24+
default: backend
1425

1526
jobs:
1627

17-
meta:
18-
runs-on: ubuntu-latest
19-
outputs:
20-
PLONE_VERSION: ${{ steps.vars.outputs.PLONE_VERSION }}
21-
steps:
22-
- name: Checkout
23-
uses: actions/checkout@v4
24-
25-
- name: Set Env Vars
26-
id: vars
27-
run: |
28-
echo "PLONE_VERSION=$(cat backend/version.txt)" >> $GITHUB_OUTPUT
29-
30-
black:
31-
runs-on: ubuntu-latest
32-
steps:
33-
- name: Checkout codebase
34-
uses: actions/checkout@v4
35-
36-
- name: Run check
37-
uses: plone/code-analysis-action@v2
38-
with:
39-
base_dir: 'backend'
40-
check: 'black'
41-
42-
flake8:
43-
runs-on: ubuntu-latest
44-
steps:
45-
- name: Checkout codebase
46-
uses: actions/checkout@v4
47-
48-
- name: Run check
49-
uses: plone/code-analysis-action@v2
50-
with:
51-
base_dir: 'backend'
52-
check: 'flake8'
53-
54-
isort:
55-
runs-on: ubuntu-latest
56-
steps:
57-
- name: Checkout codebase
58-
uses: actions/checkout@v4
59-
60-
- name: Run check
61-
uses: plone/code-analysis-action@v2
62-
with:
63-
base_dir: 'backend'
64-
check: 'isort'
65-
66-
zpretty:
67-
runs-on: ubuntu-latest
68-
steps:
69-
- name: Checkout codebase
70-
uses: actions/checkout@v4
71-
72-
- name: Run check
73-
uses: plone/code-analysis-action@v2
74-
with:
75-
base_dir: 'backend'
76-
check: 'zpretty'
77-
78-
tests:
79-
runs-on: ubuntu-latest
28+
lint:
29+
name: "Backend: Lint"
30+
uses: plone/meta/.github/workflows/[email protected]
31+
with:
32+
python-version: ${{ inputs.python-version }}
33+
plone-version: ${{ inputs.plone-version }}
34+
working-directory: ${{ inputs.working-directory }}
35+
36+
test:
37+
name: "Backend: Test"
38+
uses: plone/meta/.github/workflows/[email protected]
39+
with:
40+
python-version: ${{ inputs.python-version }}
41+
plone-version: ${{ inputs.plone-version }}
42+
working-directory: ${{ inputs.working-directory }}
43+
44+
coverage:
45+
name: "Backend: Test"
46+
uses: plone/meta/.github/workflows/[email protected]
8047
needs:
81-
- meta
82-
defaults:
83-
run:
84-
working-directory: ./backend
85-
86-
steps:
87-
- uses: actions/checkout@v4
88-
89-
- name: Setup Plone ${{ needs.meta.outputs.PLONE_VERSION }} with Python ${{ env.PYTHON_VERSION }}
90-
uses: plone/[email protected]
91-
with:
92-
python-version: ${{ env.PYTHON_VERSION }}
93-
plone-version: ${{ needs.meta.outputs.PLONE_VERSION }}
94-
95-
- name: Install package
96-
run: |
97-
pip install mxdev
98-
mxdev -c mx.ini
99-
pip install -r requirements-mxdev.txt
100-
101-
- name: Run tests
102-
run: |
103-
pytest --disable-warnings tests
48+
- test
49+
with:
50+
python-version: ${{ inputs.python-version }}
51+
plone-version: ${{ inputs.plone-version }}
52+
working-directory: ${{ inputs.working-directory }}
10453

10554
release:
106-
runs-on: ubuntu-latest
55+
name: "Backend: Build and publish Container Image"
56+
uses: plone/meta/.github/workflows/[email protected]
10757
needs:
108-
- black
109-
- flake8
110-
- isort
111-
- zpretty
112-
- tests
58+
- lint
59+
- coverage
11360
permissions:
11461
contents: read
11562
packages: write
116-
117-
steps:
118-
119-
- name: Checkout
120-
uses: actions/checkout@v4
121-
122-
- name: Docker meta
123-
id: meta
124-
uses: docker/metadata-action@v5
125-
with:
126-
images: |
127-
${{ env.IMAGE_NAME_PREFIX }}-${{ env.IMAGE_NAME_SUFFIX }}
128-
labels: |
129-
org.label-schema.docker.cmd=docker run -d -p 8080:8080 ${{ env.IMAGE_NAME_PREFIX }}-${{ env.IMAGE_NAME_SUFFIX }}:latest
130-
flavor:
131-
latest=false
132-
tags: |
133-
type=ref,event=branch
134-
type=sha
135-
type=raw,value=latest,enable={{is_default_branch}}
136-
137-
- name: Set up QEMU
138-
uses: docker/setup-qemu-action@v3
139-
140-
- name: Set up Docker Buildx
141-
uses: docker/setup-buildx-action@v3
142-
143-
- name: Login to Container Registry
144-
uses: docker/login-action@v3
145-
with:
146-
registry: ghcr.io
147-
username: ${{ github.actor }}
148-
password: ${{ secrets.GITHUB_TOKEN }}
149-
150-
- name: Build and push
151-
uses: docker/build-push-action@v5
152-
with:
153-
platforms: linux/amd64
154-
context: backend
155-
file: backend/Dockerfile
156-
push: ${{ github.event_name != 'pull_request' }}
157-
tags: ${{ steps.meta.outputs.tags }}
158-
labels: ${{ steps.meta.outputs.labels }}
63+
with:
64+
base-tag: ${{ inputs.base-tag }}
65+
image-name-prefix: ${{ inputs.image-name-prefix }}
66+
image-name-suffix: ${{ inputs.image-name-suffix }}
67+
working-directory: ${{ inputs.working-directory }}
68+
build-args: |
69+
PLONE_VERSION=${{ inputs.plone-version }}
70+
push: ${{ github.event_name != 'pull_request' }}
71+
secrets:
72+
username: ${{ github.actor }}
73+
password: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/changelog.yml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: Changelog
2+
on:
3+
pull_request:
4+
types: [assigned, opened, synchronize, reopened, labeled, unlabeled]
5+
branches:
6+
- main
7+
8+
env:
9+
NODE_VERSION: 22.x
10+
ADDON_NAME: volto-pythonbrasil-site
11+
BASE_BRANCH: main
12+
13+
jobs:
14+
config:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
backend: ${{ steps.filter.outputs.backend }}
18+
frontend: ${{ steps.filter.outputs.frontend }}
19+
repository: ${{ steps.filter.outputs.repository }}
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- uses: dorny/[email protected]
25+
id: filter
26+
with:
27+
filters: |
28+
backend:
29+
- 'backend/**'
30+
repository:
31+
- '.github/**'
32+
- '.vscode/**'
33+
- 'devops/**'
34+
- 'docs/**'
35+
- 'docker-compose.yml'
36+
- 'README.md'
37+
frontend:
38+
- 'frontend/**'
39+
40+
backend:
41+
if: ${{ needs.config.outputs.backend == 'true' }}
42+
runs-on: ubuntu-latest
43+
needs:
44+
- config
45+
steps:
46+
- uses: actions/checkout@v4
47+
with:
48+
# Fetch all history
49+
fetch-depth: '0'
50+
51+
- name: Install pipx
52+
run: pip install towncrier
53+
54+
- name: Check for presence of a Change Log fragment (only pull requests)
55+
if: github.event_name == 'pull_request'
56+
run: |
57+
# Fetch the pull request' base branch so towncrier will be able to
58+
# compare the current branch with the base branch.
59+
# Source: https://github.com/actions/checkout/#fetch-all-branches.
60+
git fetch --no-tags origin ${BASE_BRANCH}
61+
towncrier check --compare-with origin/${{ env.BASE_BRANCH }} --config backend/pyproject.toml --dir backend/
62+
63+
frontend:
64+
if: ${{ needs.config.outputs.frontend == 'true' }}
65+
runs-on: ubuntu-latest
66+
needs:
67+
- config
68+
defaults:
69+
run:
70+
working-directory: ./frontend
71+
steps:
72+
- uses: actions/checkout@v4
73+
with:
74+
# Fetch all history
75+
fetch-depth: '0'
76+
77+
- name: Install pipx
78+
run: pip install towncrier
79+
80+
- name: Use Node.js ${{ env.NODE_VERSION }}
81+
uses: actions/setup-node@v4
82+
with:
83+
node-version: ${{ env.NODE_VERSION }}
84+
85+
- name: Enable corepack
86+
run: npm i -g corepack@latest && corepack enable
87+
88+
- name: Get pnpm store directory
89+
shell: bash
90+
run: |
91+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
92+
93+
- uses: actions/cache@v4
94+
name: Setup pnpm cache
95+
with:
96+
path: ${{ env.STORE_PATH }}
97+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
98+
restore-keys: |
99+
${{ runner.os }}-pnpm-store-
100+
101+
- name: Install dependencies
102+
run: make install
103+
104+
- name: Check for presence of a Change Log fragment (only pull requests)
105+
if: github.event_name == 'pull_request'
106+
run: |
107+
# Fetch the pull request' base branch so towncrier will be able to
108+
# compare the current branch with the base branch.
109+
# Source: https://github.com/actions/checkout/#fetch-all-branches.
110+
git fetch --no-tags origin ${BASE_BRANCH}
111+
cd ..
112+
towncrier check --compare-with origin/${{ env.BASE_BRANCH }} --config frontend/packages/${{ env.ADDON_NAME }}/towncrier.toml --dir frontend/packages/${{ env.ADDON_NAME }}
113+
114+
repository:
115+
if: ${{ needs.config.outputs.repository == 'true' }}
116+
runs-on: ubuntu-latest
117+
needs:
118+
- config
119+
steps:
120+
- uses: actions/checkout@v4
121+
with:
122+
# Fetch all history
123+
fetch-depth: '0'
124+
125+
- name: Install pipx
126+
run: pip install towncrier
127+
128+
- name: Check for presence of a Change Log fragment (only pull requests)
129+
if: github.event_name == 'pull_request'
130+
run: |
131+
# Fetch the pull request' base branch so towncrier will be able to
132+
# compare the current branch with the base branch.
133+
# Source: https://github.com/actions/checkout/#fetch-all-branches.
134+
git fetch --no-tags origin ${BASE_BRANCH}
135+
towncrier check --compare-with origin/${{ env.BASE_BRANCH }} --config towncrier.toml --dir .

0 commit comments

Comments
 (0)