open-law/.github/workflows/python-app.yml

67 lines
2.0 KiB
YAML
Raw Normal View History

2023-04-20 13:10:16 +00:00
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Simple Flask Application CI
on:
push:
branches: [main, develop, develop_tw]
pull_request:
branches: [main, develop, develop_tw]
jobs:
tests:
strategy:
fail-fast: true
matrix:
python-version: [3.11]
poetry-version: [1.4]
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry
uses: abatilo/actions-poetry@v2.1.6
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install dependencies
run: |
poetry install
- name: Lint with flake8
run: |
poetry run flake8 . --count --show-source --statistics
poetry run flake8 . --count --exit-zero --max-complexity=10 --statistics
- name: Run Flask tests
run: |
poetry run pytest
2023-04-21 14:36:37 +00:00
build:
strategy:
fail-fast: false
matrix:
python-version: [3.11]
poetry-version: [1.4]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
needs: tests
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
push: true
tags: simple2b/open-law-dev:latest