Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

cancel-workflow-run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.12.0
with:
workflow_id: ci.yml
exclude_action_repos: true

jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, 3.10]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Cache Python dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Run tests
run: |
python -m unittest discover
env:
CI: true
deploy:
needs: build-and-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy to production
if: github.ref == 'refs/heads/main'
run: |
echo 'Deploying to production...'
env:
DEPLOY_ENV: production