Merge pull request #71 from EnergyAssetOptimization/JTPfi-patch-1 #237
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 is a basic workflow to help you get started with Actions | |
name: CI | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
# Installs python | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12.2 | |
architecture: 'x64' | |
# You can test your matrix by printing the current Python version | |
- name: Display Python version | |
run: python -c "import sys; print(sys.version)" | |
- name: Update pip | |
## CONDA | |
# run: | | |
# $CONDA/bin/conda env update --file environment.yml --name base | |
## PIP | |
run: python -m pip install --upgrade pip | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt | |
pip install nbsphinx | |
pip install sphinx | |
pip install sphinx_rtd_theme myst_parser | |
- name: Show packages | |
# run: conda list | |
run: pip list | |
- name: Lint with flake8 | |
run: | | |
$CONDA/bin/conda install flake8 | |
# stop the build if there are Python syntax errors or undefined names | |
$CONDA/bin/flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
$CONDA/bin/flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Test with unittest | |
# run: $CONDA/bin/python -m unittest discover tests | |
run: python -m unittest discover tests | |
shell: bash | |
- name: Install rtd theme for sphinx doc from pypi | |
run: $CONDA/bin/python -m pip install sphinx_rtd_theme | |
- name: Install Pandoc | |
uses: r-lib/actions/setup-pandoc@v2 | |
with: | |
pandoc-version: 2.9.1 | |
- name: Build docs with sphinx | |
# run: $CONDA/bin/sphinx-build -b html doc/source/ doc/build | |
run: sphinx-build -b html doc/source/ doc/build | |
- name: Store doc as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: DocumentationHTML | |
path: doc/build/ | |
- name: Commit documentation changes | |
run: | | |
git clone https://github.com/EnergyAssetOptimization/EAO.git --branch gh-pages --single-branch gh-pages | |
cp -r doc/build/* gh-pages/ | |
cd gh-pages | |
touch .nojekyll | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m "Update documentation" -a || true | |
# The above command will fail if no changes were present, so we ignore | |
# that. | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
branch: gh-pages | |
directory: gh-pages | |
github_token: ${{ secrets.GITHUB_TOKEN }} |