Manage build process

This commit is contained in:
Darks 2021-06-09 20:21:26 +02:00
parent 569a56c4bc
commit ede14d1571
Signed by: Darks
GPG Key ID: 7515644268BE1433
7 changed files with 30 additions and 10 deletions

1
.gitignore vendored
View File

@ -4,4 +4,5 @@ __pycache__/
packages/
pkgbuilds/
output/
run.sh

View File

@ -11,10 +11,14 @@ ADD scripts/run.sh /tmp
RUN chmod +x /tmp/build.sh && \
chmod +x /tmp/run.sh && \
chmod -R 777 /tmp/pkgbuilds && \
chmod 777 /tmp/packages
RUN /tmp/run.sh
/tmp/run.sh && \
echo "Build completed!"
WORKDIR /tmp/gintctl
ENTRYPOINT git clone https://gitea.planet-casio.com/Lephenixnoir/gintctl.git . && \
fxsdk build-cg && \
fxsdk build-fx
fxsdk build-fx && \
cp /tmp/pkgbuilds/**/*.pkg.* /mnt/output/ && \
cp /tmp/packages/* /mnt/output/ && \
echo "Build completed!"

View File

@ -45,17 +45,16 @@ def main():
with open("scripts/run.sh", "w") as file:
file.write("#!/usr/bin/env bash\n")
file.write("useradd user\n")
file.write("echo 'user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers)\n")
file.write("echo 'user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers\n")
file.write(" && \\\n".join(commands))
if diffs == 0:
logging.info("no updates planned")
sys.exit(0)
docker_build()
# TODO:
# - build the container with a tag
# - run it
# - retreive built packages if everthing is fine
# - push them to the repository
# - create a systemd timer to run this script
# - setup a web server to publish logs in case of failure

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
cd $1
makepkg -si --noconfirm && cp *.pkg.tar.zst /tmp/packages/
makepkg -si --noconfirm

View File

@ -1,4 +1,5 @@
from .middlearch import get_package_version, get_package_tarball
from .config import load_config, clean_directories
from .docker import docker_build
from .git import get_tags_from_git
from .middlearch import get_package_version, get_package_tarball
from .pkgbuild import render_pkgbuild

View File

@ -13,7 +13,7 @@ def load_config(path="packages.yaml"):
return packages
def clean_directories():
for i in ["pkgbuilds", "packages"]:
for i in ["pkgbuilds", "packages", "output"]:
try:
shutil.rmtree(i)
except FileNotFoundError:

15
utils/docker.py Normal file
View File

@ -0,0 +1,15 @@
import logging
import os
def docker_build():
def run(cmd, quiet=True):
r = os.popen(cmd).read()
if not "Build completed!" in r:
logging.error(r)
logging.error("toolchain build failed")
exit(1)
if not quiet:
logging.info(r)
run(f"docker build . -t middlearch/ci")
run(f"docker run -i --mount type=bind,src=/home/eldeberen/Programmation/Casio/MiddleArch/output,dst=/mnt/output middlearch/ci", quiet=False)