[ci] Run container integration tests to CI

This commit is contained in:
Davis Schirmer
2021-10-30 14:09:53 -04:00
parent bd3e6f5f67
commit 66534d258d
7 changed files with 74 additions and 15 deletions

View File

@@ -1,22 +1,21 @@
---
name: build name: build
on: on:
- push - push
- pull_request - pull_request
jobs: jobs:
# Code style checks # Code style checks
health: health:
name: Code health check name: code health check
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout Asciinema - name: checkout asciinema
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup Python - name: setup Python
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: "3.9" python-version: "3.9"
- name: Install dependencies - name: install dependencies
run: pip install build cmarkgfm pycodestyle twine run: pip install build cmarkgfm pycodestyle twine
- name: Run pycodestyle - name: Run pycodestyle
run: > run: >
@@ -27,7 +26,7 @@ jobs:
twine check dist/* twine check dist/*
# Asciinema checks # Asciinema checks
asciinema: asciinema:
name: Asciinema - py${{ matrix.python }} name: Asciinema
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
@@ -40,13 +39,70 @@ jobs:
env: env:
TERM: dumb TERM: dumb
steps: steps:
- name: Checkout Asciinema - name: checkout Asciinema
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Setup Python - name: setup Python
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: ${{ matrix.python }} python-version: ${{ matrix.python }}
- name: Install dependencies - name: install dependencies
run: pip install pytest run: pip install pytest
- name: Run Asciinema tests - name: run Asciinema tests
run: script -e -c make test run: script -e -c make test
build_distros:
name: build distro images
strategy:
matrix:
distros:
- alpine
- arch
- centos
- debian
- fedora
- ubuntu
runs-on: ubuntu-latest
steps:
- name: Set up Docker buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Authenticate to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"
- name: "Build ${{ matrix.distros }} image"
uses: docker/build-push-action@v2
with:
file: "tests/distros/Dockerfile.${{ matrix.distros }}"
tags: |
"ghcr.io/${{ github.repository }}:${{ matrix.distros }}"
push: true
test_distros:
name: integration test distro images
needs: build_distros
strategy:
matrix:
distros:
- alpine
- arch
- centos
- debian
- fedora
- ubuntu
runs-on: ubuntu-latest
container:
image: "ghcr.io/${{ github.repository }}:${{ matrix.distros }}"
credentials:
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"
# https://github.community/t/permission-problems-when-checking-out-code-as-part-of-github-action/202263
options: "--interactive --tty --user=1001:121"
steps:
- name: checkout Asciinema
uses: actions/checkout@v2
- name: run integration tests
env:
TERM: dumb
shell: 'script --return --quiet --command "bash {0}"'
run: make test.integration

View File

@@ -2,7 +2,8 @@
FROM docker.io/library/alpine:3.14 FROM docker.io/library/alpine:3.14
RUN apk --no-cache add bash ca-certificates python3 # https://github.com/actions/runner/issues/241
RUN apk --no-cache add bash ca-certificates make python3 util-linux
WORKDIR /usr/src/app WORKDIR /usr/src/app

View File

@@ -3,7 +3,7 @@
FROM docker.io/library/archlinux:latest FROM docker.io/library/archlinux:latest
RUN pacman-key --init \ RUN pacman-key --init \
&& pacman --sync --refresh --sysupgrade --noconfirm python3 \ && pacman --sync --refresh --sysupgrade --noconfirm make python3 \
&& printf "LANG=en_US.UTF-8\n" > /etc/locale.conf \ && printf "LANG=en_US.UTF-8\n" > /etc/locale.conf \
&& locale-gen \ && locale-gen \
&& pacman --sync --clean --clean --noconfirm && pacman --sync --clean --clean --noconfirm

View File

@@ -2,7 +2,7 @@
FROM docker.io/library/centos:7 FROM docker.io/library/centos:7
RUN yum install -y epel-release && yum install -y python36 && yum clean all RUN yum install -y epel-release && yum install -y make python36 && yum clean all
WORKDIR /usr/src/app WORKDIR /usr/src/app

View File

@@ -8,6 +8,7 @@ RUN apt-get update \
&& apt-get install -y \ && apt-get install -y \
ca-certificates \ ca-certificates \
locales \ locales \
make \
procps \ procps \
python3 \ python3 \
&& localedef \ && localedef \

View File

@@ -4,7 +4,7 @@
# https://www.mail-archive.com/ubuntu-bugs@lists.ubuntu.com/msg5971024.html # https://www.mail-archive.com/ubuntu-bugs@lists.ubuntu.com/msg5971024.html
FROM registry.fedoraproject.org/fedora:34 FROM registry.fedoraproject.org/fedora:34
RUN dnf install -y python3 procps && dnf clean all RUN dnf install -y make python3 procps && dnf clean all
WORKDIR /usr/src/app WORKDIR /usr/src/app

View File

@@ -8,6 +8,7 @@ RUN apt-get update \
&& apt-get install -y \ && apt-get install -y \
ca-certificates \ ca-certificates \
locales \ locales \
make \
python3 \ python3 \
&& localedef \ && localedef \
-i en_US \ -i en_US \