added env #54
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: CD | |
on: | |
push: | |
branches: | |
- master | |
- main | |
jobs: | |
coverage: | |
name: Deploy Coverage Results | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Check Python Version | |
run: python --version | |
- name: Install Package Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install git+https://github.com/cea-cosmic/modopt@develop # Workaround, to be removed | |
python -m pip install -r develop.txt | |
- name: Install PySAP | |
run: python -m pip install . | |
- name: Run Tests | |
run: python -m pytest | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: coverage.xml | |
flags: unittests | |
api_deploy: | |
name: Deploy API Documentation | |
needs: coverage | |
runs-on: self-hosted | |
if: success() | |
env: | |
gh_root: https://github.com/CEA-COSMIC/ | |
tag_path: /archive/refs/tags/ | |
gh_download: https://codeload.github.com/CEA-COSMIC/ | |
develop_path: /tar.gz/refs/heads/develop | |
sphinx_opts: -t docs/_templates -feTMo docs/source | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10.12" | |
- name: Check Python Version | |
run: python --version | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install pandoc | |
python -m pip install -r docs/requirements.txt | |
python -m pip install . | |
- name: Download plug-ins | |
run: | | |
while read _plugin; do | |
plugin_name="$(echo ${_plugin} | awk -F== '{print $1}')" | |
plugin_version="$(echo ${_plugin} | awk -F== '{print $2}')" | |
wget ${gh_download}${plugin_name}${develop_path} -O ${plugin_name}.tar.gz | |
done < plugins.txt | |
for file in *.tar.gz; do | |
tar xzf "$file"; | |
python -m pip install "$file" | |
done | |
rm *.tar.gz | |
- name: Extract plug-in examples | |
run: | | |
while read _plugin; do | |
plugin_name="$(echo ${_plugin} | awk -F== '{print $1}')" | |
cp -r ${plugin_name}-*/examples examples/${plugin_name} || echo "Warning: no examples found for ${plugin_name}" | |
done < plugins.txt | |
- name: Build PySAP source files | |
run: sphinx-apidoc ${sphinx_opts} pysap | |
- name: Build plug-in source files | |
run: | | |
while read _plugin; do | |
plugin_name="$(echo ${_plugin} | awk -F== '{print $1}')" | |
package_name="$(echo ${plugin_name} | awk -F- '{print $2}')" | |
sphinx-apidoc ${sphinx_opts} ${plugin_name}-*/${package_name} | |
done < plugins.txt | |
- name: Install GPU specific requirements | |
run: | | |
python -m pip install -r pysap-mri-*/gpu_requirements.txt | |
- name: Build API documentation | |
run: sphinx-build -E docs/source docs/_build | |
- name: Deploy API documentation | |
uses: peaceiris/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: docs/_build |