Integrate docker rebuild workflow

This commit is contained in:
Florian Bruhin 2020-11-25 19:46:41 +01:00
parent 9e1ab36172
commit ec93c0458c
4 changed files with 119 additions and 0 deletions

60
.github/workflows/docker.yml vendored Normal file
View File

@ -0,0 +1,60 @@
name: Rebuild Docker CI images
on:
workflow_dispatch:
schedule:
- cron: "23 5 * * *" # daily at 5:23
defaults:
run:
working-directory: scripts/dev/ci/docker/
jobs:
docker:
runs-on: ubuntu-latest
strategy:
matrix:
image:
- archlinux-webkit
- archlinux-webengine
- archlinux-webengine-unstable
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- run: pip install jinja2
- name: Generate Dockerfile
run: python3 generate.py ${{ matrix.image }}
- uses: docker/setup-buildx-action@v1
- uses: docker/login-action@v1
with:
username: qutebrowser
password: ${{ secrets.DOCKER_TOKEN }}
- uses: docker/build-push-action@v2
with:
context: .
tags: "qutebrowser/ci:${{ matrix.image }}"
push: ${{ github.ref == 'refs/heads/master' }}
irc:
runs-on: ubuntu-latest
needs: [docker]
if: "always() && github.repository_owner == 'qutebrowser'"
steps:
- name: Send success IRC notification
uses: Gottox/irc-message-action@v1.1
if: "needs.docker.result == 'success'"
with:
server: chat.freenode.net
channel: '#qutebrowser-dev'
nickname: qutebrowser-bot
message: "[${{ github.workflow }}] \u00033Success:\u0003 ${{ github.ref }} https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} (@${{ github.actor }})"
- name: Send non-success IRC notification
uses: Gottox/irc-message-action@v1.1
if: "needs.docker.result != 'success'"
with:
server: chat.freenode.net
channel: '#qutebrowser-dev'
nickname: qutebrowser-bot
message: "[${{ github.workflow }}] \u00034FAIL:\u0003 ${{ github.ref }} https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} (@${{ github.actor }})"

View File

@ -0,0 +1,27 @@
FROM thecompiler/archlinux
MAINTAINER Florian Bruhin <me@the-compiler.org>
{% if unstable %}
RUN sed -i '/^# after the header/a[kde-unstable]\nInclude = /etc/pacman.d/mirrorlist\n\n[testing]\nInclude = /etc/pacman.d/mirrorlist' /etc/pacman.conf
{% endif %}
RUN pacman -Suyy --noconfirm \
git \
python-tox \
python-distlib \
qt5-base \
qt5-declarative \
{% if webengine %}qt5-webengine python-pyqtwebengine{% else %}qt5-webkit{% endif %} \
python-pyqt5 \
xorg-xinit \
xorg-server-xvfb \
ttf-bitstream-vera \
gcc \
libyaml \
xorg-xdpyinfo
USER user
WORKDIR /home/user
CMD git clone /outside qutebrowser.git && \
cd qutebrowser.git && \
tox -e py38

View File

@ -0,0 +1,9 @@
This directory contains a Dockerfile template for containers used to test
qutebrowser on CI.
The `generate.py` script uses that template to generate various image
configuration.
The images are rebuilt via Github Actions in this directory, and qutebrowser
then downloads them during the CI run. Note that means that it'll take a while
until builds will use the newer image if you make a change to this directory.

View File

@ -0,0 +1,23 @@
import sys
import jinja2
def main():
with open('Dockerfile.j2') as f:
template = jinja2.Template(f.read())
image = sys.argv[1]
config = {
'archlinux-webkit': {'webengine': False, 'unstable': False},
'archlinux-webengine': {'webengine': True, 'unstable': False},
'archlinux-webengine-unstable': {'webengine': True, 'unstable': True},
}[image]
with open('Dockerfile', 'w') as f:
f.write(template.render(**config))
f.write('\n')
if __name__ == '__main__':
main()