Skip to content

Merge pull request #632 from OpenSPP/farm-demo-generator-improvements #1611

Merge pull request #632 from OpenSPP/farm-demo-generator-improvements

Merge pull request #632 from OpenSPP/farm-demo-generator-improvements #1611

Workflow file for this run

name: tests (forked+locked)
# fetching the OpenG2P dependencies from the OpenSPP forks of OpenG2P, locked to the version of the OpenSPP 17.0.1.2 (batanes) release
on:
pull_request:
branches:
- "17.0*"
push:
branches:
- "17.0"
- "17.0-ocabot-*"
- "farmer-registry"
env:
OCA_GIT_USER_NAME: openspp
OCA_GIT_USER_EMAIL: [email protected]
jobs:
unreleased-deps:
runs-on: ubuntu-latest
name: Detect unreleased dependencies
steps:
- uses: actions/checkout@v4
- run: |
for reqfile in requirements.txt test-requirements.txt ; do
if [ -f ${reqfile} ] ; then
result=0
# reject non-comment lines that contain a / (i.e. URLs, relative paths)
grep "^[^#].*/" ${reqfile} || result=$?
if [ $result -eq 0 ] ; then
echo "Unreleased dependencies found in ${reqfile}."
# exit 1
fi
fi
done
test:
runs-on: ubuntu-22.04
container: ${{ matrix.container }}
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- container: ghcr.io/openspp/oca-ci/py3.10-odoo17.0:jammy
name: test with Odoo 17/Ubuntu 22.04
makepot: "true"
sonar: "true"
services:
postgres:
image: postgis/postgis:15-3.4
env:
POSTGRES_USER: odoo
POSTGRES_PASSWORD: odoo
POSTGRES_DB: odoo
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
# with:
# persist-credentials: false
- name: Disable demo data
run: |
echo "without_demo = all" >> /etc/odoo.cfg
cat /etc/odoo.cfg
- name: Remove OpenG2P stubs from openspp-modules
run: |
rm -rf g2p_bank
rm -rf g2p_bank_rest_api
rm -rf g2p_encryption
rm -rf g2p_encryption_keymanager
rm -rf g2p_encyption_rest_api
rm -rf g2p_entitlement_cash
rm -rf g2p_enumerator
rm -rf g2p_openid_vci
rm -rf g2p_openid_vci_rest_api
rm -rf g2p_programs
rm -rf g2p_registry_base
rm -rf g2p_registry_documents
rm -rf g2p_registry_encryption
rm -rf g2p_registry_group
rm -rf g2p_registry_individual
rm -rf g2p_registry_membership
rm -rf g2p_registry_rest_api
rm -rf muk_web_appsbar
rm -rf muk_web_chatter
rm -rf muk_web_colors
rm -rf muk_web_dialog
rm -rf muk_web_theme
- name: Remove g2p_connect_demo from openspp-modules as it is not compatible with all OpenSPP variants
run: |
rm -rf g2p_connect_demo
- name: Create temporary test-requirement.txt
run: |
touch spp-test-requirements.txt
echo "--index-url=https://pypi.openspp.org/simple/" >> spp-test-requirements.txt
echo "--extra-index-url=https://pypi.org/simple/" >> spp-test-requirements.txt
cat test-requirements.txt >> spp-test-requirements.txt
# Clone OpenG2P Registry repository
- name: Turn off git detached head warnings
run: git config --global advice.detachedHead false
- name: Clone OpenG2P Registry Repository
run: git clone https://github.com/OpenSPP/openg2p-registry.git --depth 1 --branch 17.0-develop-openspp
- name: Clone OpenG2P Programs Repository
run: git clone https://github.com/OpenSPP/openg2p-program.git --depth 1 --branch 17.0-develop-openspp
- name: Clone Muk Addons Repository
run: git clone https://github.com/OpenSPP/mukit-modules.git --depth 1 --branch 17.0-openspp
- name: Copy OpenG2P modules to addons directory, remove tests and unsupported modules
run: |
rm -rf openg2p-registry/*/tests
rm -rf openg2p-registry/g2p_documents
rm -rf openg2p-registry/g2p_encryption_keymanager
rm -rf openg2p-registry/g2p_odk_importer
rm -rf openg2p-registry/g2p_odk_user_mapping
rm -rf openg2p-registry/g2p_profile_image
rm -rf openg2p-registry/g2p_registry_documents
rm -rf openg2p-registry/g2p_registry_encryption
rm -rf openg2p-program/*/tests
rm -rf openg2p-program/g2p_entitlement_voucher
rm -rf openg2p-program/g2p_odk_importer_program
rm -rf openg2p-program/g2p_formio
rm -rf openg2p-program/g2p_notifications_voucher
rm -rf openg2p-program/g2p_payment_cash
rm -rf openg2p-program/g2p_payment_files
rm -rf openg2p-program/g2p_payment_g2p_connect
rm -rf openg2p-program/g2p_program_documents
rm -rf mukit-modules/muk_web_enterprise_theme
cp -r openg2p-registry/* ${ADDONS_DIR}/
cat test-requirements.txt >> spp-test-requirements.txt
cp -r openg2p-program/* ${ADDONS_DIR}/
# ----------------------------------------------------------------------------
# Do not add test-requirements.txt to spp-test-requirements.txt as those requirements overwrite the
# openspp-modules branch we are building
# cat test-requirements.txt >> spp-test-requirements.txt
# ----------------------------------------------------------------------------
# MUK Addons
cp -r mukit-modules/* ${ADDONS_DIR}/
- name: Add g2p-programs and odoo-test-helper to spp-test-requirements.txt
run: |
echo "git+https://github.com/OpenSPP/[email protected]#subdirectory=g2p_programs" >> spp-test-requirements.txt
echo "git+https://github.com/OpenSPP/[email protected]#subdirectory=extendable" >> spp-test-requirements.txt
echo "git+https://github.com/OpenSPP/[email protected]#subdirectory=extendable_fastapi" >> spp-test-requirements.txt
echo "odoo-test-helper" >> spp-test-requirements.txt
- name: Replace test-requirements.txt with spp-test-requirements.txt
run: |
cp spp-test-requirements.txt test-requirements.txt
cat test-requirements.txt
sed -i '/openspp-modules/! { /OpenG2P\/openg2p/ { s|OpenG2P/openg2p-|OpenSPP/openg2p-|g; s/@17.0-develop\b/@17.0-develop-openspp/; s/@17.0\b/@17.0-openspp/; }; /OpenG2P\/[^o]/ { s|OpenG2P/|OpenSPP/openg2p-|g; s/@17.0-develop\b/@17.0-develop-openspp/; s/@17.0\b/@17.0-openspp/; }; s/@17.0-openspp-develop-openspp\b/@17.0-develop-openspp/g; s/@17.0-openspp\b/@17.0-openspp/g; }' test-requirements.txt
cat test-requirements.txt
- name: Install addons and dependencies
env:
SKIP_EXT_DEB_DEPENDENCIES: "true"
EXCLUDE_REGEX: "odoo-addon-g2p.*|odoo-addon-muk.*"
run: oca_install_addons
- name: Check licenses
run: manifestoo -d . check-licenses
continue-on-error: true
- name: Check development status
run: manifestoo -d . check-dev-status --default-dev-status=Beta
continue-on-error: true
- name: Initialize test db
run: oca_init_test_database
- name: Remove test files from pip-installed addons
run: |
rm -rf /opt/odoo-venv/lib/python3.10/site-packages/odoo/addons/g2p_programs/tests
rm -rf /opt/odoo-venv/lib/python3.10/site-packages/odoo/addons/g2p_registry_individual/tests
- name: Run tests
env:
EXCLUDE: "fastapi,g2p_auth_id_oidc,g2p_auth_oidc,g2p_bank,g2p_bank_rest_api,g2p_change_log,g2p_disable_password_login,g2p_encryption,g2p_encryption_keymanager,g2p_encryption_rest_api,g2p_entitlement_differential,g2p_entitlement_in_kind,g2p_entitlement_voucher,g2p_enumerator,g2p_formio,g2p_mis_importer,g2p_mts,g2p_notifications_base,g2p_notifications_fast2sms,g2p_notifications_voucher,g2p_notifications_wiserv,g2p_odk_importer,g2p_odk_importer_program,g2p_odk_user_mapping,g2p_openid_vci,g2p_openid_vci_programs,g2p_openid_vci_rest_api,g2p_payment_cash,g2p_payment_files,g2p_payment_g2p_connect,g2p_payment_interop_layer,g2p_payment_phee,g2p_payment_simple_mpesa,g2p_portal_auth,g2p_profile_image,g2p_program_approval,g2p_program_assessment,g2p_program_autoenrol,g2p_program_cycleless,g2p_program_documents,g2p_program_registrant_info,g2p_program_reimbursement,g2p_programs,g2p_proxy_means_test,g2p_registry_addl_info,g2p_registry_base,g2p_registry_encryption,g2p_registry_group,g2p_registry_individual,g2p_registry_membership,g2p_registry_rest_api,g2p_service_provider_beneficiary_management,g2p_service_provider_portal_base,g2p_social_registry_importer,g2p_superset_dashboard,g2p_theme,mts_connector,muk_product,muk_web_appsbar,muk_web_chatter,muk_web_colors,muk_web_dialog,muk_web_theme"
run: oca_run_tests
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Update .pot files
run: oca_export_and_push_pot https://x-access-token:${{ secrets.GIT_PUSH_TOKEN }}@github.com/${{ github.repository }}
if: ${{ matrix.makepot == 'true' && github.event_name == 'push' && github.repository_owner == 'openspp' }}