From 2b8de7a760b7d93ec343f9a1e2ce7f062c2ed165 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Sat, 24 Oct 2026 11:24:06 +0200 Subject: [PATCH] [FIX] .github/workflows/test.yml --- .github/workflows/test.yml | 81 ++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 48 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1ac87fd..e259122 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,11 +20,11 @@ jobs: - uses: actions/checkout@v7 - run: | for reqfile in requirements.txt test-requirements.txt ; do - if [ -f "${reqfile}" ] ; then + 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=$? + grep "^[^#].*/" ${reqfile} | grep -v "# SKIP TEST" || result=$? if [ $result -eq 0 ] ; then echo "Unreleased dependencies found in ${reqfile}." exit 1 @@ -33,11 +33,7 @@ jobs: done test: runs-on: ubuntu-latest - container: - image: ${{ matrix.container }} - credentials: - username: ${{ github.actor }} - password: ${{ secrets.PRIVATE_TOKEN }} + container: ${{ matrix.container }} name: ${{ matrix.name }} permissions: pull-requests: write @@ -46,15 +42,14 @@ jobs: fail-fast: false matrix: include: - - container: ghcr.io/noviat-ci/odoo-ci:20.0-stable + - container: ghcr.io/oca/oca-ci/py3.12-odoo20.0:latest name: test with Odoo Community odoo_enterprise : 0 - exclude_modules : "account_asset" - skip: "account_zbics_batch_payment,account_ebics_oe" - - container: ghcr.io/noviat-ci/odoo-ci:20.0-stable + exclude_modules : "" + - container: ghcr.io/oca/oca-ci/py3.12-odoo20.0:latest name: test with Odoo Enterprise odoo_enterprise : 1 - exclude_modules : "account_asset" + exclude_modules : "" makepot: "true" services: postgres: @@ -72,43 +67,43 @@ jobs: - uses: actions/checkout@v7 with: persist-credentials: false - - name: Configure git authentication - env: - TOKEN: ${{ secrets.PRIVATE_TOKEN }} + - name: Upgrade pip in container + run: python -m pip install --upgrade pip + - name: Install Odoo upgrade util + run: python -m pip install git+https://github.com/odoo/upgrade-util@master + - name: Add Noviat CI Tools to PATH 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" + git config --global http.extraHeader "AUTHORIZATION: basic $(printf 'x-access-token:%s' '${{ secrets.PRIVATE_TOKEN }}' | base64 -w 0)" + git clone https://github.com/Noviat-CI/noviat-ci-tools.git /opt/noviat-ci-tools + echo "/opt/noviat-ci-tools" >> $GITHUB_PATH + - name: Clone Odoo Enterprise + if: ${{ matrix.odoo_enterprise == 1 }} + run : | + git clone https://${{ secrets.PRIVATE_TOKEN }}@github.com/odoo/enterprise.git --depth 1 -b 20.0 /opt/enterprise - name: Clone Noviat Dependencies + env: + PRIVATE_TOKEN: ${{ secrets.PRIVATE_TOKEN }} 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:-}" ] + mkdir -p ${{ env.INSTALL_ADDONS_DIR }}/setup + find $(realpath $ADDONS_DIR) $(realpath ${{ env.ADDITIONAL_ADDONS_DIR }}) -name __manifest__.py -exec sh -c 'ln -s "$(dirname "$0")" "${{ env.INSTALL_ADDONS_DIR }}"' {} \; + find $(realpath $ADDONS_DIR) $(realpath ${{ env.ADDITIONAL_ADDONS_DIR }}) -iwholename '*/setup/*/setup.py' -exec sh -c 'ln -s "$(dirname "$0")" "${{ env.INSTALL_ADDONS_DIR }}/setup"' {} \; + if [ -n ${{ matrix.exclude}} ] then - remove_excluded_modules "$INSTALL_ADDONS_DIR" "$EXCLUDE" + remove_excluded_modules ${{ env.INSTALL_ADDONS_DIR }} ${{ matrix.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" + 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" + echo "ADDONS_PATH=/opt/odoo/addons,${{ env.INSTALL_ADDONS_DIR }}" >> $GITHUB_ENV + - name: Inject GitHub token for Noviat orgs in test-requirements.txt + run: | + sed -i -E "s#https://github.com/(Noviat-(Projects|Generic|ARP|Internal))#https://${{ secrets.PRIVATE_TOKEN }}@github.com/\1#g" test-requirements.txt - name: Install addons and dependencies run: | (ADDONS_PATH=${ADDONS_PATH} ADDONS_DIR=${INSTALL_ADDONS_DIR} oca_install_addons) @@ -120,19 +115,10 @@ jobs: - 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' @@ -141,8 +127,7 @@ jobs: 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" + run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY - name: Update .pot files - run: noviat_export_and_push_pot https://github.com/${{ github.repository }} + run: noviat_export_and_push_pot https://x-access-token:${{ secrets.PRIVATE_TOKEN }}@github.com/${{ github.repository }} if: ${{ matrix.makepot == 'true' && github.event_name == 'push' }}