2422: Build wheels only if we have to. r=mergify[bot] a=nextgens

## What type of PR?

enhancement

## What does this PR do?

This massively speeds the CI up; We don't need to install a compiler and rebuild when we have wheels available... with this admin builds 4 times faster.

### Related issue(s)
- #1830


Co-authored-by: Florent Daigniere <nextgens@freenetproject.org>
Co-authored-by: Dimitri Huisman <diman@huisman.xyz>
master
bors[bot] 2 years ago committed by GitHub
commit b962319ba1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -37,10 +37,11 @@ WORKDIR /app
COPY requirements-prod.txt requirements.txt
RUN set -eu \
&& apk add --no-cache libressl curl postgresql-libs mariadb-connector-c \
&& apk add --no-cache --virtual build-dep libressl-dev libffi-dev python3-dev build-base postgresql-dev mariadb-connector-c-dev cargo \
&& pip install --no-cache-dir --extra-index-url=https://www.piwheels.org/simple -r requirements.txt --only-binary=:all: --no-binary=Flask-bootstrap,PyYAML,SQLAlchemy \
|| ( apk add --no-cache --virtual build-dep libressl-dev libffi-dev python3-dev build-base postgresql-dev mariadb-connector-c-dev cargo \
&& pip install --upgrade pip \
&& pip install -r requirements.txt \
&& apk del --no-cache build-dep
&& apk del --no-cache build-dep )
COPY --from=assets static ./mailu/static
COPY mailu ./mailu

@ -5,7 +5,7 @@ bcrypt==3.2.0
blinker==1.4
CacheControl==0.12.9
certifi==2021.10.8
cffi==1.15.0
# cffi==1.15.0
chardet==4.0.0
click==8.0.3
colorama==0.4.4
@ -43,13 +43,15 @@ MarkupSafe==2.0.1
marshmallow==3.14.0
marshmallow-sqlalchemy==0.26.1
msgpack==1.0.2
mysqlclient==2.0.3
# mysqlclient==2.0.3
mysql-connector-python==8.0.25
ordered-set==4.0.2
# packaging==20.9
passlib==1.7.4
# pep517==0.10.0
progress==1.6
psycopg2==2.9.1
#psycopg2==2.9.1
psycopg2-binary==2.9.3
pycparser==2.20
Pygments==2.10.0
pyOpenSSL==21.0.0

@ -19,7 +19,7 @@ PyOpenSSL
Pygments
dnspython
tenacity
mysqlclient
mysql-connector-python
idna
srslib
marshmallow

@ -22,9 +22,9 @@ RUN apk add --no-cache --virtual .build-deps gcc musl-dev python3-dev \
# Image specific layers under this line
# Building pycares from source requires py3-wheel and libffi-dev packages
RUN apk add --no-cache --virtual .build-deps gcc musl-dev python3-dev py3-wheel libffi-dev \
&& pip3 install --no-binary :all: postfix-mta-sts-resolver==1.0.1 \
&& apk del .build-deps
RUN pip install --no-cache-dir --extra-index-url=https://www.piwheels.org/simple --only-binary=:all: postfix-mta-sts-resolver==1.0.1 || (apk add --no-cache --virtual .build-deps gcc musl-dev python3-dev py3-wheel libffi-dev \
&& pip3 install postfix-mta-sts-resolver==1.0.1 \
&& apk del .build-deps )
RUN apk add --no-cache postfix postfix-pcre cyrus-sasl-login rsyslog logrotate

@ -1,9 +1,12 @@
import sys
import os
import time
import datetime
from xmlrpc.client import DateTime
import docker
from colorama import Fore, Style
import subprocess
import calendar
# Declare variables for service name and sleep time
test_name=sys.argv[1]
@ -22,12 +25,7 @@ def stop(exit_code):
print(subprocess.check_output("docker-compose -f " + compose_file + " down", shell=True).decode())
sys.exit(exit_code)
# Sleep for a defined amount of time
def sleep():
print(Fore.LIGHTMAGENTA_EX + "Sleeping for " + str(timeout) + "m" + Style.RESET_ALL)
time.sleep(timeout*60)
def health_checks():
def health_checks(deadline):
exit_code = 0
#Iterating trough all containers dictionary
for container in client.containers(all=True):
@ -58,7 +56,9 @@ def health_checks():
#Adding the generated dictionary to a list
containers.append(containers_dict)
if exit_code != 0:
if exit_code == 0:
return True
elif exit_code != 0 and deadline < datetime.datetime.now().timestamp():
stop(exit_code)
def print_logs():
@ -86,14 +86,20 @@ def hooks():
# Start up containers
sys.stdout.flush()
deadline=datetime.datetime.now()+datetime.timedelta(minutes=timeout)
deadline=calendar.timegm(deadline.timetuple())
print(subprocess.check_output("docker-compose -f " + compose_file + " up -d", shell=True).decode())
print()
sleep()
print(Fore.LIGHTMAGENTA_EX + "Sleeping for 10s" + Style.RESET_ALL)
time.sleep(10)
print()
sys.stdout.flush()
print(subprocess.check_output("docker ps -a", shell=True).decode())
print()
health_checks()
while not health_checks(deadline):
print(Fore.LIGHTMAGENTA_EX + "Sleeping for 10s" + Style.RESET_ALL)
sys.stdout.flush()
time.sleep(10)
print()
hooks()
print()

Loading…
Cancel
Save