From b4a1db61272c5ea9c34f3f7599bf86474d26887e Mon Sep 17 00:00:00 2001 From: Ivan Sokolov Date: Thu, 28 Nov 2024 22:48:54 +0100 Subject: [PATCH] [FIX] return runboat GitHub token to env --- ... 'GitHub' %}test.yml{% endif %} copy.jinja | 182 ++++++++++++++++++ 1 file changed, 182 insertions(+) create mode 100644 src/.github/workflows/{% if ci == 'GitHub' %}test.yml{% endif %} copy.jinja diff --git a/src/.github/workflows/{% if ci == 'GitHub' %}test.yml{% endif %} copy.jinja b/src/.github/workflows/{% if ci == 'GitHub' %}test.yml{% endif %} copy.jinja new file mode 100644 index 0000000..5194bd5 --- /dev/null +++ b/src/.github/workflows/{% if ci == 'GitHub' %}test.yml{% endif %} copy.jinja @@ -0,0 +1,182 @@ +name: tests + +on: + pull_request: + branches: + - "{{ odoo_version }}*" + push: + branches: + - "{{ odoo_version }}" + - "{{ odoo_version }}-dev" + +{% +set IMAGES = { + "odoo": { + 18.0: "ghcr.io/oca/oca-ci/py3.10-odoo18.0:latest", + 17.0: "ghcr.io/oca/oca-ci/py3.10-odoo17.0:latest", + 16.0: "ghcr.io/oca/oca-ci/py3.10-odoo16.0:latest", + 15.0: "ghcr.io/oca/oca-ci/py3.8-odoo15.0:latest", + 14.0: "ghcr.io/oca/oca-ci/py3.6-odoo14.0:latest", + 13.0: "ghcr.io/oca/oca-ci/py3.6-odoo13.0:latest", + 12.0: "ghcr.io/oca/oca-ci/py3.6-odoo12.0:latest", + 11.0: "ghcr.io/oca/oca-ci/py3.5-odoo11.0:latest", + 10.0: "ghcr.io/oca/oca-ci/py2.7-odoo10.0:latest", + }, + "ocb": { + 18.0: "ghcr.io/oca/oca-ci/py3.10-ocb18.0:latest", + 17.0: "ghcr.io/oca/oca-ci/py3.10-ocb17.0:latest", + 16.0: "ghcr.io/oca/oca-ci/py3.10-ocb16.0:latest", + 15.0: "ghcr.io/oca/oca-ci/py3.8-ocb15.0:latest", + 14.0: "ghcr.io/oca/oca-ci/py3.6-ocb14.0:latest", + 13.0: "ghcr.io/oca/oca-ci/py3.6-ocb13.0:latest", + 12.0: "ghcr.io/oca/oca-ci/py3.6-ocb12.0:latest", + 11.0: "ghcr.io/oca/oca-ci/py3.5-ocb11.0:latest", + 10.0: "ghcr.io/oca/oca-ci/py2.7-ocb10.0:latest", + } +} +-%} +{%- set env = dict() -%} + +{%- if rebel_module_groups -%} +{%- set _ = env.update({ + "INCLUDE": "${{ matrix.include }}", + "EXCLUDE": "${{ matrix.exclude }}" + }) +-%} +{%- endif -%} + +{%- if enable_checklog_odoo -%} +{% set _ = env.update({"OCA_ENABLE_CHECKLOG_ODOO": "1"}) -%} +{%- endif -%} + +{%- if github_ci_extra_env -%} +{% set _ = env.update(github_ci_extra_env) -%} +{%- endif -%} + +jobs: + unreleased-deps: + runs-on: ubuntu-latest + name: Detect unreleased dependencies + steps: + - uses: actions/checkout@v3 + - 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: +{%- if odoo_version < 14 %} + runs-on: ubuntu-20.04 +{%- else %} + runs-on: ubuntu-22.04 +{%- endif %} + container: {% raw %}${{ matrix.container }}{% endraw %} + name: {% raw %}${{ matrix.name }}{% endraw %} + strategy: + fail-fast: false + matrix: + {%- if rebel_module_groups %} + include: + {%- for group in rebel_module_groups %} + {%- if odoo_test_flavor in ["Odoo", "Both"] %} + - container: {{ IMAGES["odoo"][odoo_version] }} + include: "{{ group }}" + makepot: "false" + name: test with Odoo + {%- endif %} + {%- if odoo_test_flavor in ["OCB", "Both"] %} + - container: {{ IMAGES["ocb"][odoo_version] }} + include: "{{ group }}" + name: test with OCB + {%- endif %} + makepot: "{{ github_enable_makepot | bool | lower }}" + {%- endfor %} + {%- if odoo_test_flavor in ["Odoo", "Both"] %} + - container: {{ IMAGES["odoo"][odoo_version] }} + exclude: "{{ rebel_module_groups|join(',') }}" + makepot: "false" + name: test with Odoo + {%- endif %} + {%- if odoo_test_flavor in ["OCB", "Both"] %} + - container: {{ IMAGES["ocb"][odoo_version] }} + exclude: "{{ rebel_module_groups|join(',') }}" + name: test with OCB + {%- endif %} + makepot: "{{ github_enable_makepot | bool | lower }}" + {%- else %} + {#- If all modules can get along, we test and generate .pot all at once #} + include: + {%- if odoo_test_flavor in ["Odoo", "Both"] %} + - container: {{ IMAGES["odoo"][odoo_version] }} + makepot: "false" + name: test with Odoo + {%- endif %} + {%- if odoo_test_flavor in ["OCB", "Both"] %} + - container: {{ IMAGES["ocb"][odoo_version] }} + name: test with OCB + {%- endif %} + makepot: "{{ github_enable_makepot | bool | lower }}" + {%- endif %} + services: + postgres: + {%- if odoo_version < 16 %} + image: postgres:9.6 + {%- else %} + image: postgres:12.0 + {%- endif %} + env: + POSTGRES_USER: odoo + POSTGRES_PASSWORD: odoo + POSTGRES_DB: odoo + ports: + - 5432:5432 + {%- if env %} + env: + {%- for key, value in env.items() %} + {{ key }}: {{ value|to_json }} + {%- endfor %} + env: + RUNBOAT_GITHUB_TOKEN: {{"${{ secrets.GIT_PUSH_TOKEN }}""}} + steps: + - uses: actions/checkout@v3 + with: + persist-credentials: false + {%- if github_odoo_ee %} + - name: Clone EE repo + {% raw -%} + run: curl -sSL https://${{ secrets.GIT_PUSH_TOKEN }}@github.com/cetmix/enterprise/tarball/$ODOO_VERSION | tar zxf - --strip-components=1 -C $ADDONS_PATH + {%- endraw %} + {%- endif %} + - name: Install addons and dependencies + run: oca_install_addons + - name: Check licenses + run: manifestoo -d . check-licenses + {%- if not github_check_license %} + continue-on-error: true + {%- endif %} + - name: Check development status + run: manifestoo -d . check-dev-status --default-dev-status=Beta + {%- if not github_enforce_dev_status_compatibility %} + continue-on-error: true + {%- endif %} + - name: Initialize test db + run: oca_init_test_database + - name: Run tests + run: oca_run_tests + {%- if github_enable_codecov %} + - uses: codecov/codecov-action@v4 + with: + token: {{"${{ secrets.CODECOV_TOKEN }}"}} + {%- endif %} + {% raw -%} + - name: Update .pot files + run: oca_export_and_push_pot https://x-access-token:${{ secrets.GIT_PUSH_TOKEN }}@github.com/${{ github.repository }} + {%- endraw %} + if: {{ "${{" }} matrix.makepot == 'true' && github.event_name == 'push' && github.repository_owner == '{{ org_slug }}' {{ "}}" }}