Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into gt2pi
Browse files Browse the repository at this point in the history
  • Loading branch information
saraedum committed Mar 22, 2023
2 parents 6d4c4c2 + 0fce1c5 commit 59cbb68
Show file tree
Hide file tree
Showing 151 changed files with 19,246 additions and 1,677 deletions.
12 changes: 12 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!--
Thank you for your pull request.
Below are a few things we ask you kindly to self-check. Remove checks that are not relevant and let us know if you need help with any of these.
-->
Checklist
* [ ] Added an entry in `doc/news/`. <!-- Copy the TEMPLATE.rst to mybranch.rst, fill in the relevant sections, delete the others. -->
* [ ] Added a test for this change.
* [ ] Added new .py files to the documentation in `doc/geometry` or `doc/graphical`.

<!--
Please add any other relevant info below:
-->
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
submodules: recursive
fetch-depth: 0
- uses: conda-incubator/setup-miniconda@v2
with: { mamba-version: "*", channels: "conda-forge", python-version: "3.9", channel-priority: true }
with: { miniforge-variant: "Mambaforge", miniforge-version: "latest", python-version: "3.9" }
- name: Install dependencies
shell: bash -l {0}
run: |
Expand Down
15 changes: 0 additions & 15 deletions .github/workflows/cancel.yml

This file was deleted.

40 changes: 39 additions & 1 deletion .github/workflows/conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ on:
push: { branches: [ "master" ] }
pull_request: { branches: [ "master" ] }

concurrency:
group: conda-${{ github.ref }}
cancel-in-progress: true

jobs:
conda-build:
runs-on: ubuntu-20.04
Expand All @@ -15,7 +19,37 @@ jobs:
uses: flatsurf/actions/conda-forge-build@main
with:
recipe: recipe
channels: http://conda.anaconda.org/flatsurf
- uses: conda-incubator/setup-miniconda@v2
with: {
miniforge-variant: "Mambaforge",
miniforge-version: "latest",
# Default Python version for binder:
# https://github.com/jupyterhub/repo2docker/blob/master/repo2docker/buildpacks/conda/environment.yml
python-version: "3.7.12"
}
- name: Install package like binder would
shell: bash -l {0}
run: |
wget -O repo2docker.yml https://github.com/jupyterhub/repo2docker/raw/main/repo2docker/buildpacks/conda/environment.yml
mamba install -n test --quiet -y pytest pytest-xdist
mamba env update -n test --quiet -f repo2docker.yml
conda config --set 'custom_channels.conda-build' file://${{ github.workspace }}
sed 's/ - sage-flatsurf=.*/ - conda-build::sage-flatsurf/' < binder/environment.yml > environment.binder.yml
mamba env update -n test --quiet -f environment.binder.yml
conda list
- name: Initialize cppyy
shell: bash -l {0}
run: |
# Show message about cppyy regenerating pre-compiled headers so it does not show during the tests
python -c 'import cppyy' || true
- name: Run SageMath doctests
shell: bash -l {0}
run: |
export PYTHONPATH=test/disable-pytest:$PYTHONPATH
sage -tp --force-lib --long --optional=sage,flipper,eantic,exactreal,pyflatsurf flatsurf doc
- name: Run pytest
shell: bash -l {0}
run: pytest -n auto
- uses: actions/upload-artifact@v2
with:
name: conda-packages
Expand All @@ -24,3 +58,7 @@ jobs:
with:
user: flatsurf
token: ${{ secrets.BINSTAR_TOKEN }}

env:
MAKEFLAGS: -j2
SAGE_NUM_THREADS: 2
17 changes: 13 additions & 4 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
name: Documentation
name: Build Documentation
on:
push: { branches: [ "master" ] }
pull_request: { branches: [ "master" ] }

concurrency:
group: doc-${{ github.ref }}
cancel-in-progress: true

jobs:
build-manual:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with: { submodules: recursive }
- uses: conda-incubator/setup-miniconda@v2
with: { mamba-version: "*", channels: "conda-forge", channel-priority: true }
with: { miniforge-variant: "Mambaforge", miniforge-version: "latest" }
- name: install dependencies
shell: bash -l {0}
run: |
mamba env update -n test --quiet -f flatsurf/environment.yml
mamba env update -n test --quiet -f environment.yml
mamba env update -n test --quiet -f doc/environment.yml
conda list
- name: install sage-flatsurf
Expand All @@ -27,9 +31,14 @@ jobs:
shell: bash -l {0}
run: |
cd doc
make html SPHINXOPTS="-W"
make html SPHINXOPTS="-W -n --keep-going"
# Do not run Jekyll to create GitHub Pages but take HTML files as they are.
touch _build/html/.nojekyll
- name: provide documentation as artifact for netlify workflow
uses: actions/upload-artifact@v3
with:
name: doc
path: doc/_build/html
- uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Lint
on:
push: { branches: [ "master" ] }
pull_request: { branches: [ "master" ] }

