Skip to content

implement: Document the draft workflow from source add to build (t45) #389

implement: Document the draft workflow from source add to build (t45)

implement: Document the draft workflow from source add to build (t45) #389

Workflow file for this run

name: Tests
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade setuptools wheel
pip install poetry
poetry config virtualenvs.create true
poetry install --with dev --all-extras
- name: Install Pandoc # apt version seems too old
uses: r-lib/actions/setup-pandoc@v2
- name: Install Node # Without it, the maths is not rendered and its tests skip
uses: actions/setup-node@v4
with:
node-version: '22'
# The validator compiles a set the way lambda-feedback/PDF-generator does, so it
# needs what that image installs: xelatex with braket, cancel, xeCJK and the
# Noto Sans fonts the template sets as its main and CJK fonts.
- name: Install XeLaTeX
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
texlive-xetex texlive-latex-recommended texlive-latex-extra \
texlive-science texlive-lang-chinese fonts-noto-core fonts-noto-cjk \
lmodern texlive-plain-generic texlive-bibtex-extra texlive-lang-arabic
- name: Linting Checks
run: |
poetry run black --check .
poetry run isort --check-only in2lambda docs tests
poetry run pydocstyle --convention=google in2lambda tests
- name: pytest
run: poetry run pytest --cov-report=xml:coverage.xml --cov=in2lambda
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
# The build job always has panflute and pandoc; this proves the library works without them.
library-only:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install without extras
run: pip install .
- name: Author a set
working-directory: ${{ runner.temp }}
run: |
python -c "
import tempfile
from in2lambda.api.set import Set
s = Set()
s.add_question('Q', 'text')
s.current_question.add_part_text('part a')
s.current_question.add_solution('solution a')
s.to_json(tempfile.mkdtemp())
"
in2lambda --help