Update publish.yaml #57
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: Unit tests and project documentation | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
docs: | |
name: "Run tests and generate project documenation" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] #, macos-latest, windows-latest] | |
python-version: [ '3.8' ] #[ '3.8', '3.9' ] | |
# TODO: add rust-version 1.62 | |
# exclude: | |
# - os: macos-latest | |
# python-version: '3.8' | |
# - os: windows-latest | |
# python-version: '3.6' | |
steps: | |
# Checkout code | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
#architecture: x64 | |
- name: Display Python version | |
run: | | |
python -c "import sys; print(sys.version)" | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Display Rust version | |
run: | | |
rustc --version | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 11 | |
# Install dependencies | |
- name: System-wide deps | |
run: | | |
sudo apt-get install -y graphviz \ | |
libgraphviz-dev | |
# Install packages (for API doc gen) | |
- name: Install askem (Python) | |
working-directory: . | |
run: | | |
# retrieve latest model for img2mml component | |
curl -L https://artifacts.askem.lum.ai/skema/img2mml/models/cnn_xfmer_arxiv_im2mml_with_fonts_boldface_best.pt > skema/img2mml/trained_models/cnn_xfmer_arxiv_im2mml_with_fonts_boldface_best.pt | |
pip install ".[all]" | |
# docs (API) | |
# generate python docs using pdoc | |
- name: "Create documentation for Python components (API docs)" | |
run: | | |
# FIXME: once issues with text reading submodule resolved, top command will be sufficient | |
#pdoc --html -c latex_math=True --force --output-dir docs/api/python skema | |
pdoc --html -c latex_math=True --force --output-dir docs/api/python skema.img2mml | |
pdoc --html -c latex_math=True --force --output-dir docs/api/python skema.isa | |
pdoc --html -c latex_math=True --force --output-dir docs/api/python skema.skema_py | |
pdoc --html -c latex_math=True --force --output-dir docs/api/python skema.gromet | |
pdoc --html -c latex_math=True --force --output-dir docs/api/python skema.program_analysis | |
pdoc --html -c latex_math=True --force --output-dir docs/api/python skema.metal.model_linker | |
# generate Rust docs using cargo doc | |
- name: "Create documentation for Rust components (API docs)" | |
working-directory: ./skema/skema-rs | |
run: | | |
cargo doc | |
mkdir -p $GITHUB_WORKSPACE/docs/api/rust | |
mv target/doc/* $GITHUB_WORKSPACE/docs/api/rust/ | |
# generate Scala docs using sbt doc | |
# FIXME: downloading project deps is far too slow and too large to cache (3+ GB) to include this step in our CI | |
# - name: "Create documentation for Scala components (API docs)" | |
# working-directory: ./skema/text_reading/scala | |
# run: | | |
# sbt doc | |
# mkdir -p $GITHUB_WORKSPACE/docs/api/scala | |
# mv target/doc/* $GITHUB_WORKSPACE/docs/api/scala/ | |
# code coverage (Scala) | |
# FIXME: downloading project deps is far too slow to include this step | |
# - name: "Code coverage reports for Scala components" | |
# working-directory: ./skema/text_reading/scala | |
# run: | | |
# sbt clean coverage test | |
# sbt coverageReport | |
# sbt coverageAggregate | |
# code coverage (Python) | |
- name: "Code coverage reports for Python components" | |
run: | | |
pytest | |
- name: "Unit tests for Rust components" | |
working-directory: ./skema/skema-rs | |
run: | | |
cargo test --verbose --all | |
# docs (other) | |
- name: "Create documentation (other)" | |
run: | | |
docker run -i -v "$GITHUB_WORKSPACE:/app" parsertongue/mkdocs:latest mkdocs build -c | |
- name: Deploy docs | |
if: github.ref == 'refs/heads/main' | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
# see https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#about-the-github_token-secret | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./site | |
user_name: 'github-actions[bot]' | |
user_email: 'github-actions[bot]@users.noreply.github.com' | |
commit_message: ${{ github.event.head_commit.message }} |