update data & tests #1309
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions, update generated calendar outputs. | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Python package | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
default: 'warning' | |
description: 'Dummy field' | |
jobs: | |
build: | |
name: Build and test | |
# if: needs.check.outputs.code_changed == 'true' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.9] | |
# python-version: [3.5, 3.6, 3.7, 3.8] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
with: | |
ref: master | |
submodules: false | |
# Setting true above seems to lead to submodule updation problems. | |
fetch-depth: 1 | |
- name: Init submodules, update hugo-source | |
run: | | |
set -o xtrace | |
git submodule update --init --recursive | |
git submodule update --remote --merge --recursive hugo-source/content/output | |
git submodule update --remote --merge --recursive hugo-source/themes/sanskrit-documentation-theme-hugo | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
# python -m pip install git+https://github.com/astropy/astropy@master -U | |
- name: Lint with flake8 | |
run: | | |
pip install flake8 | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
#The below is disabled pending https://github.com/jyotisham/jyotisha/runs/1142973750 | |
- name: Build package | |
run: | | |
python -m pip install . | |
pip install setuptools wheel twine | |
python setup.py bdist_wheel | |
- name: Build test | |
run: | | |
python -c "import jyotisha" | |
- name: Test with pytest | |
id: pytest | |
run: | | |
pip install pytest | |
pytest jyotisha_tests | |
- name: Upload package | |
uses: pypa/gh-action-pypi-publish@master | |
if: ${{ github.event_name != 'pull_request' && steps.pytest.conclusion == 'success'}} | |
with: | |
user: __token__ | |
skip_existing: true | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
- name: Regenerate calendars | |
run: | | |
python -m "jyotisha.panchaanga.writer.generation_project" | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: "0.83.1" | |
- name: Build hugo site pages | |
id: hugo_build | |
run: | | |
cd hugo-source | |
rm -rf build_github | |
hugo | |
cd .. | |
# MD files are useful for certain bots. Hence the below. | |
- name: Deploy md | |
uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.event_name != 'pull_request' && steps.hugo_build.conclusion == 'success'}} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./hugo-source/content/output | |
publish_branch: generated-output | |
keep_files: true | |
- name: Deploy html | |
uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.event_name != 'pull_request' && steps.hugo_build.conclusion == 'success'}} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./hugo-source/build_github | |
force_orphan: true # git history growth - even on non-src branches - makes cloning slow. |