-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #573 from pledra/arm-builds
Add support for arm64 build (tested on Mac M1)
- Loading branch information
Showing
7 changed files
with
200 additions
and
136 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ jobs: | |
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} | ||
- uses: pre-commit/[email protected] | ||
|
||
build-test-push: | ||
test: | ||
runs-on: ubuntu-22.04 | ||
needs: pre-commit | ||
strategy: | ||
|
@@ -53,12 +53,6 @@ jobs: | |
pg_version: "14" | ||
python_version: "3.9" | ||
env: | ||
# Indicates what's the equivalent to tecnativa/doodba:latest image | ||
LATEST_RELEASE: "17.0" | ||
# Variables found by default in Docker Hub builder | ||
DOCKER_REPO: tecnativa/doodba | ||
DOCKER_TAG: ${{ matrix.odoo_version }} | ||
GIT_SHA1: ${{ github.sha }} | ||
# Other variables to configure tests and execution environment | ||
DOCKER_BUILDKIT: 1 | ||
PG_VERSIONS: ${{ matrix.pg_version }} | ||
|
@@ -76,22 +70,76 @@ jobs: | |
# to get rid of AttributeError: cython_sources when installing pyyaml | ||
- run: poetry add pyyaml==5.3.1 | ||
- run: poetry install | ||
# Build images | ||
- run: poetry run ./hooks/build | ||
# Test | ||
- run: poetry run python -m unittest -v tests | ||
# Push | ||
- name: push to docker hub | ||
if: github.repository == 'Tecnativa/doodba' && github.ref == 'refs/heads/master' | ||
env: | ||
REGISTRY_HOST: docker.io | ||
REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }} | ||
REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_LOGIN }} | ||
run: poetry run ./hooks/push | ||
- name: push to github container registry | ||
if: github.repository == 'Tecnativa/doodba' && github.ref == 'refs/heads/master' | ||
env: | ||
REGISTRY_HOST: ghcr.io | ||
REGISTRY_PASSWORD: ${{ secrets.BOT_TOKEN }} | ||
REGISTRY_USERNAME: ${{ secrets.BOT_LOGIN }} | ||
run: poetry run ./hooks/push | ||
|
||
build-push: | ||
runs-on: ubuntu-22.04 | ||
needs: test | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
# Test modern Odoo versions with latest Postgres version | ||
odoo_version: ["17.0"] | ||
platforms: ["linux/amd64,linux/arm64"] | ||
include: | ||
# Older odoo versions don't support latest postgres and Python versions | ||
- odoo_version: "16.0" | ||
platforms: "linux/amd64,linux/arm64" | ||
- odoo_version: "15.0" | ||
platforms: "linux/amd64,linux/arm64" | ||
- odoo_version: "14.0" | ||
platforms: "linux/amd64,linux/arm64" | ||
- odoo_version: "13.0" | ||
platforms: "linux/amd64" | ||
env: | ||
# Indicates what's the equivalent to tecnativa/doodba:latest image | ||
LATEST_RELEASE: "17.0" | ||
# Define the docker hub repository location and github container registry host | ||
DOCKER_REPO: tecnativa/doodba | ||
GHCR_HOST: ghcr.io | ||
steps: | ||
# Set build date as env variable to be used later | ||
- name: Set build date | ||
run: echo "BUILD_DATE=$(date '+%Y-%m-%dT%H:%M:%S.%N%:z')" >> $GITHUB_ENV | ||
# Prepare | ||
- uses: actions/checkout@v4 | ||
# Setup QEMU | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
# Setup buildx | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to Docker Hub | ||
if: github.repository == 'tecnativa/doodba' && github.ref == 'refs/heads/master' | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_LOGIN }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Login to GitHub Container Registry | ||
if: github.repository == 'tecnativa/doodba' && github.ref == 'refs/heads/master' | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./${{ matrix.odoo_version }}.Dockerfile | ||
platforms: ${{ matrix.platforms }} | ||
push: | ||
${{ github.repository == 'tecnativa/doodba' && github.ref == | ||
'refs/heads/master' }} | ||
tags: | | ||
${{ env.DOCKER_REPO }}:${{ matrix.odoo_version }}onbuild | ||
${{ env.DOCKER_REPO }}:${{ matrix.odoo_version }}-onbuild | ||
${{ env.GHCR_HOST }}/${{ env.DOCKER_REPO }}${{ env.DOCKER_REPO_SUFFIX }}:${{ matrix.odoo_version }} | ||
${{ env.GHCR_HOST }}/${{ env.DOCKER_REPO }}${{ env.DOCKER_REPO_SUFFIX }}:${{ matrix.odoo_version }}-onbuild | ||
${{ matrix.odoo_version == env.LATEST_RELEASE && format('{0}:latest', env.DOCKER_REPO) || '' }} | ||
${{ matrix.odoo_version == env.LATEST_RELEASE && format('{0}/{1}{2}:latest', env.GHCR_HOST, env.DOCKER_REPO, env.DOCKER_REPO_SUFFIX) || '' }} | ||
build-args: | | ||
VCS_REF=${{ github.sha }} | ||
BUILD_DATE=${{ env.BUILD_DATE }} | ||
ODOO_VERSION=${{ matrix.odoo_version }} |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.