45 lines
1.0 KiB
YAML
45 lines
1.0 KiB
YAML
name: CI Pipeline
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.9'
|
|
- name: Install dependencies
|
|
run: pip install flake8
|
|
- name: Run linting
|
|
run: flake8 . --max-line-length=120
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.9'
|
|
- name: Install dependencies
|
|
run: pip install -r requirements.txt
|
|
- name: Run tests
|
|
run: pytest test_app.py
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
needs: [lint, test]
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Build Docker image
|
|
run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/my-flask-app:${{ github.sha }} .
|