Skip to content

Commit

Permalink
Fix build on Linux
Browse files Browse the repository at this point in the history
Add GHA tests
  • Loading branch information
gaborcsardi committed Nov 29, 2023
1 parent d4b2a1d commit f663e11
Show file tree
Hide file tree
Showing 9 changed files with 188 additions and 3 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Test build on various Linux distros

on:
workflow_dispatch:
inputs:
ubuntu-2204:
description: "Ubuntu 22.04"
required: true
type: choice
options:
- 'yes'
- 'no'
default: 'yes'
debian-12:
description: "Debian 12"
required: true
type: choice
options:
- 'yes'
- 'no'
default: 'yes'
fedora-38:
description: "Fedora 38"
required: true
type: choice
options:
- 'yes'
- 'no'
default: 'yes'

jobs:
ubuntu-22.04:
if: ${{ github.event.inputs.ubuntu-2204 == '' || github.event.inputs.ubuntu-2204 == 'yes' }}
runs-on: ubuntu-latest
name: Ubuntu 22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build in Docker
run: |
docker build -f tools/build/linux/Dockerfile-ubuntu-22.04 -t bqs:ubuntu2204 .
docker run bqs:ubuntu2204 R -q -e 'library(bigrquerystorage)'
debian-12:
if: ${{ github.event.inputs.debian-12 == '' || github.event.inputs.debian-12 == 'yes' }}
runs-on: ubuntu-latest
name: Debian 12
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build in Docker
run: |
docker build -f tools/build/linux/Dockerfile-debian-12 -t bqs:debian12 .
docker run bqs:debian12 R -q -e 'library(bigrquerystorage)'
fedora-38:
if: ${{ github.event.inputs.fedora-38 == '' || github.event.inputs.fedora-38 == 'yes' }}
runs-on: ubuntu-latest
name: Fedora 38
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build in Docker
run: |
docker build -f tools/build/linux/Dockerfile-fedora-38 -t bqs:fedora-38 .
docker run bqs:fedora-38 R -q -e 'library(bigrquerystorage)'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ src/google/
*.so
*.dll
.httr-oauth
/src/Makevars
1 change: 1 addition & 0 deletions inst/include/bigrquerystorage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include <cstdint>
1 change: 1 addition & 0 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Generated by using Rcpp::compileAttributes() -> do not edit by hand
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#include "../inst/include/bigrquerystorage.h"
#include <Rcpp.h>

using namespace Rcpp;
Expand Down
41 changes: 41 additions & 0 deletions tools/build/linux/Dockerfile-debian-12
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# -*- Dockerfile -*-

FROM debian:12

# -------------------------------------------------------------------------
# This is going to use P3M on x86_64
COPY tools/build/linux/rig.gpg /etc/apt/trusted.gpg.d/rig.gpg
RUN echo "deb http://rig.r-pkg.org/deb rig main" > \
/etc/apt/sources.list.d/rig.list && \
export DEBIAN_FRONTEND=noninteractive && \
apt-get update -y && \
apt-get install -y r-rig && \
rig add release

# -------------------------------------------------------------------------
# FIXME: We don't need this once grpc is in the system requirements db
RUN apt-get install -y libprotobuf-dev protobuf-compiler-grpc \
libgrpc++-dev libc-ares-dev \
libre2-dev pkg-config

# -------------------------------------------------------------------------
# Only copy DESCRIPTION, so Docker can cache the dependency install
RUN mkdir /root/bigrquerystorage
COPY DESCRIPTION /root/bigrquerystorage/
WORKDIR /root/bigrquerystorage
# No upgrade, to always install binary packages, in case P3M is behind
RUN R -q -e 'pak::local_install_deps(upgrade = FALSE)'

# -------------------------------------------------------------------------
# Call R CMD build first, so we get rid of Makevars, .o, .so, etc.
# Change file ownership, otherwise git complains
# Clean up thoroughly, in case the cleanup script is not perfect.
RUN apt-get install -y git
COPY . /root/bigrquerystorage
RUN chown root:root -R .
RUN git clean -fdx .

# -------------------------------------------------------------------------
WORKDIR /root
RUN R CMD build bigrquerystorage
RUN R CMD INSTALL bigrquerystorage_*.tar.gz
36 changes: 36 additions & 0 deletions tools/build/linux/Dockerfile-fedora-38
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# -*- Dockerfile -*-

