diff options
author | Florian Bruhin <me@the-compiler.org> | 2020-11-25 19:46:41 +0100 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2020-11-25 19:49:25 +0100 |
commit | ec93c0458cfa50baf059c1c3efa8fc42f02c9b04 (patch) | |
tree | a643604c341ff1037aa15f2ce7400ebb9d20d4d6 | |
parent | 9e1ab361729a3ccad8ce2d0afb2d5c4230eddeb4 (diff) | |
download | qutebrowser-ec93c0458cfa50baf059c1c3efa8fc42f02c9b04.tar.gz qutebrowser-ec93c0458cfa50baf059c1c3efa8fc42f02c9b04.zip |
Integrate docker rebuild workflow
-rw-r--r-- | .github/workflows/docker.yml | 60 | ||||
-rw-r--r-- | scripts/dev/ci/docker/Dockerfile.j2 | 27 | ||||
-rw-r--r-- | scripts/dev/ci/docker/README.md | 9 | ||||
-rw-r--r-- | scripts/dev/ci/docker/generate.py | 23 |
4 files changed, 119 insertions, 0 deletions
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 000000000..e67cff8f9 --- /dev/null +++ b/.github/workflows/docker.yml @@ -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 }})" diff --git a/scripts/dev/ci/docker/Dockerfile.j2 b/scripts/dev/ci/docker/Dockerfile.j2 new file mode 100644 index 000000000..412c42cf2 --- /dev/null +++ b/scripts/dev/ci/docker/Dockerfile.j2 @@ -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 diff --git a/scripts/dev/ci/docker/README.md b/scripts/dev/ci/docker/README.md new file mode 100644 index 000000000..eb2b8db91 --- /dev/null +++ b/scripts/dev/ci/docker/README.md @@ -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. diff --git a/scripts/dev/ci/docker/generate.py b/scripts/dev/ci/docker/generate.py new file mode 100644 index 000000000..a79633ed1 --- /dev/null +++ b/scripts/dev/ci/docker/generate.py @@ -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() |