isOdoo #147
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: isOdoo | |
| on: | |
| pull_request: | |
| branches: [master] | |
| push: | |
| branches: [master] | |
| schedule: | |
| - cron: '0 6 * * *' | |
| - cron: '0 8 * * 0' | |
| workflow_dispatch: | |
| jobs: | |
| pre-commit: | |
| runs-on: ubuntu-24.04 | |
| env: | |
| DEBIAN_FRONTEND: noninteractive | |
| PYTHONDONTWRITEBYTECODE: 1 | |
| PYTHONUNBUFFERED: 1 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: "Set up Python" | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version-file: "pyproject.toml" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Restore pre-commit cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/pre-commit | |
| key: pre-commit-${{ runner.os }}-${{ hashFiles('uv.lock') }}-${{ hashFiles('.pre-commit-config.yaml') }} | |
| restore-keys: | | |
| pre-commit-${{ runner.os }}-${{ hashFiles('uv.lock') }}-${{ hashFiles('.pre-commit-config.yaml') }} | |
| pre-commit-${{ runner.os }}-${{ hashFiles('uv.lock') }} | |
| pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }} | |
| pre-commit-${{ runner.os }} | |
| - name: Install the project | |
| run: uv sync --locked --all-extras --dev | |
| - uses: pre-commit/action@v3.0.1 | |
| pytest: | |
| strategy: | |
| matrix: | |
| odoo_version: ["6.0", "6.1", "7.0", "8.0", "9.0", "10.0", "11.0", "12.0", "13.0", "14.0", "15.0", "16.0", "17.0", "18.0", "19.0"] | |
| fail-fast: false | |
| runs-on: ubuntu-24.04 | |
| needs: pre-commit | |
| env: | |
| DEBIAN_FRONTEND: noninteractive | |
| PYTHONDONTWRITEBYTECODE: 1 | |
| PYTHONUNBUFFERED: 1 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: "Set up Python" | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version-file: "pyproject.toml" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Restore uv cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/uv | |
| key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | |
| restore-keys: | | |
| uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | |
| uv-${{ runner.os }} | |
| - name: Install the project | |
| run: uv sync --locked --all-extras --dev | |
| - name: Run pytest | |
| run: uv run pytest --odoo-version ${{ matrix.odoo_version }} --client-type docker --no-cache -v | |
| - name: Minimize uv cache | |
| run: uv cache prune --ci | |
| build-and-push: | |
| if: | | |
| (github.event_name == 'push' && github.ref == 'refs/heads/master') || | |
| (github.event_name == 'schedule' && github.event.schedule == '0 8 * * 0') || | |
| github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-24.04 | |
| needs: pytest | |
| permissions: | |
| contents: read | |
| packages: write | |
| attestations: write | |
| id-token: write | |
| env: | |
| DEBIAN_FRONTEND: noninteractive | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| LATEST_VERSION: "19.0" | |
| strategy: | |
| matrix: | |
| version: ["6.0", "6.1", "7.0", "8.0", "9.0", "10.0", "11.0", "12.0", "13.0", "14.0", "15.0"] | |
| platforms: ["linux/amd64"] | |
| include: | |
| - version: "16.0" | |
| platforms: "linux/amd64,linux/arm64" | |
| - version: "17.0" | |
| platforms: "linux/amd64,linux/arm64" | |
| - version: "18.0" | |
| platforms: "linux/amd64,linux/arm64" | |
| - version: "19.0" | |
| platforms: "linux/amd64,linux/arm64" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=raw,value=${{ matrix.version }} | |
| type=raw,value=latest,enable=${{ matrix.version == env.LATEST_VERSION }} | |
| labels: | | |
| org.opencontainers.image.title=Odoo ${{ matrix.version }} | |
| org.opencontainers.image.description=Odoo Community ${{ matrix.version }} - isOdoo Image | |
| org.opencontainers.image.source=https://github.com/${{ github.repository }} | |
| org.opencontainers.image.vendor=GrupoIsonor | |
| odoo.version=${{ matrix.version }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| id: buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build & Push | |
| id: build-and-push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./${{ matrix.version }}.Dockerfile | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha,scope=odoo-${{ matrix.version }} | |
| cache-to: type=gha,mode=max,scope=odoo-${{ matrix.version }} | |
| provenance: mode=max | |
| sbom: true | |
| platforms: ${{ matrix.platforms }} |