Skip to content

first attempt at fixing broken backfill build #1958

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 11 additions & 31 deletions .github/workflows/backfill-corr-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,57 +10,37 @@ name: R backfill corrections

on:
push:
branches: [ main, prod ]
branches: [main, prod]
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ]
branches: [ main, prod ]
types: [opened, synchronize, reopened, ready_for_review]
branches: [main, prod]

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
strategy:
matrix:
r-version: [4.2.1]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (optional): maybe we want to keep the matrix way of providing r-version for future flexibility? In some other packages, we specify several different R versions to run tests on.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just add that in when we need it, CI-wise it'll be about the same amount of work then.

defaults:
run:
working-directory: backfill_corrections/delphiBackfillCorrection

steps:
- uses: actions/checkout@v2
- name: Set up R ${{ matrix.r-version }}
- uses: actions/checkout@v4

- name: Set up R 4.2
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.r-version }}
use-public-rspm: true
- name: Install linux dependencies
run: |
sudo apt-get install \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: we don't need this section because r-lib/actions/setup-r-dependencies@v2 installs using pak, which as you mentioned above also installs dependencies?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libcurl4-openssl-dev \
libgdal-dev \
libudunits2-dev \
libglpk-dev \
libharfbuzz-dev \
libfribidi-dev
- name: Get date
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
- name: Cache R packages
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise:

setup-r-dependencies already caches, so no need for the caching action

Nice! Good simplification here and above.

uses: actions/cache@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-r-backfillcorr-${{ steps.get-date.outputs.date }}
restore-keys: |
${{ runner.os }}-r-backfillcorr-
r-version: 4.2

- name: Install and cache dependencies
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
working-directory: backfill_corrections/delphiBackfillCorrection
upgrade: 'TRUE'
upgrade: "TRUE"

- name: Check package
uses: r-lib/actions/check-r-package@v2
with:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/build-container-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ name: Build indicator container images and upload to registry

on:
push:
branches: [ main, prod ]
branches: [main, prod]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
packages: [ backfill_corrections ]
packages: [backfill_corrections]
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down
17 changes: 6 additions & 11 deletions backfill_corrections/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM gurobi/optimizer:9.5.1 as gurobi

## Install R and tidyverse
FROM rocker/tidyverse:latest
FROM rocker/tidyverse:4.2

WORKDIR /opt/gurobi
COPY --from=gurobi /opt/gurobi .
Expand All @@ -15,22 +15,17 @@ ENV LD_LIBRARY_PATH $GUROBI_HOME/lib
RUN ln -s -f /usr/share/zoneinfo/America/New_York /etc/localtime

RUN apt-get update && apt-get install -qq -y \
libglpk-dev\
apt-file \
python3-venv \
python3-dev \
python3-pip

RUN install2.r --error \
roxygen2 \
Rglpk \
argparser

RUN R -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/stable/%s/%s/%s", .Platform$pkgType, R.Version()$os, R.Version()$arch))'
RUN R -e 'install.packages(c("rspm"))'
RUN --mount=type=secret,id=GITHUB_TOKEN \
export GITHUB_PAT="$(cat /run/secrets/GITHUB_TOKEN)" && \
R -e 'devtools::install_version("bettermc", version = "1.1.2")' && \
R -e 'devtools::install_github("cmu-delphi/covidcast", ref = "evalcast", subdir = "R-packages/evalcast")' && \
R -e 'devtools::install_github(repo="ryantibs/quantgen", subdir="quantgen")' && \
R -e 'install.packages(list.files(path="/opt/gurobi/linux64/R/", pattern="^gurobi_.*[.]tar[.]gz$", full.names = TRUE), repos=NULL)'
R -e 'rspm::enable(); pak::pkg_install(c("roxygen2", "Rglpk", "argparser", "gfkse/[email protected]", "cmu-delphi/covidcast/R-packages/evalcast@evalcast", "ryantibs/quantgen/quantgen"))'
RUN R -e 'install.packages(list.files(path="/opt/gurobi/linux64/R/", pattern="^gurobi_.*[.]tar[.]gz$", full.names = TRUE), repos=NULL)'

WORKDIR /backfill_corrections/
ADD ./delphiBackfillCorrection ./delphiBackfillCorrection/
Expand Down