Skip to content

Commit

Permalink
ci: get ci working
Browse files Browse the repository at this point in the history
This gets the CI working with Ubuntu 22.04
(Jammy) inside a docker container that runs
on ubuntu-latest.
  • Loading branch information
tobias-urdin committed Nov 9, 2023
1 parent da5901d commit ba3ee6a
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 76 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/pifpaf-ci-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Pifpaf CI Image

on:
workflow_dispatch:
push:
paths:
- 'Dockerfile'

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ghcr.io/pifpaf/ci:latest
51 changes: 51 additions & 0 deletions .github/workflows/pifpaf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Pifpaf

on:
pull_request:

env:
INFLUXDB_VERSION: "0.13.0"
SCALA_VERSION: "2.12"
KAFKA_VERSION: "2.6.0"
ETCD_VERSION: "3.4.13"

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
env:
- py39
- py310
- pep8
- build
steps:
- uses: actions/checkout@v4
- run: sudo chown -R 1000:1000 $GITHUB_WORKSPACE
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
ci_image:
- 'Dockerfile'
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
if: steps.changes.outputs.ci_image == 'false'
- run: docker pull ghcr.io/pifpaf/ci:latest
if: steps.changes.outputs.ci_image == 'false'
- uses: docker/build-push-action@v2
with:
context: .
push: false
build-args: |
INFLUXDB_VERSION=${{ env.INFLUXDB_VERSION }}
SCALA_VERSION=${{ env.SCALA_VERSION }}
KAFKA_VERSION=${{ env.KAFKA_VERSION }}
ETCD_VERSION=${{ env.ETCD_VERSION }}
tags: ghcr.io/pifpaf/ci:latest
if: steps.changes.outputs.ci_image == 'true'
- name: Run tox
run: docker run --rm -v ${{ github.workspace }}:/home/pifpaf/pifpaf ghcr.io/pifpaf/ci:latest tox -e ${{ matrix.env }}
55 changes: 0 additions & 55 deletions .github/workflows/python-app.yaml

This file was deleted.

24 changes: 9 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
FROM ubuntu:focal
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Etc/UTC
ENV PBR_VERSION=1.2.3
ENV TOX_TESTENV_PASSENV=PBR_VERSION

ARG INFLUXDB_VERSION=0.13.0
ARG SCALA_VERSION=2.12
ARG KAFKA_VERSION=2.6.0
ARG ETCD_VERSION=3.4.13

RUN apt-get -qq update \
&& apt-get install -y mongodb-server mysql-server redis-server zookeeper mongodb nodejs npm ceph librados-dev \
python3 python3-dev python3-pip gcc liberasurecode-dev liberasurecode1 postgresql libpq-dev python3-rados \
git wget memcached \
RUN apt-get update -y && apt-get install -qy gnupg software-properties-common
RUN add-apt-repository -y ppa:deadsnakes/ppa
RUN apt-get -qq update -y \
&& apt-get install -y mysql-server redis-server zookeeper nodejs npm ceph librados-dev \
python3 python3-dev python3-pip python3.9 python3.9-dev python3.9-distutils \
gcc liberasurecode-dev liberasurecode1 postgresql libpq-dev python3-rados git wget memcached \
&& rm -rf /var/lib/apt/lists/*

RUN wget https://dl.influxdata.com/influxdb/releases/influxdb_${INFLUXDB_VERSION}_amd64.deb \
Expand All @@ -34,12 +34,6 @@ RUN pip install -U tox

RUN useradd -ms /bin/bash pifpaf
USER pifpaf
RUN mkdir /home/pifpaf/pifpaf
RUN mkdir /home/pifpaf/tmpxattr
ENV TMP_FOR_XATTR=/home/pifpaf/tmpxattr
WORKDIR /home/pifpaf/pifpaf
RUN mkdir tmpxattr

COPY tox.ini pyproject.toml setup.py setup.cfg requirements.txt README.rst ./
RUN tox -epy38,pep8 --sitepackages --notest

COPY . ./
CMD ["tox", "-epy38,pep8", "--sitepackages"]
21 changes: 15 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[tox]
envlist = py36,py37,py38,pep8,pypy
envlist = py310,pep8,pypy

[testenv]
usedevelop = True
sitepackages = False
sitepackages = True
deps = .[test,ceph,gnocchi]
# TODO(tobias-urdin): Remove when Aodh supports it
SQLAlchemy<2
http://tarballs.openstack.org/aodh/aodh-master.tar.gz#egg=aodh[postgresql]
gnocchi[postgresql,file,ceph,ceph_recommended_lib,s3]
httpbin
Expand All @@ -16,9 +18,16 @@ deps = .[test,ceph,gnocchi]
# See also: https://github.com/pyca/pyopenssl/issues/1143
pyOpenSSL >= 22.0.0
passenv = TMPDIR_FOR_XATTR
allowlist_externals = env
commands =
env PYTHONPATH={envsitepackagesdir}:/usr/lib/python3/dist-packages/ stestr run {posargs}
setenv =
PYTHONPATH={envsitepackagesdir}:/usr/lib/python3/dist-packages/
commands = stestr run {posargs}

[testenv:venv]
commands = {posargs}

[testenv:build]
deps = build
commands = python -m build

[testenv:pep8]
deps = flake8
Expand All @@ -31,7 +40,7 @@ deps = flake8
commands = flake8

[flake8]
basepython = python3.8
basepython = python3
exclude = .tox,.eggs,doc
show-source = true
ignore = D100,D101,D102,D103,D104,G200,G201,W503,W504
Expand Down

0 comments on commit ba3ee6a

Please sign in to comment.