refactor(workflows): use reusable workflows with a single branch #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test and Publish | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "**/resources/**" | |
| - Dockerfile | |
| pull_request: | |
| paths: | |
| - "**/workflows/**" | |
| - "**/resources/**" | |
| - Dockerfile | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| name: Build Odoo ${{ matrix.odoo_version }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| odoo_version: ["15.0", "16.0", "17.0", "18.0", master] | |
| include: | |
| # Keep compatibility with the oldest supported Odoo version | |
| - odoo_version: "15.0" | |
| python_version: 3.10-slim | |
| os_variant: bullseye | |
| uses: ./.github/workflows/image-builder.yaml | |
| with: | |
| odoo_version: ${{ matrix.odoo_version }} | |
| python_version: ${{ matrix.python_version != null && matrix.python_version || '' }} | |
| os_variant: ${{ matrix.os_variant != null && matrix.os_variant || '' }} | |
| dockerfile_path: Dockerfile | |
| dockerfile_target: production | |
| secrets: inherit | |
| test: | |
| needs: build | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| odoo_version: ["15.0", "16.0", "17.0", "18.0", master] | |
| exclude: | |
| # TODO: Tests are failing on master. Remove this when fixed | |
| # See: https://github.com/odoo/odoo/pull/44001#issuecomment-2808975399 | |
| - odoo_version: master | |
| uses: ./.github/workflows/unit-tests.yaml | |
| with: | |
| odoo_version: ${{ matrix.odoo_version }} | |
| secrets: inherit | |
| publish: | |
| needs: [build, test] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| odoo_version: ["15.0", "16.0", "17.0", "18.0", master] | |
| include: | |
| - odoo_version: "15.0" | |
| python_version: 3.10-slim | |
| os_variant: bullseye | |
| if: ${{ github.event_name != 'pull_request' }} | |
| uses: ./.github/workflows/image-builder.yaml | |
| with: | |
| odoo_version: ${{ matrix.odoo_version }} | |
| python_version: ${{ matrix.python_version != null && matrix.python_version || '' }} | |
| os_variant: ${{ matrix.os_variant != null && matrix.os_variant || '' }} | |
| dockerfile_path: Dockerfile | |
| dockerfile_target: production | |
| secrets: inherit |