roezio: rework .gitlab-ci.yml

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2022-03-03 23:33:35 +01:00
parent f8b4ef7698
commit 6378f6ee6b
2 changed files with 55 additions and 19 deletions

View file

@ -40,13 +40,6 @@ security-check:
.poezio-tests: .poezio-tests:
script: script:
- apt-get update && apt-get install -y libidn11-dev
- wget https://static.rust-lang.org/rustup/archive/1.24.3/x86_64-unknown-linux-gnu/rustup-init
- chmod +x rustup-init
- ./rustup-init -y --no-modify-path --default-toolchain nightly
- rm rustup-init
- ls ~/.cargo/bin
- export PATH=$PATH:$HOME/.cargo/bin
- git clone https://lab.louiz.org/poezio/slixmpp.git - git clone https://lab.louiz.org/poezio/slixmpp.git
- pip3 install pytest pyasn1-modules cffi setuptools-rust --upgrade - pip3 install pytest pyasn1-modules cffi setuptools-rust --upgrade
- cd slixmpp - cd slixmpp
@ -54,49 +47,50 @@ security-check:
- cd .. - cd ..
- python3 setup.py install - python3 setup.py install
- py.test -v test/ - py.test -v test/
- cargo test
pytest-3.7: pytest-3.7:
stage: test stage: test
image: python:3.7 image: docker.louiz.org/poezio/poezio:rust-python3.7
extends: extends:
- .poezio-tests - .poezio-tests
pytest-3.8: pytest-3.8:
stage: test stage: test
image: python:3.8 image: docker.louiz.org/poezio/poezio:rust-python3.8
extends: extends:
- .poezio-tests - .poezio-tests
pytest-3.9: pytest-3.9:
stage: test stage: test
image: python:3.9 image: docker.louiz.org/poezio/poezio:rust-python3.9
extends: extends:
- .poezio-tests - .poezio-tests
pytest-3.10: pytest-3.10:
stage: test stage: test
image: python:3.10-rc image: docker.louiz.org/poezio/poezio:rust-python3.10
extends: extends:
- .poezio-tests - .poezio-tests
pylint-plugins: pylint-plugins:
stage: lint stage: lint
image: python:3 image: docker.louiz.org/poezio/poezio:rust-python3.10
allow_failure: true allow_failure: true
script: script:
- apt-get update && apt-get install -y libidn11-dev
- wget https://static.rust-lang.org/rustup/archive/1.14.0/x86_64-unknown-linux-gnu/rustup-init
- chmod +x rustup-init
- ./rustup-init -y --no-modify-path --default-toolchain nightly
- rm rustup-init
- ls ~/.cargo/bin
- export PATH=$PATH:$HOME/.cargo/bin
- pip3 install pylint pyasn1-modules cffi setuptools-rust --upgrade - pip3 install pylint pyasn1-modules cffi setuptools-rust --upgrade
- pip3 install -e git+https://lab.louiz.org/poezio/slixmpp.git#egg=slixmpp - pip3 install -e git+https://lab.louiz.org/poezio/slixmpp.git#egg=slixmpp
- pip3 install -r requirements-plugins.txt - pip3 install -r requirements-plugins.txt
- python3 setup.py install - python3 setup.py install
- pylint -E plugins - pylint -E plugins
rust-lint:
stage: lint
image: docker.louiz.org/poezio/poezio:rust-python3.10
script:
- cargo fmt --check
- cargo clippy --no-deps
mypy: mypy:
stage: lint stage: lint
image: python:3 image: python:3

42
scripts/generate_container Executable file
View file

@ -0,0 +1,42 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8 et ts=4 sts=4 sw=4
#
# Copyright © 2022 Maxime “pep” Buquet <pep@bouah.net>
#
# Distributed under terms of the GPLv3+ license.
"""
Generate Dockerfiles for our CI containers.
The output can be used in the following way:
```
docker login docker.louiz.org
CONTAINER=docker.louiz.org/poezio/poezio:rust-python3.10
python generate_container 3.10 | docker -t $CONTAINER -
docker push $CONTAINER
```
"""
import sys
TEMPLATE='''FROM rust:slim
RUN set -eux; \
apt update; \
apt install -y --no-install-recommends git libidn11-dev libncurses-dev; \
rm -rf /var/lib/apt/lists/*
RUN rustup component add clippy rustfmt
COPY --from=python:VERSION-slim /usr/ /usr/
COPY --from=python:VERSION-slim /lib/ /lib/
RUN ldconfig'''
REGISTRY='docker.louiz.org'
CONTAINER='poezio/poezio'
TAG='rust-python{version}'
if __name__ == '__main__':
if len(sys.argv) != 2:
print('./generate_container.py <python version>', file=sys.stderr)
sys.exit(1)
print(TEMPLATE.replace('VERSION', sys.argv[1]))