Skip to content

New environment structure #195

New environment structure

New environment structure #195

name: Build
on:
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test-code:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["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 dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt --prefer-binary; fi
python -m pip install .
- name: Test with pytest
env:
PY_VER: ${{ matrix.python-version }}
run: |
if [[ "$PY_VER" = "3.7" ]]; then pytest --cov=exciting_environments tests/; else pytest; fi
if [[ "$PY_VER" = "3.7" ]]; then bash <(curl -s https://codecov.io/bash); fi # code coverage report upload
build-doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build Sphinx documentation
uses: ammaraskar/sphinx-action@master
with:
pre-build-command: "python -m pip install sphinx m2r2 sphinx_rtd_theme && python -m pip install -r requirements.txt & python -m pip install ."
docs-folder: "docs/"
# Publish built docs to gh-pages branch.
# ===============================
- name: Commit documentation changes
run: |
git clone https://github.com/ExcitingSystems/exciting-environments --branch gh-pages --single-branch gh-pages
cp -r docs/_build/html/* 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 }}
# ===============================