We're no longer using github workflow.

This commit is contained in:
Julien Palard 2022-11-17 11:27:34 +01:00
parent ee450a9e4a
commit e22f9eecd2
Signed by: mdk
GPG Key ID: 0EFC1AC1006886F8
4 changed files with 21 additions and 63 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
```