diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 9f1ed87..0000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index eca258d..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -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 diff --git a/Makefile b/Makefile index 83c7e24..b1c44cd 100644 --- a/Makefile +++ b/Makefile @@ -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; \ + ' diff --git a/README.md b/README.md index 1c7322d..c660005 100644 --- a/README.md +++ b/README.md @@ -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 +```