Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/okfde/froide
Browse files Browse the repository at this point in the history
  • Loading branch information
tyliec committed Sep 24, 2023
2 parents a5942e7 + 9887f0c commit e171f42
Show file tree
Hide file tree
Showing 1,110 changed files with 167,644 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"presets": [
["@babel/preset-env", {
"targets": {
"browsers": ["> 0.25%", "last 2 versions", "ie >= 11", "not dead"]
}
}]
],
"plugins": ["@babel/plugin-proposal-object-rest-spread"]
}
60 changes: 60 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
module.exports = {
parserOptions: {
sourceType: 'module',
parser: '@typescript-eslint/parser',
project: true,
extraFileExtensions: ['.vue']
},
parser: 'vue-eslint-parser',
extends: [
'eslint:recommended',
'plugin:vue/vue3-essential',
'plugin:vue/vue3-strongly-recommended',
'prettier'
],
plugins: ['@typescript-eslint', 'prettier', 'html'],
ignorePatterns: ['node_modules/**', '**/static/**'],
rules: {
indent: 'off',
'prettier/prettier': 'error',
'space-before-function-paren': [
'error',
{
anonymous: 'always',
named: 'never',
asyncArrow: 'always'
}
],
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'error'
},
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
// TODO: remove these exceptions
'@typescript-eslint/strict-boolean-expressions': 'warn',
'@typescript-eslint/prefer-nullish-coalescing': 'warn',

// compatibility with prettier
'@typescript-eslint/space-before-function-paren': [
'error',
{
anonymous: 'always',
named: 'never',
asyncArrow: 'always'
}
],
'@typescript-eslint/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'none'
},
singleline: { delimiter: 'semi', requireLast: false }
}
]
}
}
]
}
4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Migrate code style to Black
59bd3eeded3c3ed00fbc858fe20bfea99c8dbefa
# Migrate import style to isort + Black stable
3fae2ecb54ce1297c5734074709d336024a91153
118 changes: 118 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Froide CI

on:
push:
pull_request:
branches: [main]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
cache: 'pip'
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'yarn'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[lint]
yarn install
- name: Run flake8
run: flake8 froide --statistics
- name: Run black
run: black --check froide
- name: Run isort
run: isort --check froide
- name: Run eslint
run: yarn lint

test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.10']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install system-level dependencies
run: sudo apt-get update && sudo apt-get install libxml2-dev libxslt1-dev python3-dev libgdal-dev gdal-bin libmagic-dev libmagickwand-dev libpoppler-cpp-dev
- name: Install dependencies
run: |
python -m pip install --upgrade pip~=22.0.1 pip-tools
pip-sync requirements-test.txt
pip install -e .
yarn install
- name: Build frontend
run: yarn run build
- name: Run flake8 and tests
run: make testci
env:
DATABASE_URL: postgis://postgres:postgres@localhost/froide
services:
postgres:
image: postgis/postgis:14-3.3
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: froide
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.5.1
options: -e "discovery.type=single-node" --expose 9200 --health-cmd "curl localhost:9200/_cluster/health" --health-interval 10s --health-timeout 5s --health-retries 10
ports:
- '9200:9200'
testui:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install system-level dependencies
run: sudo apt-get update && sudo apt-get install libxml2-dev libxslt1-dev python3-dev libgdal-dev gdal-bin python3-gdal libmagic-dev libmagickwand-dev libpoppler-cpp-dev
- name: Install dependencies
run: |
python -m pip install --upgrade pip~=22.0.1 pip-tools
pip-sync requirements-test.txt
playwright install --with-deps chromium
pip install -e .
yarn install
- name: Build frontend
run: yarn run build
- name: Run in-browser tests
run: make testui
env:
DATABASE_URL: postgis://postgres:postgres@localhost/froide
DJANGO_TEST_SELENIUM_DRIVER: http://localhost:4444/wd/hub#chrome_headless
services:
postgres:
image: postgis/postgis:12-3.0
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: froide
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.15.0
options: -e "discovery.type=single-node" --expose 9200 --health-cmd "curl localhost:9200/_cluster/health" --health-interval 10s --health-timeout 5s --health-retries 10
ports:
- '9200:9200'
29 changes: 29 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
*.py[co]
.DS_Store
*.vim
*.db
*.mo
local_*.py
data/
files/
froide/tests/testdata/*/
.coverage
*/_build/
.idea
htmlcov/
public/
build/
dist/
venv/
froide-env/
*.egg-info
*.log
node_modules/
*.map
favicon-result.json
.mypy_cache
__pycache__/
froide/static/js
froide/static/css
froide/static/fonts
.vscode/settings.json
42 changes: 42 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
repos:
- repo: https://github.com/pycqa/isort
rev: 5.11.5
hooks:
- id: isort
args: ['--profile', 'black', '--filter-files']
- repo: https://github.com/psf/black
rev: '23.3.0' # Replace by any tag/version: https://github.com/psf/black/tags
hooks:
- id: black
language_version: python3 # Should be a command that runs python3.6+
- repo: https://github.com/pycqa/flake8
rev: '6.0.0' # pick a git hash / tag to point to
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear==23.5.9]
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.45.0
hooks:
- id: eslint
files: \.(js|ts|vue)?$
types: [file]
additional_dependencies:
- [email protected]
- eslint-config-standard-with-typescript
- eslint-plugin-html
- eslint-plugin-import
- eslint-plugin-n
- eslint-plugin-promise
- eslint-plugin-vue
- prettier
- eslint-plugin-prettier
- eslint-config-standard
- repo: local
hooks:
- id: make-messages
name: Update translation files
entry: make messagesde
language: system
pass_filenames: false

exclude: ^.*/migrations/.*$|eslintrc.js
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"prettier-config-standard"
9 changes: 9 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[main]
host = https://www.transifex.com
type = PO

[froide.froide]
file_filter = locale/<lang>/LC_MESSAGES/django.po
source_file = locale/en/LC_MESSAGES/django.po
source_lang = en
type = PO
22 changes: 22 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License

Copyright (c) 2011 Stefan Wehrmeyer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
export DJANGO_SETTINGS_MODULE=froide.settings
export DJANGO_CONFIGURATION=Test
export PYTHONWARNINGS=default

test:
flake8 froide
coverage run --branch -m pytest froide/
coverage report

testci:
coverage run --branch -m pytest froide/ --ignore=froide/tests/live/
coverage report

testui:
coverage run --branch -m pytest --browser chromium froide/tests/live/

.PHONY: htmlcov
htmlcov:
coverage html

messagesde:
django-admin makemessages -l de --ignore public --ignore froide-env --ignore node_modules --ignore htmlcov --add-location file

requirements: requirements.in requirements-test.in
pip-compile requirements.in
pip-compile requirements-test.in
4 changes: 4 additions & 0 deletions Manifest.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include README.md LICENSE.txt
recursive-include froide/templates *.html *.txt
recursive-include froide/**/templates *.html *.txt
recursive-include locale *.po
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: gunicorn froide.wsgi
Loading

0 comments on commit e171f42

Please sign in to comment.