Skip to content
Snippets Groups Projects
Unverified Commit adcc893f authored by Richard Ebeling's avatar Richard Ebeling Committed by GitHub
Browse files

Merge pull request #1649 from He3lixxx/vm

VM stuff: autocompletion, base box version, package versions, consolidation
parents 0a5b980f f1fb3e39
Branches
No related tags found
No related merge requests found
......@@ -143,10 +143,12 @@ jobs:
uses: actions/checkout@v2
with:
submodules: true
- name: Install dart-sass
run: deployment/install_dart_sass.sh
- name: Setup Node
uses: actions/setup-node@v2
- name: Install Node dependencies
run: npm ci
- name: Compile Scss
run: sass evap/static/scss/evap.scss evap/static/css/evap.css
run: npx sass evap/static/scss/evap.scss evap/static/css/evap.css
- name: Store Css
uses: actions/upload-artifact@v2
with:
......
......@@ -5,7 +5,7 @@ Vagrant.require_version ">= 1.8.1"
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.box_version = "= 20190621.0.0 "
config.vm.box_version = "= 20210928.0.0 "
# port forwarding
config.vm.network :forwarded_port, guest: 8000, host: 8000 # django server
......
#! /usr/bin/env bash
DART_SASS_STANDALONE_URL="https://github.com/sass/dart-sass/releases/download/1.32.0/dart-sass-1.32.0-linux-x64.tar.gz"
wget $DART_SASS_STANDALONE_URL --no-verbose --output-document - | sudo tar --extract --gzip --directory /usr/local/bin --strip-components 1
#!/usr/bin/env bash
complete -W "changepassword createsuperuser mtime_cache remove_stale_contenttypes check compilemessages createcachetable dbshell diffsettings dumpdata flush inspectdb loaddata makemessages makemigrations migrate sendtestemail shell showmigrations sqlflush sqlmigrate sqlsequencereset squashmigrations startapp startproject test testserver admin_generator clean_pyc compile_pyc create_command create_jobs create_template_tags delete_squashed_migrations describe_form drop_test_database dumpscript export_emails find_template generate_password generate_secret_key graph_models mail_debug merge_model_instances notes passwd pipchecker print_settings print_user_for_session reset_db reset_schema runjob runjobs runprofileserver runscript runserver_plus set_default_site set_fake_emails set_fake_passwords shell_plus show_template_tags show_templatetags show_urls sqlcreate sqldiff sqldsn sync_s3 syncdata unreferenced_files update_permissions validate_templates anonymize dump_testdata refresh_results_cache reload_testdata run scss send_reminders tools update_evaluation_states clearsessions collectstatic findstatic runserver manage.py" python3
complete -W "changepassword createsuperuser mtime_cache remove_stale_contenttypes check compilemessages createcachetable dbshell diffsettings dumpdata flush inspectdb loaddata makemessages makemigrations migrate sendtestemail shell showmigrations sqlflush sqlmigrate sqlsequencereset squashmigrations startapp startproject test testserver admin_generator clean_pyc compile_pyc create_command create_jobs create_template_tags delete_squashed_migrations describe_form drop_test_database dumpscript export_emails find_template generate_password generate_secret_key graph_models mail_debug merge_model_instances notes passwd pipchecker print_settings print_user_for_session reset_db reset_schema runjob runjobs runprofileserver runscript runserver_plus set_default_site set_fake_emails set_fake_passwords shell_plus show_template_tags show_templatetags show_urls sqlcreate sqldiff sqldsn sync_s3 syncdata unreferenced_files update_permissions validate_templates anonymize dump_testdata refresh_results_cache reload_testdata run scss send_reminders tools update_evaluation_states clearsessions collectstatic findstatic runserver manage.py" python
complete -W "changepassword createsuperuser mtime_cache remove_stale_contenttypes check compilemessages createcachetable dbshell diffsettings dumpdata flush inspectdb loaddata makemessages makemigrations migrate sendtestemail shell showmigrations sqlflush sqlmigrate sqlsequencereset squashmigrations startapp startproject test testserver admin_generator clean_pyc compile_pyc create_command create_jobs create_template_tags delete_squashed_migrations describe_form drop_test_database dumpscript export_emails find_template generate_password generate_secret_key graph_models mail_debug merge_model_instances notes passwd pipchecker print_settings print_user_for_session reset_db reset_schema runjob runjobs runprofileserver runscript runserver_plus set_default_site set_fake_emails set_fake_passwords shell_plus show_template_tags show_templatetags show_urls sqlcreate sqldiff sqldsn sync_s3 syncdata unreferenced_files update_permissions validate_templates anonymize dump_testdata refresh_results_cache reload_testdata run scss send_reminders tools update_evaluation_states clearsessions collectstatic findstatic runserver" manage.py
# generated using
# ./manage.py | grep -v -E "^\[|^$" | tail -n +3 | sort | xargs
COMMANDS="admin_generator anonymize changepassword check clean_pyc clear_cache clearsessions collectstatic compile_pyc compilemessages create_command create_jobs create_template_tags createcachetable createsuperuser dbshell delete_squashed_migrations describe_form diffsettings drop_test_database dump_testdata dumpdata dumpscript export_emails find_template findstatic flush format generate_password generate_secret_key graph_models inspectdb lint list_model_info list_signals loaddata mail_debug makemessages makemigrations merge_model_instances migrate notes pipchecker precommit print_settings print_user_for_session refresh_results_cache reload_testdata remove_stale_contenttypes reset_db reset_schema run runjob runjobs runprofileserver runscript runserver runserver_plus scss send_reminders sendtestemail set_default_site set_fake_emails set_fake_passwords shell shell_plus show_template_tags show_urls showmigrations sqlcreate sqldiff sqldsn sqlflush sqlmigrate sqlsequencereset squashmigrations startapp startproject sync_s3 syncdata test testserver tools ts unreferenced_files update_evaluation_states update_permissions validate_templates"
TS_COMMANDS="compile test render_pages"
_managepy_complete()
{
local cur prev
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
if [ "${COMP_CWORD}" -eq 1 ]; then
COMPREPLY=($(compgen -W "${COMMANDS}" -- "${cur}"))
fi
if [ "${COMP_CWORD}" -eq 2 ] && [ "${prev}" == "ts" ]; then
COMPREPLY=($(compgen -W "${TS_COMMANDS}" -- "${cur}"))
fi
}
_python_complete()
{
local cur prev
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}
if [ "${COMP_CWORD}" -eq 1 ]; then
COMPREPLY=($(compgen -f -o filenames -X '!*.py' -- "${cur}"))
fi
if [ "${COMP_CWORD}" -eq 2 ] && [[ "${prev}" == *manage.py ]]; then
COMPREPLY=($(compgen -W "${COMMANDS}" -- "${cur}"))
fi
if [ "${COMP_CWORD}" -eq 3 ] && [ "${prev}" == "ts" ]; then
COMPREPLY=($(compgen -W "${TS_COMMANDS}" -- "${cur}"))
fi
}
complete -F _managepy_complete manage.py
complete -F _python_complete python3
complete -F _python_complete python
......@@ -36,9 +36,6 @@ echo "$USER ALL=(ALL) NOPASSWD:ALL" | tee /etc/sudoers.d/evap
# link the mounted evap folder from the home directory
ln -s /evap $REPO_FOLDER
# install sass
$REPO_FOLDER/deployment/install_dart_sass.sh
sudo -H -u $USER python3.7 -m venv $ENV_FOLDER
# venv will use ensurepip to install a new version of pip. We need to update that version.
sudo -H -u $USER $ENV_FOLDER/bin/python -m pip install -U pip
......@@ -61,6 +58,7 @@ a2dissite 000-default.conf
sed -i s,\#.\ /etc/default/locale,.\ /etc/default/locale,g /etc/apache2/envvars
systemctl reload apache2
cp /etc/skel/.bashrc /home/$USER/
# auto cd into /$USER on login and activate venv
echo "cd $REPO_FOLDER" >> /home/$USER/.bashrc
echo "source $ENV_FOLDER/bin/activate" >> /home/$USER/.bashrc
......@@ -76,7 +74,7 @@ sed -i -e "s/\${SECRET_KEY}/$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32)
cp $REPO_FOLDER/deployment/manage_autocompletion.sh /etc/bash_completion.d/
# install libraries for puppeteer
apt-get -q install -y libasound2 libgconf-2-4 libgbm1 libgtk-3-0 libnss3 libx11-xcb1 libxss1
apt-get -q install -y libasound2 libgconf-2-4 libgbm1 libgtk-3-0 libnss3 libx11-xcb1 libxss1 libxshmfence-dev
# install nvm
wget https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh --no-verbose --output-document - | sudo -H -u $USER bash
......@@ -84,7 +82,7 @@ wget https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh --no-verbos
# setup evap
cd /$USER
git submodule update --init
sudo -H -u $USER bash -c "source /home/$USER/.nvm/nvm.sh; nvm install node; npm ci"
sudo -H -u $USER bash -c "source /home/$USER/.nvm/nvm.sh; nvm install --no-progress node; npm ci"
echo "nvm use node" >> /home/$USER/.bashrc
sudo -H -u $USER $ENV_FOLDER/bin/python manage.py migrate --noinput
sudo -H -u $USER $ENV_FOLDER/bin/python manage.py collectstatic --noinput
......
......@@ -22,6 +22,7 @@ class Command(BaseCommand):
def handle(self, *args, **options):
static_directory = settings.STATICFILES_DIRS[0]
command = [
"npx",
"sass",
os.path.join(static_directory, "scss", "evap.scss"),
os.path.join(static_directory, "css", "evap.css"),
......
......@@ -193,7 +193,7 @@ class TestScssCommand(TestCase):
management.call_command("scss")
mock_subprocess_run.assert_called_once_with(
["sass", self.scss_path, self.css_path],
["npx", "sass", self.scss_path, self.css_path],
check=True,
)
......@@ -204,7 +204,7 @@ class TestScssCommand(TestCase):
management.call_command("scss", "--watch")
mock_subprocess_run.assert_called_once_with(
["sass", self.scss_path, self.css_path, "--watch", "--poll"],
["npx", "sass", self.scss_path, self.css_path, "--watch", "--poll"],
check=True,
)
......@@ -213,7 +213,7 @@ class TestScssCommand(TestCase):
management.call_command("scss", "--production")
mock_subprocess_run.assert_called_once_with(
["sass", self.scss_path, self.css_path, "--style", "compressed", "--no-source-map"],
["npx", "sass", self.scss_path, self.css_path, "--style", "compressed", "--no-source-map"],
check=True,
)
......
......@@ -64,7 +64,10 @@ export function pageHandler(fileName: string, fn: (page: Page) => void): (done?:
await fn(page);
await finish();
} catch (error) {
if (error instanceof Error)
await finish(error);
else
throw error;
}
};
}
This diff is collapsed.
{
"devDependencies": {
"@types/jest": "^26.0.16",
"@types/jest": "^27.0.2",
"@types/jest-environment-puppeteer": "^4.4.0",
"@types/jquery": "^3.5.4",
"@types/puppeteer": "^5.4.1",
"@types/puppeteer": "^5.4.4",
"@types/sortablejs": "^1.3.0",
"jest": "^26.6.3",
"jest-environment-puppeteer": "^4.4.0",
"puppeteer": "^5.5.0",
"ts-jest": "^26.4.4",
"typescript": "^4.1.2"
"jest": "^27.3.1",
"jest-environment-puppeteer": "^6.0.0",
"puppeteer": "^10.4.0",
"ts-jest": "^27.0.7",
"typescript": "^4.4.4",
"sass": "1.32.13"
},
"jest": {
"testRunner": "jest-jasmine2",
"rootDir": "evap/static/ts",
"testMatch": ["**/tests/unit/**/*.ts", "**/tests/frontend/**/*.ts"],
"testMatch": [
"**/tests/unit/**/*.ts",
"**/tests/frontend/**/*.ts"
],
"moduleDirectories": [
"node_modules",
"evap/static/ts"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment