Skip to content

Commit

Permalink
Update github workflow with new binder env and update actions
Browse files Browse the repository at this point in the history
- create reusable workflows to share between release.yml and build.yml
- update actions to make them use node 20 (node 18 being deprecated)
- upload-artifact and download-artifact @v4 are using immutable
  artifacts sor we need to upload wheels to separate artifacts But we
  can still download them all to update the nightly wheel by using
  `pattern`  + `merge_multiple`
- in case of push on master, we do not need anymore to push on binder
  branch, and master binder env defined in subdirectory binder/ will install
  last "nightly" wheel available
- in case of release, we do not push anymore to binder branch but rather update the
  subdirectory binder/ and push it in the same tag created for colab
  notebooks
- to ensure having last "nightly" wheel correspond to the state of
  master branch, we trigger the job "upload-nightly" for each push on
  master (not waiting for following night), and make deploy-doc depends
  on it so that the binder env built by deploy-doc will get the proper
  version of scikit-decide
- the scheduled workflows are nno more necessary to have an up-to-date
  wheel on "nightly" release but rather only to check that dependencies
  are not messing up the library => we schedule only once a week from
  now
  • Loading branch information
nhuet committed Apr 25, 2024
1 parent 337e39d commit b70f3a2
Show file tree
Hide file tree
Showing 4 changed files with 383 additions and 334 deletions.
111 changes: 111 additions & 0 deletions .github/workflows/build-doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Build doc

on:
workflow_call:
inputs:
doc-artifact-name:
description: "Name of the artifact containing the built doc"
required: false
default: "doc"
type: string
doc-path:
description: "Path where to extract the built doc"
required: false
default: "docs/.vuepress/dist"
type: string
notebooks-repo-url:
description: |
Url of the repository containing the notebooks, used to generate github and colab links.
By default, the current repository url.
required: false
default: ""
type: string
notebooks-branch:
description: |
Branch containing the notebooks, used to generate github and colab links.
By default, the current branch.
required: false
default: ""
type: string
doc-prerequisites-cmdline:
description: |
Command line to run before building doc.
required: false
default: ""
type: string

jobs:
build-doc:
runs-on: ubuntu-latest
env:
python-version: "3.9"
steps:
- name: Set env variables for github links in doc
run: |
# notebooks source repo and branch. First try to use workflow inputs
AUTODOC_NOTEBOOKS_REPO_URL=${{ inputs.notebooks-repo-url }}
AUTODOC_NOTEBOOKS_BRANCH=${{ inputs.notebooks-branch }}
# use github context if not defined in inputs
if [[ $GITHUB_REF == refs/pull* ]];
then
if [ -z "${AUTODOC_NOTEBOOKS_REPO_URL}" ]; then
AUTODOC_NOTEBOOKS_REPO_URL="${GITHUB_SERVER_URL}/${{ github.event.pull_request.head.repo.full_name }}"
fi
if [ -z "${AUTODOC_NOTEBOOKS_BRANCH}" ]; then
AUTODOC_NOTEBOOKS_BRANCH=${GITHUB_HEAD_REF}
fi
elif [[ $GITHUB_REF == refs/heads* ]];
then
if [ -z "${AUTODOC_NOTEBOOKS_REPO_URL}" ]; then
AUTODOC_NOTEBOOKS_REPO_URL=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}
fi
if [ -z "${AUTODOC_NOTEBOOKS_BRANCH}" ]; then
AUTODOC_NOTEBOOKS_BRANCH=${GITHUB_REF/refs\/heads\//}
fi
elif [[ $GITHUB_REF == refs/tags* ]];
then
if [ -z "${AUTODOC_NOTEBOOKS_REPO_URL}" ]; then
AUTODOC_NOTEBOOKS_REPO_URL=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}
fi
if [ -z "${AUTODOC_NOTEBOOKS_BRANCH}" ]; then
AUTODOC_NOTEBOOKS_BRANCH=${GITHUB_REF/refs\/tags\//}
fi
fi
# export in GITHUB_ENV for next steps
echo "AUTODOC_NOTEBOOKS_REPO_URL=${AUTODOC_NOTEBOOKS_REPO_URL}" >> $GITHUB_ENV
echo "AUTODOC_NOTEBOOKS_BRANCH=${AUTODOC_NOTEBOOKS_BRANCH}" >> $GITHUB_ENV
# check computed variables
echo "Notebooks source: ${AUTODOC_NOTEBOOKS_REPO_URL}/tree/${AUTODOC_NOTEBOOKS_BRANCH}"
- uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ env.python-version }}
cache: "pip"
cache-dependency-path: |
pyproject.toml
- name: Download wheel
uses: actions/download-artifact@v4
with:
pattern: wheels-ubuntu*-${{ env.python-version }}
merge-multiple: true
path: wheels
- name: Install scikit-decide wheel and dependencies
run: |
python -m pip install -U pip setuptools
# find proper wheel and install it
python_version=${{ env.python-version }}
wheelfile=$(ls ./wheels/scikit_decide*-cp${python_version/\./}-*manylinux*.whl)
pip install ${wheelfile}[all]
- name: generate documentation
run: |
yarn global add vuepress && yarn install
export NODE_OPTIONS=--openssl-legacy-provider # avoid issue with node 18 and current dependencies (ok because no interaction with external network during the build)
export DO_SKIP_MZN_CHECK=1 # avoid having to install minizinc for discrete-optimization
yarn docs:build
touch docs/.vuepress/dist/.nojekyll
- name: upload as artifact
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.doc-artifact-name }}
path: ${{ inputs.doc-path }}
Loading

0 comments on commit b70f3a2

Please sign in to comment.