Skip to content
Snippets Groups Projects
Commit f467a8b3 authored by Jan Hönig's avatar Jan Hönig
Browse files

Introducing the CI pipeline

parent 3c976921
No related merge requests found
Pipeline #35546 failed with stages
in 3 minutes and 15 seconds
.idea/
.tox/
build/
venv/
pystencils_benchmark.egg-info/
......
stages:
- docker-build
- test
# ---------------------- Docker-build ---------------------
build-docker:
stage: docker-build
image: docker:latest
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build --pull . -f Dockerfile -t i10git.cs.fau.de:5005/hoenig/pystencils-benchmark/pystencils-benchmark
- docker push i10git.cs.fau.de:5005/hoenig/pystencils-benchmark/pystencils-benchmark
tags:
- docker-docker
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
changes:
- Dockerfile
- when: manual
allow_failure: true
# ---------------------- Tests ---------------------
test:
stage: test
image: i10git.cs.fau.de:5005/hoenig/pystencils-benchmark/pystencils-benchmark
tags:
- docker
script:
- pip install tox
- echo $TOX_ENV
- tox
FROM ubuntu:latest
LABEL maintainer="jan.hoenig@fau.de"
LABEL version="0.1"
LABEL description="Custom docker image for pystencils-benchmark"
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y \
python3 \
build-essential \
clang \
gcc && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean
File moved
Jinja2>=3.0.2
pystencils>=0.4.1
setuptools>=44.0.0
numpy>=1.21.4
\ No newline at end of file
numpy>=1.21.4
sympy>=1.9
\ No newline at end of file
import subprocess
import numpy as np
import sympy as sp
import pystencils as ps
from pystencils_benchmark import generate_benchmark, Compiler
from pathlib import Path
def test_generate(path: Path):
a, b, c = ps.fields(a=np.ones(4000000), b=np.ones(4000000), c=np.ones(4000000))
alpha = sp.symbols('alpha')
@ps.kernel_config(ps.CreateKernelConfig())
def vadd():
a[0] @= b[0] + c[0]
kernel_vadd = ps.create_kernel(**vadd)
@ps.kernel_config(ps.CreateKernelConfig())
def daxpy():
b[0] @= alpha * a[0] + b[0]
kernel_daxpy = ps.create_kernel(**daxpy)
for compiler in [Compiler.GCC, Compiler.GCCdebug, Compiler.Clang]:
generate_benchmark([kernel_vadd, kernel_daxpy], path, compiler=compiler)
subprocess.run(['make'])
subprocess.run([f'./benchmark-{compiler.name}', '100'])
stages:
- test
- build
- example-build
- example-test
# ---------------------- Tests ---------------------
.test_template: &test_definition
stage: test
tags:
- docker
script:
- pip install tox
- echo $TOX_ENV
- tox -e $TOX_ENV
artifacts:
when: always
reports:
junit:
- report.xml
test-3.10:
image: python:3.10
variables:
TOX_ENV: py310
<<: *test_definition
test-3.9:
image: python:3.9
variables:
TOX_ENV: py39
<<: *test_definition
test-3.8:
image: python:3.8
variables:
TOX_ENV: py38
<<: *test_definition
test-docs:
image: python:3.10
tags:
- docker
script:
- pip install tox
- tox -e docs
# ------------------ Create documentation, image, pypy from studon-scripts -----------------
pages:
stage: build
image: python:3.10
script:
- pip install tox
- tox -e docs
- mv html_doc public
artifacts:
paths:
- public
tags:
- docker
only:
- master
build-docker:
stage: build
image: docker:latest
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build --pull . -f Dockerfile -t i10git.cs.fau.de:5005/teaching/studon-scripts/studon-scripts
- docker push i10git.cs.fau.de:5005/teaching/studon-scripts/studon-scripts
tags:
- docker-docker
when: manual
build-pypi:
stage: build
image: python:3.10
script:
- pip install twine
- python3 setup.py sdist bdist_wheel
- TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --verbose --repository-url https://i10git.cs.fau.de/api/v4/projects/${CI_PROJECT_ID}/packages/pypi dist/*
tags:
- docker
only:
refs:
- master
changes:
- setup.cfg
# ------------------- Create an image for the example problem ---------------
example-build:
stage: example-build
image: docker:latest
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build --build-arg READ_API=$READ_API --pull . -f ./test_resources/example/Dockerfile -t i10git.cs.fau.de:5005/teaching/studon-scripts/example
- docker push i10git.cs.fau.de:5005/teaching/studon-scripts/example
tags:
- docker-docker
when: manual
# ------------------ Test created image on an example problem ---------------
example-test:
stage: example-test
image: i10git.cs.fau.de:5005/teaching/studon-scripts/example
script:
- cd test_resources/example
- bash example.sh
tags:
- docker
[tox]
envlist = py38, py39, py310
envlist = py39
requires = setuptools >= 40.0.0
[testenv]
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment