Files
odoo_account_ebics/.github/workflows/test.yml
T
Jérémy Didderen a1fc381121 [IMP] account_ebics - Add unit tests
Add 97 tests:

- account_ebics: order numbers, camt and CFONB split per account,
  journal lookup, duplicate statements, download and upload wizards,
  key initialisation (INI/HIA/HPB), passphrase change, admin orders.
- account_ebics_batch: scheduled import, import log, reprocess.
- account_ebics_payment_order / account_ebics_batch_payment: upload of
  the payment file and link to the payment document.
- account_ebics_statement_import_test (new, test-only, not to install
  in production): installs the OCA camt and CFONB parsers in CI and
  runs the end-to-end statement import.

The bank is simulated by patching ebics.xfer._setup_client, or the
fintech client classes for the key initialisation; keys, certificates
and the INI letter are real, created in a temporary directory.
2026-10-27 23:14:34 +01:00

154 lines
6.0 KiB
YAML

name: tests
on:
pull_request:
branches:
- "18.0*"
push:
branches:
- "18.0"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
unreleased-deps:
runs-on: ubuntu-latest
name: Detect unreleased dependencies
steps:
- uses: actions/checkout@v7
- 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)
# unless they have a "# SKIP TEST" comment
grep "^[^#].*/" "${reqfile}" | grep -v "# SKIP TEST" || result=$?
if [ $result -eq 0 ] ; then
echo "Unreleased dependencies found in ${reqfile}."
exit 1
fi
fi
done
test:
runs-on: ubuntu-latest
container:
image: ${{ matrix.container }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.PRIVATE_TOKEN }}
name: ${{ matrix.name }}
permissions:
pull-requests: write
contents: write
strategy:
fail-fast: false
matrix:
include:
- container: ghcr.io/noviat-ci/odoo-ci:18.0-stable
name: test with Odoo Community
odoo_enterprise : 0
exclude_modules : "account_asset"
skip: "account_ebics_batch_payment,account_ebics_oe,account_ebics_oe_statement_import_test"
- container: ghcr.io/noviat-ci/odoo-ci:18.0-stable
name: test with Odoo Enterprise
odoo_enterprise : 1
exclude_modules : "account_asset"
makepot: "true"
services:
postgres:
image: postgres:12
env:
POSTGRES_USER: odoo
POSTGRES_PASSWORD: odoo
POSTGRES_DB: odoo
ports:
- 5432:5432
env:
INSTALL_ADDONS_DIR: "/tmp/addons-merged"
ADDITIONAL_ADDONS_DIR: "/tmp/additional-addons"
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- name: Configure git authentication
env:
TOKEN: ${{ secrets.PRIVATE_TOKEN }}
run: |
git config --global http.https://github.com/.extraheader "AUTHORIZATION: basic $(printf 'x-access-token:%s' "$TOKEN" | base64 -w0)"
- name: Show the CI image age
run: |
age=$(( ( $(date -u +%s) - $(date -u -d "$NOVIAT_CI_IMAGE_BUILD_DATE" +%s) ) / 86400 ))
echo "Image $NOVIAT_CI_ODOO_VERSION built $NOVIAT_CI_IMAGE_BUILD_DATE ($age days old)" | tee -a "$GITHUB_STEP_SUMMARY"
- name: Clone Noviat Dependencies
run: clone_oca_dependencies_by_noviat
- name: Create addons path
run: |
mkdir -p "$INSTALL_ADDONS_DIR/setup"
find "$(realpath "$ADDONS_DIR")" "$(realpath "$ADDITIONAL_ADDONS_DIR")" -name __manifest__.py -exec sh -c 'ln -s "$(dirname "$0")" "$1"' {} "$INSTALL_ADDONS_DIR" \;
find "$(realpath "$ADDONS_DIR")" "$(realpath "$ADDITIONAL_ADDONS_DIR")" -iwholename '*/setup/*/setup.py' -exec sh -c 'ln -s "$(dirname "$0")" "$1/setup"' {} "$INSTALL_ADDONS_DIR" \;
# EXCLUDE (from matrix.exclude) only exists with rebel module groups
if [ -n "${EXCLUDE:-}" ]
then
remove_excluded_modules "$INSTALL_ADDONS_DIR" "$EXCLUDE"
fi
- name: Skip addons
if: ${{ matrix.skip }}
env:
SKIPPED: ${{ matrix.skip }}
run: |
remove_excluded_modules "$INSTALL_ADDONS_DIR" "$SKIPPED"
echo "EXCLUDE=${EXCLUDE:+$EXCLUDE,}$SKIPPED" >> "$GITHUB_ENV"
echo "Not installed nor tested with Odoo Community: $SKIPPED" | tee -a "$GITHUB_STEP_SUMMARY"
- name: Update addons path with enterprise
if: ${{ matrix.odoo_enterprise == 1 }}
run: |
echo "ADDONS_PATH=/opt/odoo/addons,/opt/enterprise,${{ env.INSTALL_ADDONS_DIR }}" >> "$GITHUB_ENV"
- name: Update addons path without enterprise
if: ${{ matrix.odoo_enterprise == 0 }}
run: |
echo "ADDONS_PATH=/opt/odoo/addons,${{ env.INSTALL_ADDONS_DIR }}" >> "$GITHUB_ENV"
- name: Add addons to EXCLUDE PATH
if: ${{ matrix.EXCLUDE_MODULES }}
run: |
echo "server_wide_modules = web,module_change_auto_install" >> "${ODOO_RC}"
echo "ODOO_MODULES_AUTO_INSTALL_DISABLED=${{ matrix.EXCLUDE_MODULES }}" >> "$GITHUB_ENV"
- name: Install addons and dependencies
run: |
(ADDONS_PATH=${ADDONS_PATH} ADDONS_DIR=${INSTALL_ADDONS_DIR} oca_install_addons)
- name: Install external dependencies of core addons (not in Odoo requirements.txt)
run: |
(ADDONS_DIR=${INSTALL_ADDONS_DIR} noviat_install_odoo_external_dependencies)
- name: Initialize test db
run: oca_init_test_database
- name: Run tests
run: oca_run_tests
- name: Generate coverage files
id: coverage
run: |
# oca_run_tests exits early without coverage data when there is no
# addon to test (e.g. a freshly scaffolded version branch).
if [ -z "$(oca_list_addons_to_test)" ]; then
echo "No addon to test, skipping coverage report."
exit 0
fi
coverage report -m
coverage xml -o coverage.xml
echo "report=true" >> "$GITHUB_OUTPUT"
- name: Code Coverage Summary Report
if: steps.coverage.outputs.report == 'true'
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: 'coverage.xml'
badge: true
format: 'markdown'
output: 'both'
hide_complexity: true
- name: Write to Job Summary
if: steps.coverage.outputs.report == 'true'
run: cat code-coverage-results.md >> "$GITHUB_STEP_SUMMARY"
- name: Update .pot files
run: noviat_export_and_push_pot https://github.com/${{ github.repository }}
if: ${{ matrix.makepot == 'true' && github.event_name == 'push' }}