Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing doc CI #18

Merged
merged 13 commits into from
Jul 10, 2023
79 changes: 7 additions & 72 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,76 +67,11 @@ jobs:
conda install -c conda-forge pytest pytest-xdist pytest-cov
pip install -e .
pytest -n auto -x --cov=./ --cov-report=xml

build-docs:
if: github.repository == 'neurospin/pymultifracs'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache conda
uses: actions/cache@v2
env:
CACHE_NUMBER: 0
- name: Upload coverage
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10' }}
uses: codecov/codecov-action@v3
with:
path: ~/conda_pkgs_dir
key:
doc-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('meta.yml') }}
- name: Setup python with conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
python-version: 3.11
environment-file: meta.yml
use-only-tar-bz2: true
- name: Build doc
run: |
conda install -c conda-forge sphinx numpydoc pydata-sphinx-theme
pip install -e .
cd doc
make html

upload-docs:
if: github.repository == 'neurospin/pymultifracs'
runs-on: ubuntu-latest
needs: [build-docs]
steps:
- name: Archive artifact
shell: sh
if: runner.os == 'Linux'
run: |
tar \
--dereference --hard-dereference \
--directory doc/_build/ \
-cvf "$RUNNER_TEMP/artifact.tar" \
--exclude=.git \
--exclude=.github \
.
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: github-pages
path: ${{ runner.temp }}/artifact.tar
retention-days: 1
if-no-files-found: error

deploy-docs:
needs: upload-docs

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/[email protected] # or the latest "vX.X.X" version tag for this action

files: ./coverage.xml # optional
name: codecov-umbrella # optional
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
83 changes: 83 additions & 0 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: doc

on:
push:
branches: [ "master" ]
workflow_dispatch:

jobs:
build-docs:
defaults:
run:
shell: bash -el {0}
if: github.repository == 'neurospin/pymultifracs'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache conda
uses: actions/cache@v2
env:
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key:
doc-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('meta.yml') }}
- name: Setup python with conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
activate-environment: test
python-version: 3.11
environment-file: meta.yml
use-only-tar-bz2: true
- name: Build doc
shell: bash -el {0}
run: |
conda install -c conda-forge pip sphinx numpydoc pydata-sphinx-theme
python -m pip install .
cd doc
ls $CONDA/envs
export SPHINXBUILD=$CONDA/test/bin/sphinx-build
export SPHINXBUILD=/usr/share/miniconda/envs/test/bin/sphinx-build
make html
- name: Archive artifact
shell: sh
if: runner.os == 'Linux'
run: |
tar \
--dereference --hard-dereference \
--directory doc/_build/ \
-cvf "$RUNNER_TEMP/artifact.tar" \
--exclude=.git \
--exclude=.github \
.
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: github-pages
path: ${{ runner.temp }}/artifact.tar
retention-days: 1
if-no-files-found: error

deploy-docs:
needs: build-docs

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2 # or the latest "vX.X.X" version tag for this action
with:
token: ${{ secrets.GITHUB_TOKEN }}
Loading
Loading