Switch from Drone to Gitea Actions
parent
8bdcd8f386
commit
ff9503b0d0
94
.drone.yml
94
.drone.yml
|
@ -1,94 +0,0 @@
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
name: test
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: lint
|
|
||||||
image: alpine:edge
|
|
||||||
commands:
|
|
||||||
- apk add --no-cache python3 py3-lxml py3-setproctitle py3-pip py3-wheel py3-enchant hunspell-en
|
|
||||||
- pip3 install --no-cache-dir .[full] .[dev]
|
|
||||||
- isort --check-only --diff .
|
|
||||||
- pylint morss --rcfile=.pylintrc --disable=C,R,W --fail-under=8
|
|
||||||
- pytest --cov=morss tests
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
name: python
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: publish
|
|
||||||
image: plugins/pypi
|
|
||||||
settings:
|
|
||||||
username:
|
|
||||||
from_secret: pypi_user
|
|
||||||
password:
|
|
||||||
from_secret: pypi_pwd
|
|
||||||
commands:
|
|
||||||
- /bin/drone-pypi
|
|
||||||
- cp dist/morss-*.tar.gz dist/morss.tar.gz
|
|
||||||
|
|
||||||
- name: push
|
|
||||||
image: appleboy/drone-scp
|
|
||||||
settings:
|
|
||||||
host:
|
|
||||||
from_secret: ssh_host
|
|
||||||
username:
|
|
||||||
from_secret: ssh_user
|
|
||||||
key:
|
|
||||||
from_secret: ssh_key
|
|
||||||
source:
|
|
||||||
- dist/morss.tar.gz
|
|
||||||
target: /home/ubuntu
|
|
||||||
|
|
||||||
- name: deploy
|
|
||||||
image: appleboy/drone-ssh
|
|
||||||
settings:
|
|
||||||
host:
|
|
||||||
from_secret: ssh_host
|
|
||||||
username:
|
|
||||||
from_secret: ssh_user
|
|
||||||
key:
|
|
||||||
from_secret: ssh_key
|
|
||||||
script_stop: true
|
|
||||||
script:
|
|
||||||
- sudo pip install --upgrade dist/morss.tar.gz[full]
|
|
||||||
- sudo rm -r dist
|
|
||||||
- sudo morss-helper reload
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
branch:
|
|
||||||
- master
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- test
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
name: docker
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: publish
|
|
||||||
image: thegeeklab/drone-docker-buildx
|
|
||||||
# NB. this requires qemu installed on host
|
|
||||||
privileged: true
|
|
||||||
settings:
|
|
||||||
username:
|
|
||||||
from_secret: docker_user
|
|
||||||
password:
|
|
||||||
from_secret: docker_pwd
|
|
||||||
repo:
|
|
||||||
from_secret: docker_repo
|
|
||||||
tags: latest
|
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
branch:
|
|
||||||
- master
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- test
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
name: default
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: https://github.com/actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
- run: pip install --upgrade pip
|
||||||
|
- run: pip install .[full] .[dev]
|
||||||
|
- run: isort --check-only --diff .
|
||||||
|
- run: pylint morss --rcfile=.pylintrc --disable=C,R,W --fail-under=8
|
||||||
|
- run: pytest --cov=morss tests
|
||||||
|
|
||||||
|
|
||||||
|
publish-deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- run: python3 -m pip install --upgrade build && python3 -m build
|
||||||
|
- name: Publish package
|
||||||
|
uses: https://github.com/pypa/gh-action-pypi-publish@release/v1
|
||||||
|
with:
|
||||||
|
password: ${{ secrets.pypi_api_token }}
|
||||||
|
- name: Push python package to the server
|
||||||
|
uses: https://github.com/appleboy/scp-action@v0.1.4
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.ssh_host }}
|
||||||
|
username: ${{ secrets.ssh_user }}
|
||||||
|
key: ${{ secrets.ssh_key }}
|
||||||
|
source: dist/morss-*.tar.gz
|
||||||
|
target: /home/ubuntu
|
||||||
|
- name: Install & reload the server
|
||||||
|
uses: https://github.com/appleboy/ssh-action@v0.1.10
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.ssh_host }}
|
||||||
|
username: ${{ secrets.ssh_user }}
|
||||||
|
key: ${{ secrets.ssh_key }}
|
||||||
|
script: |
|
||||||
|
sudo pip install --upgrade dist/morss*-.tar.gz[full]
|
||||||
|
sudo rm -r dist
|
||||||
|
sudo morss-helper reload
|
||||||
|
|
||||||
|
docker-publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: https://github.com/docker/setup-qemu-action@v2
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: https://github.com/docker/setup-buildx-action@v2
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: https://github.com/docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.docker_user }}
|
||||||
|
password: ${{ secrets.docker_pwd }}
|
||||||
|
- name: Build and push
|
||||||
|
uses: https://github.com/docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||||
|
push: true
|
||||||
|
tags: ${{ secrets.docker_repo }}
|
Loading…
Reference in New Issue