Skip to content

Commit

Permalink
Merge pull request #126 from f-kretschmer/docker
Browse files Browse the repository at this point in the history
Move to docker
  • Loading branch information
f-kretschmer authored Feb 8, 2024
2 parents e6e4671 + 7483537 commit d34e03e
Show file tree
Hide file tree
Showing 72 changed files with 951 additions and 2,860 deletions.
4 changes: 4 additions & 0 deletions .Rprofile
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
options(renv.config.ppm.enabled = TRUE)
options(renv.config.ppm.default = TRUE)
options(repos = c(CRAN = "https://packagemanager.posit.co/cran/__linux__/bookworm/2024-02-06"))
options(renv.config.repos.override = getOption("repos"))
source("renv/activate.R")
27 changes: 27 additions & 0 deletions .github/workflows/build_container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build and push docker container

on:
push:
paths:
# - 'scripts/**' # whole scripts probably too much
- 'scripts/Python/requirements.txt'
- 'renv.lock'
- 'renv/**'
- 'Dockerfile'
- '.Rprofile'

jobs:
dockerloginbuildpush:
runs-on: ubuntu-latest
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
- name: Create image from repository
run: docker build -t ghcr.io/${{ github.actor }}/repo_rt_preprocessing .
- name: Push image to GitHub Container Registry
run: docker push ghcr.io/${{ github.actor }}/repo_rt_preprocessing:latest
57 changes: 0 additions & 57 deletions .github/workflows/compute_fingerprints.yaml

This file was deleted.

68 changes: 0 additions & 68 deletions .github/workflows/prepare_renv.yaml

This file was deleted.

50 changes: 10 additions & 40 deletions .github/workflows/preprocess.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ on:
jobs:
preprocess:
name: Preprocess raw data
# NOTE: on windows as computing of descriptors has a bug on linux right now
runs-on: windows-2019
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} # needed for pulling R packages from github
runs-on: ubuntu-latest
container:
image: ghcr.io/${{ github.actor }}/repo_rt_preprocessing:latest
env:
RENV_PATHS_LIBRARY: '/renv/library'
defaults:
run:
shell: bash

steps:
- name: Checkout fork repository
Expand All @@ -33,49 +37,14 @@ jobs:
- name: Get new/changed datasets
id: filesfolders
shell: bash {0}
run: echo "files=$(for f in ${{ steps.files.outputs.all }}; do basename $(dirname $f); done | grep -E '^[0-9]+$' | sort | uniq | tr '\n' ' ')" >> $GITHUB_OUTPUT
run: echo "files=$(for f in ${{ steps.files.outputs.added_modified_renamed }}; do basename $(dirname $f); done | grep -E '^[0-9]+$' | sort | uniq | tr '\n' ' ')" >> $GITHUB_OUTPUT

- name: List all added files
shell: bash {0}
run: |
for f in ${{ steps.filesfolders.outputs.files }}; do
ls -lh raw_data/$f
done
- name: Pyton dependencies
run: pip install -r scripts/Python/requirements.txt

- name: Setup java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

- name: Set RENV_PATHS_ROOT
shell: bash
run: |
echo "RENV_PATHS_ROOT=${{ runner.temp }}/renv" >> $GITHUB_ENV
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
r-version: 4.2.2

- name: Restore Renv package cache
uses: actions/cache@v3
with:
path: ${{ env.RENV_PATHS_ROOT }}
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
restore-keys: |
${{ runner.os }}-renv-
- name: Activate renv
shell: Rscript {0}
run: |
options(renv.config.mran.enabled = FALSE)
renv::restore()
- name: Standardize compounds
run: Rscript scripts/R_ci/compounds_standardize.R ${{ steps.filesfolders.outputs.files }}

Expand Down Expand Up @@ -117,6 +86,7 @@ jobs:
run: |
git config --global user.email '[email protected]'
git config --global user.name 'Github Actions'
git config --global safe.directory '*'
# Use LFS storage of main repository: no push access to fork LFS storage
# TODO: change once repository is moved
git config lfs.url 'https://github.com/f-kretschmer/pr_test_repo.git/info/lfs'
Expand Down
59 changes: 12 additions & 47 deletions .github/workflows/preprocess_manual.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,66 +35,31 @@ on:
jobs:
preprocess:
name: Preprocess raw data
# NOTE: on windows as computing of descriptors has a bug on linux right now
runs-on: windows-2019
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} # needed for pulling R packages from github
runs-on: ubuntu-latest
container:
image: ghcr.io/${{ github.actor }}/repo_rt_preprocessing:latest
env:
RENV_PATHS_LIBRARY: '/renv/library'
defaults:
run:
shell: bash

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
lfs: true


- name: List all files for selected datasets
shell: bash {0}
run: |
for f in ${{ inputs.datasets }}; do
ls -lh raw_data/$f || true
ls -lh processed_data/$f || true
done
continue-on-error: true

- name: Pyton dependencies
run: pip install -r scripts/Python/requirements.txt
# needed for every task

- name: Setup java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
# needed for every task

- name: Set RENV_PATHS_ROOT
shell: bash
run: |
echo "RENV_PATHS_ROOT=${{ runner.temp }}/renv" >> $GITHUB_ENV
# needed for every task

- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
r-version: 4.2.2
# needed for every task

- name: Restore Renv package cache
uses: actions/cache@v3
with:
path: ${{ env.RENV_PATHS_ROOT }}
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
restore-keys: |
${{ runner.os }}-renv-
# needed for every task

- name: Activate renv
shell: Rscript {0}
run: |
options(renv.config.mran.enabled = FALSE)
renv::restore()
# needed for every task
- name: check renv
run: Rscript -e "renv::status()"

- name: Standardize compounds
run: Rscript scripts/R_ci/compounds_standardize.R ${{ inputs.datasets }}
Expand Down Expand Up @@ -145,8 +110,8 @@ jobs:
run: |
git config --global user.email '[email protected]'
git config --global user.name 'Github Actions'
# Use LFS storage of main repository: no push access to fork LFS storage
# TODO: change once repository is moved
# because of dockerized environment, git will otherwise complain about "dubious ownership of directory"
git config --global safe.directory '*'
git add processed_data raw_data
git commit -m "Preprocessing ${{ inputs.datasets }}" -m "Tasks:
- standardize compounds: ${{ inputs.do_standardize }}
Expand Down
66 changes: 0 additions & 66 deletions .github/workflows/renv.yaml

This file was deleted.

Loading

0 comments on commit d34e03e

Please sign in to comment.