morss/.github/workflows/default.yml

79 lines
2.4 KiB
YAML
Raw Normal View History

2023-05-17 20:54:05 +00:00
name: default
on:
push:
branches:
- master
jobs:
test-lint:
runs-on: ubuntu-latest
steps:
2023-06-25 23:28:33 +00:00
- name: Checkout
uses: actions/checkout@v3
2023-05-17 20:54:05 +00:00
with:
fetch-depth: 0
2023-06-25 23:28:33 +00:00
- name: Prepare image
run: apt-get -y update && apt-get -y install python3-pip libenchant-2-2 aspell-en
- name: Install dependencies
run: pip3 install .[full] .[dev]
2023-05-17 20:54:05 +00:00
- run: isort --check-only --diff .
- run: pylint morss --rcfile=.pylintrc --disable=C,R,W --fail-under=8
- run: pytest --cov=morss tests
2023-06-25 23:28:33 +00:00
python-publish:
2023-05-17 20:54:05 +00:00
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
2023-06-25 23:28:33 +00:00
- name: Prepare image
run: apt-get -y update && apt-get -y install python3-pip python3-build
- name: Build package
run: python3 -m build
2023-05-17 20:54:05 +00:00
- name: Publish package
uses: https://github.com/pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.pypi_api_token }}
2023-06-25 23:28:33 +00:00
docker-publish-deploy:
2023-05-17 20:54:05 +00:00
runs-on: ubuntu-latest
2023-06-23 21:14:32 +00:00
container:
image: catthehacker/ubuntu:act-latest
2023-05-17 20:54:05 +00:00
steps:
- name: Checkout
uses: actions/checkout@v3
2023-06-25 23:28:33 +00:00
2023-05-17 20:54:05 +00:00
- name: Set up QEMU
uses: https://github.com/docker/setup-qemu-action@v2
2023-06-25 23:28:33 +00:00
2023-05-17 20:54:05 +00:00
- name: Set up Docker Buildx
uses: https://github.com/docker/setup-buildx-action@v2
2023-06-25 23:28:33 +00:00
2023-05-17 20:54:05 +00:00
- name: Login to Docker Hub
uses: https://github.com/docker/login-action@v2
with:
username: ${{ secrets.docker_user }}
password: ${{ secrets.docker_pwd }}
2023-06-25 23:28:33 +00:00
2023-05-17 20:54:05 +00:00
- 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 }}
2023-06-25 23:29:00 +00:00
- name: Deploy on 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: morss-update