concurrency:
group: lint-${{ github.ref }}
cancel-in-progress: true

jobs:
codespell:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with: { submodules: recursive }
- uses: conda-incubator/setup-miniconda@v2
with: { miniforge-variant: "Mambaforge", miniforge-version: "latest" }
- name: Install dependencies
shell: bash -l {0}
run: |
mamba install codespell=2.2.2 pycodestyle=2.9.1
- name: Run codespell
shell: bash -l {0}
run: codespell flatsurf
- name: Run pycodestyle
shell: bash -l {0}
# We currently only check for some warnings. We should enable & fix more of them.
run: pycodestyle --select=E111,E306,E401,E701,E702,E703,E704,W391,W605,E711,E713,E714,E721,E722 flatsurf/
- uses: flatsurf/actions/show-logs@main
if: ${{ always() }}

env:
MAKEFLAGS: -j2
SAGE_NUM_THREADS: 2
96 changes: 96 additions & 0 deletions .github/workflows/netlify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Triggers after the documentation build has finished,
# taking the artifact and uploading it to netlify
# Mostly copied from the SageMath workflow file.
name: Publish Documentation

on:
workflow_run:
workflows: ["Build Documentation"]
types:
- completed

permissions:
statuses: write
checks: write
pull-requests: write

jobs:
upload-docs:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
steps:
- name: Get information about workflow origin
uses: potiuk/get-workflow-origin@v1_5
id: source-run-info
with:
token: ${{ secrets.GITHUB_TOKEN }}
sourceRunId: ${{ github.event.workflow_run.id }}

# Once https://github.com/actions/download-artifact/issues/172 and/or https://github.com/actions/download-artifact/issues/60 is implemented, we can use the official download-artifact action
# For now use the solution from https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#using-data-from-the-triggering-workflow
- name: Download docs
uses: actions/[email protected]
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "doc"
})[0];
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/doc.zip', Buffer.from(download.data));
- name: Extract docs
run: unzip doc.zip -d doc

- name: Deploy to Netlify
id: deploy-netlify
uses: netlify/actions/cli@master
with:
args: deploy --dir=doc ${NETLIFY_PRODUCTION:+"--prod"} --message ${NETLIFY_MESSAGE} --alias ${NETLIFY_ALIAS}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_PRODUCTION: ${{ github.ref == 'refs/heads/master' }}
NETLIFY_MESSAGE: ${{ steps.source-run-info.outputs.pullRequestNumber }}
NETLIFY_ALIAS: deploy-preview-${{ steps.source-run-info.outputs.pullRequestNumber }}

# Add deployment as status check, PR comment and annotation
# we could use the nwtgck/actions-netlify action for that, except for that it is not (yet) working in workflow_run context: https://github.com/nwtgck/actions-netlify/issues/545
- name: Add/Update deployment status PR comment
uses: marocchino/sticky-pull-request-comment@v2
with:
number: ${{ steps.source-run-info.outputs.pullRequestNumber }}
header: preview-comment
recreate: true
message: |
[Documentation preview for this PR](${{ steps.deploy-netlify.outputs.NETLIFY_URL }}) is ready! :tada:
Built with commit: ${{ steps.source-run-info.outputs.sourceHeadSha }}
- name: Update deployment status PR check
uses: myrotvorets/[email protected]
if: ${{ always() }}
env:
DEPLOY_SUCCESS: Successfully deployed preview.
DEPLOY_FAILURE: Failed to deploy preview.
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status == 'success' && 'success' || 'failure' }}
sha: ${{ github.event.workflow_run.head_sha }}
context: Deploy Documentation
targetUrl: ${{ steps.deploy-netlify.outputs.NETLIFY_URL }}
description: ${{ job.status == 'success' && env.DEPLOY_SUCCESS || env.DEPLOY_FAILURE }}

- name: Report deployment url
run: |
echo "::notice::The documentation has being automatically deployed to Netlify. %0A ✅ Preview: ${{ steps.deploy-netlify.outputs.NETLIFY_URL }}"
54 changes: 37 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ on:
push: { branches: [ "master" ] }
pull_request: { branches: [ "master" ] }

concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-20.04
Expand All @@ -11,32 +15,48 @@ jobs:
include:
- optionals: "sage,flipper"
sagelib: "8.8"
environment: "environment.yml"
python: "3.7.12"
- optionals: "sage,flipper"
sagelib: "8.9"
environment: "environment.yml"
python: "3.7.12"
- optionals: "sage,flipper"
sagelib: "9.1"
environment: "environment.yml"
python: "3.7.12"
- optionals: "sage,flipper"
sagelib: "9.2"
python: "3.9.10"
environment: "environment.yml"
python: "3.9.15"
- optionals: "sage,flipper,eantic,exactreal"
sagelib: "9.3"
python: "3.9.10"
environment: "environment.yml"
python: "3.9.15"
- optionals: "sage,flipper,eantic,exactreal,pyflatsurf"
sagelib: "9.4"
python: "3.9.10"
environment: "environment.yml"
python: "3.9.15"
- optionals: "sage,flipper,eantic,exactreal,pyflatsurf"
environment: "binder"
# Default Python version for binder:
# https://github.com/jupyterhub/repo2docker/blob/master/repo2docker/buildpacks/conda/environment.yml
python: "3.7.12"
sagelib: "9.5"
environment: "environment.yml"
python: "3.9.15"
- optionals: "sage,flipper,eantic,exactreal,pyflatsurf"
sagelib: "9.6"
environment: "environment.yml"
python: "3.10.8"
- optionals: "sage,flipper,eantic,exactreal,pyflatsurf"
sagelib: "9.7"
environment: "environment.yml"
python: "3.10.8"
- optionals: "sage,flipper,eantic,exactreal,pyflatsurf"
environment: "flatsurf.yml"
python: "3.10.8"
steps:
- uses: actions/checkout@v2
with: { submodules: recursive }
- uses: conda-incubator/setup-miniconda@v2
with: { mamba-version: "*", channels: "conda-forge", python-version: "${{ matrix.python }}", channel-priority: true }
with: { miniforge-variant: "Mambaforge", miniforge-version: "latest", python-version: "${{ matrix.python }}" }
- name: Install dependencies
shell: bash -l {0}
run: |
Expand All @@ -45,19 +65,18 @@ jobs:
while read; do
optional=$(echo "$REPLY" | grep -o '# optional: [^ ]*' | awk '{ print $3; }') || true
(test "$optional" == '' || (echo "${{ matrix.optionals }}" | grep -E '\b'"$optional"'\b') > /dev/null) && echo "$REPLY" || true
done < flatsurf/environment.yml > flatsurf/environment.test.yml
mamba env update -n test --quiet -f flatsurf/environment.test.yml
done < environment.yml > environment.test.yml
mamba env update -n test --quiet -f environment.test.yml
conda list
if: ${{ matrix.environment != 'binder' }}
- name: Create binder environment
if: ${{ matrix.environment == 'environment.yml' }}
- name: Install dependencies (flatsurf stack)
shell: bash -l {0}
run: |
wget -O repo2docker.yml https://github.com/jupyterhub/repo2docker/raw/main/repo2docker/buildpacks/conda/environment.yml
mamba install -n test --quiet -y pytest pytest-xdist
mamba env update -n test --quiet -f repo2docker.yml
mamba env update -n test --quiet -f binder/environment.yml
# This can fail when a new version of sage-flatsurf is released but
# the package has not been built on conda-forge yet.
mamba env update -n test --quiet -f flatsurf.yml
conda list
if: ${{ matrix.environment == 'binder' }}
if: ${{ matrix.environment == 'flatsurf.yml' }}
- name: Install sage-flatsurf
shell: bash -l {0}
run: |
Expand All @@ -75,6 +94,7 @@ jobs:
- name: Run pytest
shell: bash -l {0}
run: pytest -n auto
if: ${{ matrix.environment == 'environment.yml' }}
- uses: flatsurf/actions/show-logs@main
if: ${{ always() }}

Expand Down
21 changes: 21 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"creators": [
{
"orcid": "0000-0002-9608-782X",
"name": "Delecroix, Vincent",
"affiliation": "CNRS - Université de Bordeaux"
},
{
"name": "W. Patrick Hooper",
"affiliation": "The City College of New York"
},
{
"orcid": "0000-0002-3930-9107",
"name": "Rüth, Julian"
}
],

"license": "GPL-2.0-or-later",
"title": "sage-flatsurf",
"description": "<p>sage-flatsurf is a Python package for working with flat surfaces in SageMath</p>"
}
Loading

0 comments on commit 59cbb68

Please sign in to comment.