Add CI config #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Main | |
on: | |
push: | |
branches: | |
- master | |
pull_request: {} | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.11" | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: pip-3.11-${{ hashFiles('poetry.lock') }} | |
- name: Install poetry | |
uses: abatilo/actions-poetry@v2 | |
with: | |
poetry-version: 1.8.2 | |
- name: Install Dependencies | |
run: poetry install | |
- name: Lint | |
run: poetry run ruff check . | |
- name: Format | |
run: poetry run format . --check | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.11" | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: pip-3.11-${{ hashFiles('poetry.lock') }} | |
- name: Install poetry | |
uses: abatilo/actions-poetry@v2 | |
with: | |
poetry-version: 1.8.2 | |
- name: Install Dependencies | |
run: poetry install | |
- name: Test | |
run: poetry run pytest --cov=calmerge -v | |
build-deploy: | |
runs-on: ubuntu-latest | |
needs: | |
- lint | |
- test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
if: ${{ github.ref == 'refs/heads/master' }} | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push container | |
uses: docker/build-push-action@v2 | |
with: | |
push: ${{ github.ref == 'refs/heads/master' }} | |
tags: | | |
ghcr.io/${{ github.repository_owner }}/calmerge:latest |