FROM fedora:38

# -------------------------------------------------------------------------
RUN yum install -y \
https://github.com/r-lib/rig/releases/download/latest/r-rig-latest-1.$(arch).rpm && \
rig add devel

# -------------------------------------------------------------------------
# FIXME: We don't need this once grpc is in the system requirements db
RUN dnf install -y protobuf-devel protobuf-compiler \
grpc-devel c-ares-devel \
re2-devel pkgconf

# -------------------------------------------------------------------------
# Only copy DESCRIPTION, so Docker can cache the dependency install
RUN mkdir /root/bigrquerystorage
COPY DESCRIPTION /root/bigrquerystorage/
WORKDIR /root/bigrquerystorage
# No upgrade, to always install binary packages, in case P3M is behind
RUN R -q -e 'pak::local_install_deps(upgrade = FALSE)'

# -------------------------------------------------------------------------
# Call R CMD build first, so we get rid of Makevars, .o, .so, etc.
# Change file ownership, otherwise git complains
# Clean up thoroughly, in case the cleanup script is not perfect.
RUN dnf install -y git
COPY . /root/bigrquerystorage
RUN chown root:root -R .
RUN git clean -fdx .

# -------------------------------------------------------------------------
WORKDIR /root
RUN R CMD build bigrquerystorage
RUN R CMD INSTALL bigrquerystorage_*.tar.gz
41 changes: 41 additions & 0 deletions tools/build/linux/Dockerfile-ubuntu-22.04
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# -*- Dockerfile -*-

FROM ubuntu:22.04

# -------------------------------------------------------------------------
# This is going to use P3M on x86_64
COPY tools/build/linux/rig.gpg /etc/apt/trusted.gpg.d/rig.gpg
RUN echo "deb http://rig.r-pkg.org/deb rig main" > \
/etc/apt/sources.list.d/rig.list && \
export DEBIAN_FRONTEND=noninteractive && \
apt-get update -y && \
apt-get install -y r-rig && \
rig add release

# -------------------------------------------------------------------------
# FIXME: We don't need this once grpc is in the system requirements db
RUN apt-get install -y libprotobuf-dev protobuf-compiler-grpc \
libgrpc++-dev libc-ares-dev libre2-dev \
pkg-config

# -------------------------------------------------------------------------
# Only copy DESCRIPTION first, so Docker can cache the dependency install
RUN mkdir /root/bigrquerystorage
COPY DESCRIPTION /root/bigrquerystorage/
WORKDIR /root/bigrquerystorage
# No upgrade, to always install binary packages, in case P3M is behind
RUN R -q -e 'pak::local_install_deps(upgrade = FALSE)'

# -------------------------------------------------------------------------
# Call R CMD build first, so we get rid of Makevars, .o, .so, etc.
# Change file ownership, otherwise git complains
# Clean up thoroughly, in case the cleanup script is not perfect.
RUN apt-get install -y git
COPY . /root/bigrquerystorage
RUN chown root:root -R .
RUN git clean -fdx .

# -------------------------------------------------------------------------
WORKDIR /root
RUN R CMD build bigrquerystorage
RUN R CMD INSTALL bigrquerystorage_*.tar.gz
Binary file added tools/build/linux/rig.gpg
Binary file not shown.
4 changes: 1 addition & 3 deletions tools/config/configure.R
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ if (mac) {
pkg_sources <- sort(dir("./src", ".cpp$|.c$"), decreasing = TRUE)

# linker libraries
linker_libs <- system(sprintf("%s --libs protobuf grpc++ openssl", pkg_config), intern = TRUE)
linker_libs <- system(sprintf("%s --libs protobuf grpc++", pkg_config), intern = TRUE)

# abseil no longer contains a dynamic_annotations library. brew install
# separatly, from Abseil LTS 20200923, Patch 1
Expand All @@ -179,8 +179,6 @@ if (mac) {
# some windows lib needs to be added manually for building with static openssl
if (isTRUE(win)) {
linker_libs <- paste(linker_libs, "-lcrypt32 -lws2_32 -limagehlp")
} else {
linker_libs <- paste(linker_libs, "-lupb_collections_lib -lupb_json_lib -lupb_textformat_lib -lupb -lutf8_range_lib -lre2 -lcares -laddress_sorting -lsystemd")
}

# compiler flags
Expand Down

0 comments on commit f663e11

Please sign in to comment.