Skip to content

Commit

Permalink
ci: build inside docker
Browse files Browse the repository at this point in the history
Avoid reinstalling dependencies
  • Loading branch information
guyou committed Aug 8, 2023
1 parent 6553987 commit f0ed2a5
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 5 deletions.
43 changes: 38 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,56 @@ on:
branches: [ "master" ]

jobs:
docker:

strategy:
matrix:
ubuntu: [22.04, 20.04]
libgtk: [libgtk-3-dev, libgtk2.0-dev]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
docker:
- 'docker/**'
- name: Build and push
uses: docker/build-push-action@v4
with:
context: "{{defaultContext}}:docker/build"
push: true
tags: ghcr.io/viking-gps/viking-build-env:${{ matrix.ubuntu }}-${{ matrix.libgtk }}
if: steps.changes.outputs.docker == 'true'

build:
if: ${{ always() }}
needs: docker

strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-20.04]
libgtk: [libgtk-3-dev, libgtk2.0-dev]

runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
container:
image: ghcr.io/viking-gps/viking-build-env:${{ matrix.ubuntu }}-${{ matrix.libgtk }}

steps:
- uses: actions/checkout@v3

- name: "Install requirements"
run: sudo apt-get install gtk-doc-tools docbook-xsl yelp-tools libpng-dev ${{ matrix.libgtk }} libicu-dev libjson-glib-dev intltool autopoint xxd libcurl4-gnutls-dev libglib2.0-dev-bin libsqlite3-dev nettle-dev libmapnik-dev libgeoclue-2-dev libgexiv2-dev libgps-dev libmagic-dev libbz2-dev libzip-dev liboauth-dev libnova-dev
shell: bash

- name: Prepare
run: ./autogen.sh ${{ matrix.libgtk == 'libgtk2.0-dev' && '--enable-gtk2' }}

Expand Down
10 changes: 10 additions & 0 deletions docker/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ARG UBUNTU_VERSION=22.04

FROM ubuntu:$UBUNTU_VERSION

ARG LIBGTK=libgtk-3-dev

ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && \
apt install -y gtk-doc-tools docbook-xsl yelp-tools libpng-dev $LIBGTK libicu-dev libjson-glib-dev intltool autopoint xxd libcurl4-gnutls-dev libglib2.0-dev-bin libsqlite3-dev nettle-dev libmapnik-dev libgeoclue-2-dev libgexiv2-dev libgps-dev libmagic-dev libbz2-dev libzip-dev liboauth-dev libnova-dev && \
rm -rf /var/lib/apt/lists/*
18 changes: 18 additions & 0 deletions docker/build/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
all: \
ubuntu2004-gtk3 \
ubuntu2004-gtk2 \
ubuntu2204-gtk3 \
ubuntu2204-gtk2

ubuntu2004-gtk3:
docker build --build-arg UBUNTU_VERSION=20.04 --build-arg LIBGTK=libgtk-3-dev -t viking-build:$@ .

ubuntu2004-gtk2:
docker build --build-arg UBUNTU_VERSION=20.04 --build-arg LIBGTK=libgtk2.0-dev -t viking-build:$@ .

ubuntu2204-gtk3:
docker build --build-arg UBUNTU_VERSION=22.04 --build-arg LIBGTK=libgtk-3-dev -t viking-build:$@ .

ubuntu2204-gtk2:
docker build --build-arg UBUNTU_VERSION=22.04 --build-arg LIBGTK=libgtk2.0-dev -t viking-build:$@ .

0 comments on commit f0ed2a5

Please sign in to comment.