-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: add job and script for rdmo-app check #1
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
|
||
git clone https://$GITHUB_TOKEN@github.com/rdmorganiser/rdmo.git | ||
# need rdmo only for testing/config/settings | ||
git clone https://$GITHUB_TOKEN@github.com/rdmorganiser/rdmo-app.git | ||
|
||
cd rdmo-app || exit 1 | ||
python3 -m venv env | ||
source env/bin/activate | ||
pip install --upgrade pip setuptools | ||
pip install rdmo"[allauth]" | ||
|
||
# install and set-up plugin | ||
cd - || exit 1 | ||
pip install . | ||
cp rdmo_radar/sample.local.py rdmo-app/config/settings/local.py | ||
PLUGIN="$(basename "$(pwd)")" | ||
PLUGIN_NAME="${PLUGIN/rdmo-plugins-/}" | ||
|
||
# set up rdmo-app settings | ||
# write to rdmo-app/config/settings/__init__.py | ||
cp rdmo/testing/config/settings/* rdmo-app/config/settings | ||
cd rdmo-app || exit 1 | ||
mkdir vendor | ||
# set up instance | ||
# python manage.py download_vendor_files # download front-end vendor files | ||
python manage.py migrate # initializes the database | ||
python manage.py setup_groups # optional: create groups with different permissions | ||
|
||
python manage.py loaddata -v 2 "../rdmo/testing/fixtures/users.json" | ||
python manage.py loaddata -v 2 ../rdmo/testing/fixtures/* | ||
|
||
python manage.py check | ||
|
||
# function for testing presence of plugin name in a certain django setting | ||
test_if_settings_contain_plugin () { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thank you @triole! Ive included your suggestions and refactored the last part into a function. Looks good to you? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, this is just testing that the plugin is in settings which is rather pointless, since the settings are part of the test setup. I think a simple |
||
SETTING_NAME=$1 | ||
SETTING_VALUE="$(python manage.py print_settings -f $SETTING_NAME --format=value)" | ||
echo "Testing if the value of the django setting ${SETTING_NAME} contains $2" | ||
if [[ ${SETTING_VALUE} == *"$2"* ]]; then | ||
echo -e "OK, Plugin $2 is in ${SETTING_NAME}.\n\t${SETTING_VALUE}" | ||
else | ||
echo -e "ERROR, Plugin $2 is not in ${SETTING_NAME}.\n\t${SETTING_VALUE}" | ||
exit 1 | ||
fi | ||
} | ||
|
||
test_if_settings_contain_plugin "PROJECT_EXPORTS" $PLUGIN_NAME | ||
|
||
test_if_settings_contain_plugin "PROJECT_IMPORTS" $PLUGIN_NAME |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This part should not be part of the repo. If it is only needed for testing it should just be part of the ci job. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe this can just be solved with some |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# ruff: noqa: F821 | ||
PROJECT_EXPORTS += [ | ||
('radar-xml', _('as RADAR XML'), 'rdmo_radar.exports.RadarExport') | ||
] | ||
PROJECT_IMPORTS += [ | ||
('radar', _('from RADAR XML'), 'rdmo_radar.imports.RadarImport') | ||
] | ||
PROJECT_EXPORTS += [ | ||
('radar', _('directly to RADAR'), 'rdmo_radar.exports.RadarExportProvider') | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the pluging can be tested in
rdmo/testing/
alone, right? So cloning rdmo (no token needed) woulsd suffice.