Skip to content

Commit

Permalink
ci: add job and script for rdmo-app check
Browse files Browse the repository at this point in the history
  • Loading branch information
MyPyDavid committed Feb 1, 2024
1 parent 83fdf47 commit 491337c
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/rdmo-app-ci-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash
git clone git@github.com:rdmorganiser/rdmo-app
# need rdmo only for testing/config/settings
git clone git@github.com:rdmorganiser/rdmo

cd rdmo-app
python3 -m venv env
source env/bin/activate
pip install --upgrade pip setuptools
pip install rdmo"[allauth]"

# install and set-up plugin
cd ..
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
# 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

# test PROJECT_EXPORTS setting
PROJECT_EXPORTS=$(python manage.py print_settings -f PROJECT_EXPORTS --format=value)
echo "Testing for presence of setting in django settings"
if [[ $PROJECT_EXPORTS == *"$PLUGIN_NAME"* ]]; then
echo "Plugin $PLUGIN_NAME is in PROJECT_EXPORTS.\n\t${PROJECT_EXPORTS}"
else
echo "Plugin $PLUGIN_NAME is not in PROJECT_EXPORTS.\n\t${PROJECT_EXPORTS}"
exit 1
fi

# test PROJECT_IMPORTS setting
PROJECT_IMPORTS=$(python manage.py print_settings -f PROJECT_IMPORTS --format=value)
echo "Testing for presence of setting in django settings"
if [[ $PROJECT_IMPORTS == *"$PLUGIN_NAME"* ]]; then
echo "Plugin $PLUGIN_NAME is in PROJECT_IMPORTS.\n\t${PROJECT_IMPORTS}"
else
echo "Plugin $PLUGIN_NAME is not in PROJECT_IMPORTS.\n\t${PROJECT_IMPORTS}"
exit 1
fi
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,20 @@ jobs:
- run: python -Im pip install -e .[dev]
- run: python -Ic 'import rdmo_radar; print(rdmo_radar.__version__)'

rdmo-app-check:
name: Build in rdmo-app
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.12"
cache: pip

- name: Run rdmo-app build and check script
run: bash .github/rdmo-app-ci-script.sh


required-checks-pass:
if: always()
needs:
Expand Down
9 changes: 9 additions & 0 deletions rdmo_radar/sample.local.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
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')
]

0 comments on commit 491337c

Please sign in to comment.