Commit 0f9e5167 authored by dmanik's avatar dmanik
Browse files

added pygment based snippets

parent 51cd260a
* Find texlive docker image.
* Add .gitlab-ci.yml
* Talk about test running policy: each commit/only master/only on tags...
* Talk about artifacts.
* talk about paper repo.
* talk about jupytext
* talk about badges/anybadge/dependent stages
* talk about badges/anybadge/dependent stages.
* talk about multi-project pipelines. (monorepo vs multi repo).
* talk aboout `skipci` in commit messages.
* moonshot stuff: use a runner to submit jobs to a cluster..
* CI/CD for external repo?
......
# This file is a template, and might need editing before it works on your project.
# Official language image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/python/tags/
image: debsankhamanik/ecoptimizer_testenv:latest
# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
# Pip's cache doesn't store the python packages
# https://pip.pypa.io/en/stable/reference/pip_install/#caching
#
# If you want to also cache the installed packages, you have to install
# them in a virtualenv and cache it as well.
cache:
paths:
- .cache/pip
- venv/
before_script:
# we create SSL certs for server tests
- oldpwd=$(pwd)
- mkdir $HOME/ssl
- cd $HOME/ssl
# CA (certificate authority) key
- openssl genrsa -des3 -passout pass:'abcd' -out ecoptimizerCA.key 2048
# CA cert
- openssl req -x509 -new -nodes -key ecoptimizerCA.key -sha256 -days 1825 -passin pass:'abcd' -out ecoptimizerCA.pem -subj "/C=XY/ST=test/L=Test/O=IT/CN=www.example.com"
# client key
- openssl genrsa -out ecoptimizer_production.key 2048
- openssl req -new -key ecoptimizer_production.key -out ecoptimizer_production.csr -subj "/C=XY/ST=test/L=Test/O=IT/CN=www.example.com"
- |
cat >> ecoptimize.ext << EOF
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = 127.0.0.1
DNS.2 = localhost
EOF
# client cert
- openssl x509 -req -in ecoptimizer_production.csr -CA ecoptimizerCA.pem -CAkey ecoptimizerCA.key -CAcreateserial -passin pass:"abcd" -out ecoptimizer_production.crt -days 1825 -sha256 -extfile ecoptimize.ext
- pwd && ls
- cd $oldpwd
- pwd
- python -V # Print out python version for debugging
# create virtualenv if not existing
- if [ ! -d "venv" ]; then pip install -U pip && pip install virtualenv && virtualenv venv; fi
- source venv/bin/activate
- pip install -e .[dev]
# create badges directory
- mkdir badges/
stages:
- unittest
- integration_test
- deploy
unittests:
stage: unittest
script:
- python ecoptimizer/testing/testsuite_runner.py run_unittests
artifacts:
paths:
- public
expire_in: 6 mos
when: always # ensure badges are uploaded even when jobs fail
integration_tests:
stage: integration_test
only:
- schedules
- master
script:
- python ecoptimizer/testing/testsuite_runner.py run_integration_tests
artifacts:
paths:
- public
expire_in: 6 mos
when: always
pages:
stage: deploy
before_script:
- echo "no need to set up python environment just for deploying badges" # Without this,
# time consuming global before_script will be run
script:
- echo "deploying badges to gitlab pages"
- ls public/badges/
artifacts:
paths:
- public
expire_in: 6 mos
when: always # without this, pages job won't be run unless both unittests and
# integration tests succeed
only:
- master
\documentclass[compress,xcolor=table]{beamer}
%\usepackage[table,x11names]{xcolor}
\usepackage[utf8]{inputenc}
\usepackage{minted}
\usemintedstyle{xcode}
\usepackage{booktabs}
\graphicspath{{pics/}}
\beamertemplatenavigationsymbolsempty
% start custom macros
\definecolor{light-gray}{gray}{0.95}
\newcommand{\code}[1]{\colorbox{light-gray}{\texttt{#1}}}
% end custom macros
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......@@ -16,4 +25,32 @@
\titlepage
\end{frame}
\begin{frame}{CI/CD pipelines in a nutshell}
\begin{enumerate}
\item<+-> Exactly specify an environment (typically using \code{docker}).
\item<+-> Define a \code{pipeline} (a series of \code{stage}s).
\item<+-> Each \code{stage} consists of multiple \code{job}s.
\begin{enumerate}
\item<+-> All jobs in the same stage are typically run in parallel.
\end{enumerate}
\end{enumerate}
\end{frame}
\begin{frame}{Use case 1: automated testing}
\begin{enumerate}
\item Define base docker image (e.g. python3.7)
\item Can test against multiple environments?
\item Install dependencies.
\item Caching to speed up dependencies.
\item Secrets management via environment variables and deploy tokens.
\item Parallel testing for each components maybe.
\item Badge.
\end{enumerate}
\end{frame}
\begin{frame}[fragile]{How to set this up?}
\inputminted{yaml}{snippets/ci-testing.yml}
\end{frame}
\end{document}
Markdown is supported
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