Compare commits

...

5 Commits

9 changed files with 29 additions and 67 deletions

View File

@ -1,29 +0,0 @@
---
name: Publish
on:
push:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Deploy
env:
deploy_key: ${{secrets.deploy_key}}
known_hosts: ${{secrets.known_hosts}}
run: |
mkdir -p ${HOME}/.ssh
printf "%s\n" "$known_hosts" > ${HOME}/.ssh/known_hosts
printf "%s\n" "$deploy_key" > ${HOME}/.ssh/id_ed25519
chmod 600 ${HOME}/.ssh/id_ed25519
eval $(ssh-agent)
ssh-add
rsync -a ./ afpy-org@deb2.afpy.org:/home/afpy-org/src/
ssh afpy-org@deb2.afpy.org /home/afpy-org/venv/bin/python -m pip install --upgrade setuptools wheel pip
ssh afpy-org@deb2.afpy.org /home/afpy-org/venv/bin/python -m pip install -r /home/afpy-org/src/requirements.txt
ssh afpy-org@deb2.afpy.org /home/afpy-org/venv/bin/python -m pip install sentry-sdk[flask]
ssh afpy-org@deb2.afpy.org sudo systemctl restart afpy-org.service

View File

@ -1,31 +0,0 @@
---
name: Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build_ubuntu:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.7 # As on deb.afpy.org
- uses: actions/cache@v2
with:
path: |
venv
key: ${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }}
- name: Test
run: |
python --version
make install
make test

View File

@ -5,22 +5,38 @@ FLASK = $(VENV)/bin/flask
ISORT = $(VENV)/bin/isort
BLACK = $(VENV)/bin/black
.PHONY: all
all: install serve
.PHONY: install
install:
test -d $(VENV) || python3 -m venv $(VENV)
$(PIP) install --upgrade --no-cache pip setuptools -r requirements.txt -r requirements-dev.txt
.PHONY: clean
clean:
rm -fr $(VENV)
.PHONY: check-outdated
check-outdated:
$(PIP) list --outdated --format=columns
.PHONY: test
test:
$(PYTHON) -m pytest tests.py afpy/ --flake8 --black --cov=afpy --cov=tests --cov-report=term-missing
.PHONY: serve
serve:
$(PYTHON) run.py
.PHONY: all install clean check-outdated test serve
.PHONY: publish
publish:
# To get the right to publish, add your public key in the nginx_public_deploy_key here:
# https://git.afpy.org/AFPy/infra/src/branch/main/afpy.org.yml
rsync -a ./ afpy-org@deb2.afpy.org:/home/afpy-org/src/
ssh afpy-org@deb2.afpy.org '\
/home/afpy-org/venv/bin/python -m pip install --upgrade setuptools wheel pip; \
/home/afpy-org/venv/bin/python -m pip install -r /home/afpy-org/src/requirements.txt; \
/home/afpy-org/venv/bin/python -m pip install sentry-sdk[flask]; \
sudo systemctl restart afpy-org.service; \
'

View File

@ -26,6 +26,8 @@ d'abord, puis un `python xml2sql.py` ce qui remplira la DB
make test
```
## Déployer
## Publier
Pour publier il suffit de `git push`, une action github s'occupe de la mise en prod.
```bash
make publish
```

View File

@ -1,5 +1,5 @@
@charset "UTF-8";
@import url("https://fonts.googleapis.com/css?family=Hind:300,600,700");
a {
color: #ffcd05;
font-weight: 700;

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
(function(){function e(e){return e.replace(/<[^>]*>?/gi,t)}function t(e){return e.match(s)||e.match(o)||e.match(a)?e:""}function i(e){if(""==e)return"";var t=/<\/?\w+[^>]*(\s|$|>)/g,i=e.toLowerCase().match(t),n=(i||[]).length;if(0==n)return e;for(var r,s,o,a="<p><img><br><li><hr>",l=[],h=[],c=!1,u=0;n>u;u++)if(r=i[u].replace(/<\/?(\w+).*/,"$1"),!(l[u]||a.search("<"+r+">")>-1)){if(s=i[u],o=-1,!/^<\//.test(s))for(var d=u+1;n>d;d++)if(!l[d]&&i[d]=="</"+r+">"){o=d;break}-1==o?c=h[u]=!0:l[o]=!0}if(!c)return e;var u=0;return e=e.replace(t,function(e){var t=h[u]?"":e;return u++,t})}var n,r;"object"==typeof exports&&"function"==typeof require?(n=exports,r=require("./Markdown.Converter").Converter):(n=window.Markdown,r=n.Converter),n.getSanitizingConverter=function(){var t=new r;return t.hooks.chain("postConversion",e),t.hooks.chain("postConversion",i),t};var s=/^(<\/?(b|blockquote|code|del|dd|dl|dt|em|h1|h2|h3|i|kbd|li|ol|p|pre|s|sup|sub|strong|strike|ul)>|<(br|hr)\s?\/?>)$/i,o=/^(<a\shref="((https?|ftp):\/\/|\/)[-A-Za-z0-9+&@#\/%?=~_|!:,.;\(\)]+"(\stitle="[^"<>]+")?\s?>|<\/a>)$/i,a=/^(<img\ssrc="(https?:\/\/|\/)[-A-Za-z0-9+&@#\/%?=~_|!:,.;\(\)]+"(\swidth="\d{1,3}")?(\sheight="\d{1,3}")?(\salt="[^"<>]*")?(\stitle="[^"<>]*")?\s?\/?>)$/i})();

View File

@ -5,6 +5,7 @@
<title>AFPY - Le site web de l'Association Francophone Python</title>
<link type="text/css" rel="stylesheet" href="{{ url_for('static', filename='css/style.sass.css') }}" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
{{ pagedown.include_pagedown() }}
<script type="text/javascript" src="{{ url_for('static', filename='js/Markdown.Converter.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/Markdown.Sanitizer.min.js') }}"></script>
</head>
{% endblock %}

View File

@ -5,7 +5,8 @@
{% endblock header %}
{% block main %}
{% set helloasso_url = "https://www.helloasso.com/associations/afpy/adhesions/adhesion-2023-a-l-afpy" %}
<h2>Adhérez à l'AFPy</h2>
<iframe id="haWidget" src="https://www.helloasso.com/associations/afpy/adhesions/adhesion-2022-a-l-afpy/widget"></iframe>
<p>Si le widget ne fonctionne pas, essayez cette page : https://www.helloasso.com/associations/afpy/adhesions/adhesion-2022-a-l-afpy</p>
<iframe id="haWidget" src="{{ helloasso_url }}/widget"></iframe>
<p>Si le widget ne fonctionne pas, essayez cette page : <a href="{{ helloasso_url }}">{{ helloasso_url }}</a></p>
{% endblock main %}