This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
281 additions
and
23 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# Use custom docker image. https://www.gitpod.io/docs/config-docker | ||
image: | ||
# Each of these two options works: | ||
# - Directly use the "-with-targets" image built by .github/workflows/tox.yml | ||
# image: ghcr.io/sagemath/sage/sage-docker-gitpod-standard-with-targets:dev | ||
# - or go through a custom Dockerfile, which builds a smaller image | ||
# based on the "-with-system-packages" image built by .github/workflows/tox.yml | ||
# with the built SAGE_LOCAL from the "-with-targets" image copied in. | ||
file: docker/.gitpod.Dockerfile | ||
|
||
# We use the following layout: | ||
# | ||
# $HOME/sage Source tree used by the Docker build; see SAGE_ROOT/tox.ini (gitpod). | ||
# - We delete it in every invocation of the 'before' script | ||
# and replace it by a symlink to /workspace/... | ||
# (This symlink is needed because the package-removal scripts | ||
# ({prefix,venv}/var/lib/sage/scripts/*/{spkg-piprm,spkg-prerm,spkg-postrm) | ||
# hardcode SAGE_ROOT and SAGE_SRC from package installation time) | ||
# $HOME/sage/logs Logs of the Docker build. | ||
# - In the first invocation of the 'before' script, we move it | ||
# to /workspace/.../logs | ||
# $HOME/sage-local The configured prefix (SAGE_LOCAL) of the Sage installation. | ||
# - During the Docker build, this is the physical location. | ||
# - In the first invocation of the 'before' script, we move it | ||
# to the new physical location /workspace/.../local | ||
# (because gitpod only preserves the contents of /workspace) | ||
# and replace it by a symlink to the new physical location. | ||
# - In subsequent invocations of the 'before' script, we | ||
# remove it and replace it by a symlink to the physical | ||
# location /workspace/.../local | ||
# /worktree/.../local The physical location of the Sage installation, | ||
# established in the first run of the 'before' script and | ||
# preserved by gitpod. | ||
|
||
# Start up tasks. https://www.gitpod.io/docs/config-start-tasks/ | ||
tasks: | ||
- name: Setup | ||
before: | | ||
# Setup ssh key for authentication with trac | ||
## In order to use this, generate a new key with `ssh-keygen -f tempkey` and save the private key to gitpod `gp env PRIVATE_SSH_KEY="$(<tempkey)"` (or by following https://www.gitpod.io/docs/environment-variables#using-the-account-settings) | ||
## then follow https://doc.sagemath.org/html/en/developer/trac.html#linking-your-public-key-to-your-trac-account to register the public key with trac. | ||
mkdir -p ~/.ssh | ||
echo $PRIVATE_SSH_KEY | sed 's/\(-----\(BEGIN\|END\) OPENSSH PRIVATE KEY-----\)/\n\1\n/g' > ~/.ssh/id_rsa | ||
sed -i '/^$/d' ~/.ssh/id_rsa | ||
chmod 600 ~/.ssh/id_rsa | ||
unset PRIVATE_SSH_KEY | ||
ssh-keyscan -H trac.sagemath.org >> ~/.ssh/known_hosts | ||
## No need for pyenv | ||
pyenv shell --unset | ||
pyenv global system | ||
if [ -d local ]; then | ||
mkdir -p logs && echo '### .gitpod.yml Setup.before: Prebuild init script has been run. Running "make" again in case the build had timed out.' >> logs/install.log | ||
# The init script has already populated the SAGE_LOCAL, | ||
# but only /workspace is preserved; and the $HOME/sage-local may contain a resurrected | ||
# copy of sage-local. Replace it again by a symlink. | ||
rm -Rf $HOME/sage-local | ||
ln -sf $(pwd)/local $HOME/sage-local | ||
# Now run make. No timeout here. | ||
MAKE='make -j24' make build V=0 | ||
else | ||
# Prebuild init script has not been run | ||
# Only /workspace is preserved during build. | ||
# If the Docker image contains a built SAGE_LOCAL, use it to populate the SAGE_LOCAL in the workspace. | ||
if [ -d $HOME/sage-local ]; then | ||
mv $HOME/sage-local local | ||
fi | ||
rm -Rf $HOME/sage-local | ||
ln -sf $(pwd)/local $HOME/sage-local | ||
# Save the logs of the source tree used by the Docker build | ||
if [ -d $HOME/sage/logs ]; then | ||
mv $HOME/sage/logs logs | ||
fi | ||
fi | ||
# Remove the source tree used by the Docker build and replace it by a symlink | ||
rm -Rf $HOME/sage | ||
ln -s $(pwd) $HOME/sage | ||
init: | | ||
# Setup trac repo | ||
git remote add trac git@trac.sagemath.org:sage.git -t master | ||
git remote set-url --push trac git@trac.sagemath.org:sage.git | ||
# Start build | ||
mkdir -p logs && echo '### .gitpod.yml Setup.init: Starting build' >> logs/install.log | ||
./bootstrap | ||
./configure --enable-editable --enable-download-from-upstream-url --prefix=$HOME/sage-local --with-sage-venv | ||
## Gitpod has a timeout of 1h, so make sure we are below this to ensure that the prebuild is always successful | ||
MAKE='make -j24' timeout 51m make build V=0 || echo "(ignoring error)" | ||
env: | ||
SAGE_NUM_THREADS: 8 | ||
|
||
# Preinstalled VS Code extensions. https://www.gitpod.io/docs/vscode-extensions | ||
vscode: | ||
extensions: | ||
- ms-pyright.pyright | ||
- ms-python.python | ||
- trond-snekvik.simple-rst | ||
- lextudio.restructuredtext | ||
- streetsidesoftware.code-spell-checker | ||
- ms-toolsai.jupyter | ||
|
||
# https://www.gitpod.io/docs/prebuilds#github-specific-configuration | ||
github: | ||
prebuilds: | ||
# enable for the default branch (defaults to true) | ||
master: true | ||
# enable for all branches in this repo (defaults to false) | ||
branches: true | ||
# enable for pull requests coming from this repo (defaults to true) | ||
pullRequests: true | ||
# enable for pull requests coming from forks (defaults to false) | ||
pullRequestsFromForks: true | ||
# add a check to pull requests (defaults to true) | ||
addCheck: true | ||
# add a "Review in Gitpod" button as a comment to pull requests (defaults to false) | ||
addComment: true | ||
# add a "Review in Gitpod" button to the pull request's description (defaults to false) | ||
addBadge: true |
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
ARG BASE_GITHUB_REPOSITORY=sagemath/sage | ||
ARG BASE_TAG=dev | ||
FROM ghcr.io/${BASE_GITHUB_REPOSITORY}/sage-docker-gitpod-standard-with-targets:${BASE_TAG} as with-targets | ||
RUN sudo rm -rf /var/cache/debconf/* /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
# Fast doc rebuilds do not work because | ||
# "loading pickled environment... failed; source directory has changed" | ||
# Until this is fixed, we can as well remove the whole documentation, which saves a lot of space. | ||
RUN rm -Rf /home/gitpod/sage-local/share/doc/sage | ||
|
||
FROM ghcr.io/${BASE_GITHUB_REPOSITORY}/sage-docker-gitpod-standard-with-system-packages:${BASE_TAG} | ||
COPY --chown=gitpod:gitpod --from=with-targets /home/gitpod/sage/logs /home/gitpod/sage/logs | ||
COPY --chown=gitpod:gitpod --from=with-targets /home/gitpod/sage-local /home/gitpod/sage-local |
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
Oops, something went wrong.