Skip to content

Add GitHub workflow cicd #5

Add GitHub workflow cicd

Add GitHub workflow cicd #5

Workflow file for this run

name: Sage Development
on:
pull_request:
types:
- opened
- edited
- synchronize
- reopened
workflow_call:
env:
POETRY_VERSION: "1.8.2"
PYTHON_VERSION: "3.11"
WORKDIR: ${{ inputs.working-directory == '' && '.' || inputs.working-directory }}
RUFF_OUTPUT_FORMAT: github
defaults:
run:
shell: bash
working-directory: .
jobs:
lint:
name: "Code Style"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/python_setup"
with:
python-version: ${{ env.PYTHON_VERSION }}
poetry-version: ${{ env.POETRY_VERSION }}
working-directory: ${{ env.WORKDIR }}
cache-key: lint-with-extras
- name: Check Poetry File
run: |
poetry check
- name: Check lock file
run: |
poetry lock --check
- name: Install dependencies
run: |
poetry install --with dev
- name: Linting with ruff
run: |
make lint
- name: Style check with ruff
run: |
make format
- name: CodeSpell
run: |
make spell_check
test:
name: Run unit tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Set up Python + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/python_setup"
with:
python-version: ${{ env.PYTHON_VERSION }}
poetry-version: ${{ env.POETRY_VERSION }}
working-directory: ${{ env.WORKDIR }}
cache-key: lint-with-extras
- name: Install deps
run: poetry install --with test
- name: Run tests
shell: bash
run: |
make test
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build the Sage image
run: docker build . --file Dockerfile --tag thehapyone/codesage:test-$(date +%s)