|
| 1 | +name: Generate test database |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + required: true |
| 8 | + type: string |
| 9 | + python_version: |
| 10 | + default: "3.10" |
| 11 | + type: string |
| 12 | + postgres_version: |
| 13 | + default: "14" |
| 14 | + type: string |
| 15 | + exclude_modules: |
| 16 | + default: "[]" |
| 17 | + type: string |
| 18 | + release_tag: |
| 19 | + default: "databases" |
| 20 | + type: string |
| 21 | +jobs: |
| 22 | + generate-testdb: |
| 23 | + name: Generate test database ${{ inputs.version }} |
| 24 | + runs-on: ubuntu-22.04 |
| 25 | + container: ghcr.io/oca/oca-ci/py${{ inputs.python_version }}-ocb${{ inputs.version }}:latest |
| 26 | + env: |
| 27 | + PGHOST: "postgres" |
| 28 | + PGPASSWORD: "odoo" |
| 29 | + PGUSER: "odoo" |
| 30 | + VERSION: "${{ inputs.version }}" |
| 31 | + DBNAME: "openupgrade" |
| 32 | + services: |
| 33 | + postgres: |
| 34 | + image: postgres:${{ inputs.postgres_version }} |
| 35 | + env: |
| 36 | + POSTGRES_USER: odoo |
| 37 | + POSTGRES_PASSWORD: odoo |
| 38 | + ports: |
| 39 | + - 5432:5432 |
| 40 | + steps: |
| 41 | + - name: Checkout |
| 42 | + uses: actions/checkout@v4 |
| 43 | + - name: Install extra dependencies |
| 44 | + run: | |
| 45 | + # this is for l10n_eg_edi_eta which crashes without it |
| 46 | + pip install asn1crypto |
| 47 | + # this is for cloud_storage_google |
| 48 | + pip install google-auth |
| 49 | + # this is for account_peppol |
| 50 | + pip install phonenumbers |
| 51 | + # for pushing release |
| 52 | + apt install gh -y |
| 53 | + - name: Install all modules and an extra language |
| 54 | + run: | |
| 55 | + odoo -d $DBNAME -i base --stop-after-init |
| 56 | + odoo shell -d $DBNAME <<EOF |
| 57 | + # be sure attachments go into the database |
| 58 | + env['ir.config_parameter'].set_param('ir_attachment.location', 'db') |
| 59 | + env['ir.attachment'].force_storage() |
| 60 | + env['ir.module.module'].search([ |
| 61 | + ('name', 'not in', ${{ inputs.exclude_modules }}), |
| 62 | + ('name', 'not ilike', 'test_%'), |
| 63 | + ('name', 'not ilike', 'hw_%'), |
| 64 | + ]).button_immediate_install() |
| 65 | + env.cr.commit() |
| 66 | + EOF |
| 67 | + odoo -d $DBNAME --load-language=fr_FR --stop-after-init |
| 68 | + - name: Dump database |
| 69 | + run: | |
| 70 | + pg_dump $DBNAME -Fc -f $VERSION.psql |
| 71 | + - name: Upload database dump to release |
| 72 | + env: |
| 73 | + GH_TOKEN: ${{ github.token }} |
| 74 | + run: | |
| 75 | + git config --global --add safe.directory $(pwd) |
| 76 | + gh release upload ${{ inputs.release_tag }} $VERSION.psql --clobber |
0 commit comments