-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitpod.yml
117 lines (112 loc) · 5.89 KB
/
.gitpod.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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 [email protected]:sage.git -t master
git remote set-url --push trac [email protected]: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