Skip to content

Commit 00ecdfb

Browse files
authored
Merge branch 'cms-dev:master' into master
2 parents 9f8496d + c87fea7 commit 00ecdfb

File tree

121 files changed

+8146
-8139
lines changed

Some content is hidden

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

121 files changed

+8146
-8139
lines changed

.dockerignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.dockerignore
2+
Dockerfile
3+
docker-compose*.yml
4+
.vagrant/
5+
codecov/
6+
.dev/

.github/CONTRIBUTING.md

+27-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
11
# Contributing and pull request process
22

3-
To contribute, please send an email to [email protected], or ping us on gitter with what you plan to do (unless uncontroversial and/or small), so that we can agree on the best way to implement it.
4-
5-
We appreciate small commits that do one thing, but also that, when possible, each commit doesn't break the master branch. Please use your best judgement for the size of the commit according to these guidelines. If a commit breaks master, we at least require to push together all commits until master is fixed.
6-
7-
We also appreciate a tidy history, so after you write all your code, consider tidying up the commits to reflect what you did at the end, which is usually a simplified version of the process that you followed to reach the final state. Moreover, each commit should not have PEP 8 or pyflakes warnings (see below for how to make sure you don't introduce any).
8-
9-
If your change involves more than one commit, please create a PR for each of them, unless for very small and obvious commits (read: fixing typos, comments, a few obvious lines), or unless some commit breaks master.
10-
11-
During the review, please address all comments by creating one or more 'fixup' commits on top of the branch (no forced push). At the end, either you or one of the owners can squash appropriately the fixups.
3+
To contribute, please send an email to [email protected], or
4+
ping us on [Telegram](https://t.me/contestms) with what you plan to do (unless
5+
uncontroversial and/or small), so that we can agree on the best way to implement
6+
it.
7+
8+
We appreciate small commits that do one thing, but also that, when possible,
9+
each commit doesn't break the master branch. Please use your best judgement for
10+
the size of the commit according to these guidelines. If a commit breaks master,
11+
we at least require to push together all commits until master is fixed.
12+
13+
We also appreciate a tidy history, so after you write all your code, consider
14+
tidying up the commits to reflect what you did at the end, which is usually a
15+
simplified version of the process that you followed to reach the final state.
16+
Moreover, each commit should not have PEP 8 or pyflakes warnings (see below for
17+
how to make sure you don't introduce any).
18+
19+
If your change involves more than one commit, please create a PR for each of
20+
them, unless for very small and obvious commits (read: fixing typos, comments, a
21+
few obvious lines), or unless some commit breaks master.
22+
23+
During the review, please address all comments by creating one or more 'fixup'
24+
commits on top of the branch (no forced push). At the end, either you or one of
25+
the owners can squash appropriately the fixups.
1226

1327
# Code style
1428

@@ -17,9 +31,11 @@ For Python code, we generally follow [PEP 8](https://www.python.org/dev/peps/pep
1731
We get around Python flexible type system in several ways:
1832
* we try to avoid "magic" (e.g., generating or changing classes on the fly);
1933
* we are fairly verbose with naming, trying to help the reader with following the types;
20-
* we follow our type annotation system for method and function docstrings (planning to switch to [PEP 484](https://www.python.org/dev/peps/pep-0484/)); see later for the format.
34+
* we follow our type annotation system for method and function docstrings
35+
(planning to switch to [PEP 484](https://www.python.org/dev/peps/pep-0484/));
36+
see later for the format.
2137

22-
We support Python 3 only, requiring at least version 3.8.
38+
We support Python 3 only, requiring at least version 3.9.
2339

2440
# Docstring type annotation format
2541

.github/ISSUE_TEMPLATE/Bug_report.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ about: Create a report to help us improve
99
Sorry to hear you have trouble with CMS!
1010

1111
We use GitHub's issues to track bugs and sometimes feature requests. If you're just looking for help with CMS, there are better channels:
12-
* the [gitter chat](https://gitter.im/cms-dev/cms) (currently where you are more likely to get support quickly);
12+
* the [Telegram chat](https://t.me/contestms), where you are more likely to get support quickly;
1313
* the mailing list <[email protected]>.
1414

1515
If instead you have found a possible bug, please go ahead filing the issue using the following template. Feel free to remove non-relevant information.
@@ -28,13 +28,11 @@ If instead you have found a possible bug, please go ahead filing the issue using
2828

2929
### Logs
3030

31-
[Please attach relevant logs of the component(s) that caused the problem; you can find them in /var/local/log/cms/ (if CMS was running
32-
installed) or in ./log (if it was running from the local copy).]
31+
[Please attach relevant logs of the component(s) that caused the problem; you can find them in /var/local/log/cms/.]
3332

3433
### System Information
3534

3635
**CMS version:** [master, or a specific version]
37-
**Was CMS installed:** [yes or no]
38-
**Using a virtualenv:** [yes or no]
36+
**How was CMS installed:** [virtualenv, docker, ...?]
3937
**Postgres version:** [if relevant]
4038
**Distribution and version:** [if relevant]

.github/SUPPORT.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,20 @@ To learn how to install and use CMS, please read the **documentation**,
44
available at <https://cms.readthedocs.org/>.
55

66
If you have questions or need help troubleshooting some problem,
7-
contact us in the **chat** at [gitter](https://gitter.im/cms-dev/cms),
7+
contact us in the **chat** on [Telegram](https://t.me/contestms),
88
or write on the **support mailing list**
99
<[email protected]>, where no registration is required
1010
(you can see the archives on
1111
[Google Groups](https://groups.google.com/forum/#!forum/contestms-support)).
1212

1313
To help with the troubleshooting, you can upload on some online
1414
pastebin the relevant **log files**, that you can find in
15-
/var/local/log/cms/ (if CMS was running installed) or in ./log (if it
16-
was running from the local copy).
15+
`/var/local/log/cms/`.
1716

1817
If you encountered a bug, please file an
1918
[issue](https://github.com/cms-dev/cms/issues) on **GitHub** following
2019
the instructions in the issue template.
2120

2221
**Please don't file issues to ask for help**, we are happy to help
23-
on the mailing list or on gitter, and it is more likely somebody will
22+
on the mailing list or on Telegram, and it is more likely somebody will
2423
answer your query sooner.

.github/codecov.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
threshold: 1%

.github/dependabot.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Please see the documentation for all configuration options:
2+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
3+
4+
version: 2
5+
updates:
6+
- package-ecosystem: "pip"
7+
directory: "/"
8+
schedule:
9+
interval: "daily"
10+
open-pull-requests-limit: 30

.github/workflows/main.yml

+28-63
Original file line numberDiff line numberDiff line change
@@ -6,80 +6,45 @@ on:
66

77
jobs:
88
test:
9-
runs-on: ubuntu-20.04
10-
11-
services:
12-
postgres:
13-
image: postgres:12
14-
env:
15-
POSTGRES_PASSWORD: postgres
16-
options: >-
17-
--health-cmd pg_isready
18-
--health-interval 10s
19-
--health-timeout 5s
20-
--health-retries 5
21-
ports:
22-
- 5432:5432
9+
runs-on: ubuntu-22.04
2310

2411
steps:
2512
- uses: actions/checkout@v2
2613
with:
2714
submodules: true
2815

29-
- uses: actions/setup-python@v2
30-
with:
31-
python-version: 3.8
32-
33-
- name: Install dependencies
16+
- name: Check available cgroups
3417
run: |
35-
sudo apt-get update -y
36-
sudo apt-get install -y \
37-
build-essential \
38-
php7.4-cli \
39-
haskell-platform \
40-
fp-compiler \
41-
python2.7 \
42-
cppreference-doc-en-html \
43-
cgroup-lite \
44-
libcap-dev \
45-
python-dev \
46-
libpq-dev \
47-
libcups2-dev \
48-
libyaml-dev \
49-
rustc \
50-
mono-mcs
18+
mount | grep cgroup
5119
52-
- name: Install requirements
20+
- name: Build docker image
5321
run: |
54-
# Use distutils from the standard library for 2to3 translation
55-
export SETUPTOOLS_USE_DISTUTILS="stdlib"
56-
57-
pip install -U pip setuptools wheel
58-
pip install -r requirements.txt
59-
pip install -r dev-requirements.txt
22+
docker compose -p cms -f docker-compose.test.yml build testcms
6023
61-
sudo $(which python) prerequisites.py -y --cmsuser=$USER install
62-
python setup.py install
63-
64-
- name: Set up database
65-
env:
66-
PGPASSWORD: postgres
24+
- name: Run tests
6725
run: |
68-
psql --host=localhost --username=postgres --command="CREATE USER cmsuser WITH PASSWORD 'your_password_here';"
69-
70-
createdb --host=localhost --username=postgres --owner=cmsuser cmsdb
71-
psql --host=localhost --username=postgres --dbname=cmsdb --command='ALTER SCHEMA public OWNER TO cmsuser'
72-
psql --host=localhost --username=postgres --dbname=cmsdb --command='GRANT SELECT ON pg_largeobject TO cmsuser'
26+
docker compose -p cms -f docker-compose.test.yml run --rm testcms
7327
74-
createdb --host=localhost --username=postgres --owner=cmsuser cmsdbfortesting
75-
psql --host=localhost --username=postgres --dbname=cmsdbfortesting --command='ALTER SCHEMA public OWNER TO cmsuser'
76-
psql --host=localhost --username=postgres --dbname=cmsdbfortesting --command='GRANT SELECT ON pg_largeobject TO cmsuser'
77-
78-
cp ./config/cms.conf.sample ./config/cms.conf
79-
sed -e "s/\"cmsuser\": \"cmsuser\"/\"cmsuser\": \"$USER\"/" -i ./config/cms.conf
28+
- name: Upload test results to Codecov
29+
if: ${{ !cancelled() }}
30+
uses: codecov/test-results-action@v1
31+
with:
32+
files: ./codecov/junit.xml
33+
flags: unittests
34+
token: ${{ secrets.CODECOV_TOKEN }}
8035

81-
cmsInitDB
36+
- name: Upload unit test coverage results to Codecov
37+
uses: codecov/codecov-action@v4
38+
if: ${{ !cancelled() }}
39+
with:
40+
files: ./codecov/unittests.xml
41+
flags: unittests
42+
token: ${{ secrets.CODECOV_TOKEN }}
8243

83-
- name: Run tests
84-
run: |
85-
cmsRunTests -v --coverage --codecov
44+
- name: Upload functional test coverage results to Codecov
45+
uses: codecov/codecov-action@v4
46+
if: ${{ !cancelled() }}
47+
with:
48+
files: ./codecov/functionaltests.xml
49+
flags: functionaltests
50+
token: ${{ secrets.CODECOV_TOKEN }}

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*~
2+
.DS_Store
23
*.mo
34
.*.sw?
45
*.pyc
@@ -11,3 +12,6 @@ cms.egg-info
1112
cache/
1213
lib/
1314
log/
15+
.vagrant/
16+
codecov/
17+
.dev/

.readthedocs.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Read the Docs configuration file for Sphinx projects
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
# Required
5+
version: 2
6+
7+
build:
8+
os: ubuntu-22.04
9+
tools:
10+
python: "3.12"
11+
12+
sphinx:
13+
configuration: docs/conf.py

.vscode/extensions.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"recommendations": [
3+
// Auto-format Python code with Ruff linter
4+
"charliermarsh.ruff",
5+
// To apply settings from .editorconfig file
6+
"editorconfig.editorconfig",
7+
// Python intellisense support
8+
"ms-python.python",
9+
// Python language server and type checker
10+
"ms-python.vscode-pylance",
11+
]
12+
}

.vscode/settings.json

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"python.analysis.typeCheckingMode": "basic",
3+
"files.insertFinalNewline": true,
4+
"editor.formatOnSave": true,
5+
"editor.formatOnSaveMode": "modifications",
6+
"[python]": {
7+
"editor.defaultFormatter": "charliermarsh.ruff",
8+
},
9+
"[jsonc]": {
10+
"editor.defaultFormatter": "vscode.json-language-features",
11+
},
12+
"[javascript]": {
13+
"editor.defaultFormatter": "vscode.typescript-language-features",
14+
},
15+
"[css]": {
16+
"editor.defaultFormatter": "vscode.css-language-features",
17+
},
18+
"[html]": {
19+
// Doesn't work properly with template files, for example with things
20+
// like {{ url("page") }} becoming {{ url(" page") }}
21+
"editor.formatOnSave": false,
22+
},
23+
}

Dockerfile

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# syntax=docker/dockerfile:1
2+
FROM ubuntu:24.04
3+
4+
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
5+
build-essential \
6+
cgroup-lite \
7+
cppreference-doc-en-html \
8+
fp-compiler \
9+
git \
10+
ghc \
11+
libcap-dev \
12+
libcups2-dev \
13+
libffi-dev \
14+
libpq-dev \
15+
libyaml-dev \
16+
mono-mcs \
17+
openjdk-8-jdk-headless \
18+
php-cli \
19+
postgresql-client \
20+
pypy3 \
21+
python3-pip \
22+
python3.12 \
23+
python3.12-dev \
24+
rustc \
25+
shared-mime-info \
26+
sudo \
27+
wait-for-it \
28+
zip
29+
30+
# Create cmsuser user with sudo privileges
31+
RUN useradd -ms /bin/bash cmsuser && \
32+
usermod -aG sudo cmsuser
33+
# Disable sudo password
34+
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
35+
# Set cmsuser as default user
36+
USER cmsuser
37+
38+
RUN mkdir /home/cmsuser/cms
39+
COPY --chown=cmsuser:cmsuser requirements.txt dev-requirements.txt /home/cmsuser/cms/
40+
41+
WORKDIR /home/cmsuser/cms
42+
43+
RUN sudo pip3 install --break-system-packages -r requirements.txt
44+
RUN sudo pip3 install --break-system-packages -r dev-requirements.txt
45+
46+
COPY --chown=cmsuser:cmsuser . /home/cmsuser/cms
47+
48+
RUN sudo python3 setup.py install
49+
50+
RUN sudo python3 prerequisites.py --yes --cmsuser=cmsuser install
51+
52+
RUN sudo sed 's|/cmsuser:your_password_here@localhost:5432/cmsdb"|/postgres@testdb:5432/cmsdbfortesting"|' ./config/cms.conf.sample \
53+
| sudo tee /usr/local/etc/cms-testdb.conf
54+
RUN sudo sed 's|/cmsuser:your_password_here@localhost:5432/cmsdb"|/postgres@devdb:5432/cmsdb"|' ./config/cms.conf.sample \
55+
| sudo tee /usr/local/etc/cms-devdb.conf
56+
57+
ENV LANG C.UTF-8
58+
59+
CMD [""]

0 commit comments

Comments
 (0)