diff --git a/.github/workflows/asciinema.yml b/.github/workflows/asciinema.yml index 251b7ef..49d126e 100644 --- a/.github/workflows/asciinema.yml +++ b/.github/workflows/asciinema.yml @@ -1,22 +1,21 @@ +--- name: build - on: - push - pull_request - jobs: # Code style checks health: - name: Code health check + name: code health check runs-on: ubuntu-latest steps: - - name: Checkout Asciinema + - name: checkout asciinema uses: actions/checkout@v2 - - name: Setup Python + - name: setup Python uses: actions/setup-python@v2 with: python-version: "3.9" - - name: Install dependencies + - name: install dependencies run: pip install build cmarkgfm pycodestyle twine - name: Run pycodestyle run: > @@ -27,7 +26,7 @@ jobs: twine check dist/* # Asciinema checks asciinema: - name: Asciinema - py${{ matrix.python }} + name: Asciinema runs-on: ubuntu-latest strategy: matrix: @@ -40,13 +39,70 @@ jobs: env: TERM: dumb steps: - - name: Checkout Asciinema + - name: checkout Asciinema uses: actions/checkout@v2 - - name: Setup Python + - name: setup Python uses: actions/setup-python@v2 with: python-version: ${{ matrix.python }} - - name: Install dependencies + - name: install dependencies run: pip install pytest - - name: Run Asciinema tests + - name: run Asciinema tests 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 diff --git a/tests/distros/Dockerfile.alpine b/tests/distros/Dockerfile.alpine index 3fec48f..bdc3fc8 100644 --- a/tests/distros/Dockerfile.alpine +++ b/tests/distros/Dockerfile.alpine @@ -2,7 +2,8 @@ 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 diff --git a/tests/distros/Dockerfile.arch b/tests/distros/Dockerfile.arch index 4b4f6cb..3224495 100644 --- a/tests/distros/Dockerfile.arch +++ b/tests/distros/Dockerfile.arch @@ -3,7 +3,7 @@ FROM docker.io/library/archlinux:latest 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 \ && locale-gen \ && pacman --sync --clean --clean --noconfirm diff --git a/tests/distros/Dockerfile.centos b/tests/distros/Dockerfile.centos index c1693ee..bc4fd7e 100644 --- a/tests/distros/Dockerfile.centos +++ b/tests/distros/Dockerfile.centos @@ -2,7 +2,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 diff --git a/tests/distros/Dockerfile.debian b/tests/distros/Dockerfile.debian index 4bb4e4c..6c14287 100644 --- a/tests/distros/Dockerfile.debian +++ b/tests/distros/Dockerfile.debian @@ -8,6 +8,7 @@ RUN apt-get update \ && apt-get install -y \ ca-certificates \ locales \ + make \ procps \ python3 \ && localedef \ diff --git a/tests/distros/Dockerfile.fedora b/tests/distros/Dockerfile.fedora index 6be7951..e5abb51 100644 --- a/tests/distros/Dockerfile.fedora +++ b/tests/distros/Dockerfile.fedora @@ -4,7 +4,7 @@ # https://www.mail-archive.com/ubuntu-bugs@lists.ubuntu.com/msg5971024.html 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 diff --git a/tests/distros/Dockerfile.ubuntu b/tests/distros/Dockerfile.ubuntu index 60a6bf6..38223c2 100644 --- a/tests/distros/Dockerfile.ubuntu +++ b/tests/distros/Dockerfile.ubuntu @@ -8,6 +8,7 @@ RUN apt-get update \ && apt-get install -y \ ca-certificates \ locales \ + make \ python3 \ && localedef \ -i en_US \