Skip to content

CPT-268 Upgrade to Python 3.9 #57

CPT-268 Upgrade to Python 3.9

CPT-268 Upgrade to Python 3.9 #57

Workflow file for this run

name: Build Docker Image
on:
push:
branches:
- 'jobrad-**'
tags:
- 'jobrad-**'
pull_request:
branches:
- '**'
jobs:
build-docker-amd64:
runs-on: self-hosted
permissions:
contents: read
packages: write
env:
GHCR_IMAGE_NAME: ghcr.io/jobrad-gmbh/odoo
steps:
- name: Clone
uses: actions/checkout@v3
- name: Clone enterprise addons
uses: actions/checkout@v3
with:
repository: jobrad-gmbh/odoo-addons-enterprise
ref: 15.0.1
token: ${{ secrets.ODOO_REPO_TOKEN }}
path: addons_enterprise
fetch-depth: 1
- name: Create variables
shell: bash
run: |
echo "BRANCH_NAME=$(echo ${GITHUB_REF} | sed 's/refs\/heads\///' | sed 's/refs\/tags\///' | sed 's/\//_/g')" >> $GITHUB_ENV
echo "SHORT_REV=$(echo ${{ github.sha }})" >> $GITHUB_ENV
- name: Login to ghcr registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64
driver-opts: |
image=moby/buildkit:buildx-stable-1
network=host
- name: Build and push Docker image (AMD64)
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
platforms: linux/amd64
push: true
tags: |
${{ env.GHCR_IMAGE_NAME }}:${{ env.SHORT_REV }}-amd64
cache-from: |
type=gha,scope=image-amd64
cache-to: |
type=gha,scope=image-amd64,mode=max
provenance: false
build-docker-arm64:
runs-on: Linux-ARM64-2C-8GB
permissions:
contents: read
packages: write
env:
GHCR_IMAGE_NAME: ghcr.io/jobrad-gmbh/odoo
steps:
- name: Clone
uses: actions/checkout@v3
- name: Clone enterprise addons
uses: actions/checkout@v3
with:
repository: jobrad-gmbh/odoo-addons-enterprise
ref: 15.0.1
token: ${{ secrets.ODOO_REPO_TOKEN }}
path: addons_enterprise
fetch-depth: 1
- name: Create variables
shell: bash
run: |
echo "BRANCH_NAME=$(echo ${GITHUB_REF} | sed 's/refs\/heads\///' | sed 's/refs\/tags\///' | sed 's/\//_/g')" >> $GITHUB_ENV
echo "SHORT_REV=$(echo ${{ github.sha }})" >> $GITHUB_ENV
- name: Login to ghcr registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/arm64
driver-opts: |
image=moby/buildkit:buildx-stable-1
network=host
- name: Build and push Docker image (ARM64)
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
platforms: linux/arm64
push: true
tags: |
${{ env.GHCR_IMAGE_NAME }}:${{ env.SHORT_REV }}-arm64
cache-from: |
type=gha,scope=image-arm64
cache-to: |
type=gha,scope=image-arm64,mode=max
provenance: false
combine-docker:
runs-on: [self-hosted, short]
needs: [build-docker-amd64, build-docker-arm64]
permissions:
contents: read
packages: write
env:
GHCR_IMAGE_NAME: ghcr.io/jobrad-gmbh/odoo
outputs:
IMAGE_REV: ${{ steps.manifest.outputs.IMAGE_REV }}
steps:
- name: Create variables
shell: bash
run: |
echo "BRANCH_NAME=$(echo ${GITHUB_REF} | sed 's/refs\/heads\///' | sed 's/refs\/tags\///' | sed 's/\//_/g')" >> $GITHUB_ENV
echo "SHORT_REV=$(echo ${{ github.sha }})" >> $GITHUB_ENV
- name: Login to ghcr registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to artifactory registry
uses: docker/login-action@v2
with:
registry: artifactory.service.jobrad.org
username: github_runner
password: ${{ secrets.ARTIFACTORY_TOKEN }}
- name: Combine Docker images into a single multi-architecture image
id: manifest
shell: bash
run: |
IMAGE_AMD64="${GHCR_IMAGE_NAME}:${SHORT_REV}-amd64"
IMAGE_ARM64="${GHCR_IMAGE_NAME}:${SHORT_REV}-arm64"
IMAGE_BRANCH="${GHCR_IMAGE_NAME}:${BRANCH_NAME}"
IMAGE_REV="${GHCR_IMAGE_NAME}:${SHORT_REV}"
docker pull "${IMAGE_AMD64}"
docker pull "${IMAGE_ARM64}"
docker manifest rm "${IMAGE_BRANCH}" || true
docker manifest rm "${IMAGE_REV}" || true
docker manifest create "${IMAGE_BRANCH}" "${IMAGE_AMD64}" "${IMAGE_ARM64}"
docker manifest create "${IMAGE_REV}" "${IMAGE_AMD64}" "${IMAGE_ARM64}"
docker manifest push "${IMAGE_BRANCH}"
docker manifest push "${IMAGE_REV}"
echo "IMAGE_REV=${IMAGE_REV}" >> $GITHUB_OUTPUT
# TODO Push to artifactory
test:
runs-on: self-hosted
needs: combine-docker
steps:
- uses: actions/checkout@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run base Odoo tests
run: |
export ODOO_IMAGE=${{ needs.combine-docker.outputs.IMAGE_REV }}
./tests/run_tests.sh tests/modules
- name: Cleanup
if: always()
run: |
docker compose -f tests/docker-compose.yml down -v