diff --git a/.circleci/config.yml b/.circleci/config.yml index 5e482ebe..c701888d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,91 +1,34 @@ -# See: https://circleci.com/docs/2.0/language-python/ +version: 2.1 -version: 2 -jobs: +jobs: build-docs: - working_directory: ~/repo docker: - image: cimg/python:3.13 - steps: - checkout - run: name: Install Python dependencies command: | - python3 -m venv venv - source venv/bin/activate - pip install --upgrade pip wheel setuptools - pip install -r site/requirements.txt -r requirements.txt - - - restore_cache: - keys: - - cache-data + python -m pip install --upgrade pip tox - run: - name: Build site - no_output_timeout: 30m + name: Build documentation + no_output_timeout: 60m + environment: + # Ensure this is same as store_artifacts path below + DOCS_PATH: _build/html command: | - # NOTE: blas multithreading behaves badly on circleci + export BASE_URL="/output/job/$CIRCLE_WORKFLOW_JOB_ID/artifacts/0/$DOCS_PATH" export OMP_NUM_THREADS=1 - source venv/bin/activate - # n = nitpicky (broken links), W = warnings as errors, - # T = full tracebacks, keep-going = run to completion even with errors - make -C site/ SPHINXOPTS="-nWT --keep-going" html - - - save_cache: - key: cache-data - paths: - - _data + python -m tox -e py313-buildhtml - store_artifacts: - path: site/_build/html - - - persist_to_workspace: - root: site/_build - paths: html - - deploy-docs: - working_directory: ~/repo - docker: - - image: cimg/python:3.13 - steps: - - checkout - - - attach_workspace: - at: site/_build - - - run: - name: install deploy deps - command : | - python3 -m pip install --user ghp-import - - - run: - name: configure git - command: | - git config --global user.name "ci-doc-deploy-bot" - git config --global user.email "ci-doc-deploy-bot@nomail" - git config --global push.default simple - - - add_ssh_keys: - fingerprints: - 5c:54:62:37:75:7f:4d:14:f4:07:82:1c:50:0d:ee:9b - - - run: - name: deploy to gh-pages - command: | - ghp-import -n -f -p -m "[skip ci] docs build of $CIRCLE_SHA1" site/_build/html - + path: _build/html workflows: version: 2 - build: + build-and-docs: jobs: - build-docs - - deploy-docs: - requires: - - build-docs - filters: - branches: - only: main diff --git a/.github/workflows/ci_publish.yml b/.github/workflows/ci_publish.yml new file mode 100644 index 00000000..510284af --- /dev/null +++ b/.github/workflows/ci_publish.yml @@ -0,0 +1,46 @@ +name: Build and Publish HTML and deployed_notebooks + +on: + push: + branches: + - main + schedule: + - cron: '0 5 * * 1' + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + # `BASE_URL` determines, relative to the root of the domain, the URL that your site is served from. + # E.g., if your site lives at `https://mydomain.org/myproject`, set `BASE_URL=/myproject`. + # If, instead, your site lives at the root of the domain, at `https://mydomain.org`, set `BASE_URL=''`. + BASE_URL: /${{ github.event.repository.name }} + +jobs: + + publish_html: + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + name: Publish HTML + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + + - name: Setup Python + uses: actions/setup-python@v6 + with: + python-version: '3.12' + + - name: Install dependencies + run: python -m pip install --upgrade tox + + - name: Execute notebooks while building HTMLs + run: tox -e py312-buildhtml + + - name: Publish + uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./_build/html/ + commit_message: ${{ github.event.head_commit.message }} diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci-artifacts-redirector.yml similarity index 83% rename from .github/workflows/circleci.yml rename to .github/workflows/circleci-artifacts-redirector.yml index 35c4c076..95a7e6b8 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci-artifacts-redirector.yml @@ -11,3 +11,5 @@ jobs: api-token: ${{ secrets.CIRCLE_TOKEN }} artifact-path: 0/site/_build/html/index.html circleci-jobs: build-docs + domain: circle.scientific-python.dev + job-title: "--> Rendering Preview <--"