Skip to content

ci

ci #68

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-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- 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@v1
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-latest
needs: pre-commit
strategy:
fail-fast: false
matrix:
# Test modern Odoo versions with latest Postgres version
pg_version:
- "16"
- "15"
- "14"
- "13"
- "12"
- "11"
- "10"
- "9.6"
env:
# Indicates what's the equivalent to tecnativa/postgres-autoconf:latest image
LATEST_RELEASE: "16-alpine"
# Variables found by default in Docker Hub builder
DOCKER_REPO: tecnativa/postgres-autoconf
DOCKER_TAG: ${{ matrix.pg_version }}-alpine
GIT_SHA1: ${{ github.sha }}
steps:
# Prepare
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- run: pip install -r tests/ci-requirements.txt
# Build images
- run: ./hooks/build
# Test
- run: python -m unittest tests.test -v
# Push
- name: push to docker hub
if: github.repository == 'Tecnativa/docker-postgres-autoconf' && github.ref == 'refs/heads/master'
env:
REGISTRY_HOST: docker.io
REGISTRY_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_LOGIN }}
run: ./hooks/push
- name: push to github registry
if: github.repository == 'Tecnativa/docker-postgres-autoconf' && github.ref == 'refs/heads/master'
env:
REGISTRY_HOST: ghcr.io
REGISTRY_TOKEN: ${{ secrets.BOT_TOKEN }}
REGISTRY_USERNAME: ${{ secrets.BOT_LOGIN }}
run: ./hooks/push