Skip to content

Merge pull request #580 from Tecnativa/16-17-flanker #6

Merge pull request #580 from Tecnativa/16-17-flanker

Merge pull request #580 from Tecnativa/16-17-flanker #6

Workflow file for this run

name: ci
on:
pull_request:
push:
branches:
- master
schedule:
# See https://crontab.guru/weekly
- cron: 0 0 * * 0
jobs:
pre-commit:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Set PY
run:
echo "PY=$(python -c 'import hashlib,
sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')"
>> $GITHUB_ENV
- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- uses: pre-commit/[email protected]
build-test-push:
runs-on: ubuntu-22.04
needs: pre-commit
strategy:
fail-fast: false
matrix:
# Test modern Odoo versions with latest Postgres version
odoo_version: ["17.0"]
pg_version: ["15"]
python_version: ["3.10"]
include:
# Older odoo versions don't support latest postgres and Python versions
- odoo_version: "16.0"
pg_version: "14"
python_version: "3.10"
- odoo_version: "15.0"
pg_version: "14"
python_version: "3.9"
- odoo_version: "14.0"
pg_version: "14"
python_version: "3.9"
- odoo_version: "13.0"
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 }}
steps:
# Prepare
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
# Install dev and test dependencies
- run: pip install poetry
- name: Patch $PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
# override pyyaml to 5.3.1 as PIP_CONSTRAINT does not work for poetry
# 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