Skip to content

Commit d998f4d

Browse files
authored
Merge pull request #2 from pythonhealthdatascience/dev
Dev
2 parents f47b3cb + 76767fe commit d998f4d

File tree

15 files changed

+3413
-6
lines changed

15 files changed

+3413
-6
lines changed

.Rprofile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
source("renv/activate.R")
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Publish docker on GHCR, then render and deploy quarto on GitHub pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
inputs:
8+
force_docker_build:
9+
description: 'Force Docker build (skip change detection)'
10+
required: true
11+
type: boolean
12+
default: false
13+
skip_docker_build:
14+
description: 'Skip Docker build (use last built image)'
15+
required: true
16+
type: boolean
17+
default: false
18+
19+
jobs:
20+
publish-docker:
21+
name: Publish docker
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: read
25+
packages: write
26+
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
31+
- name: Check if Docker build needed
32+
id: changes
33+
uses: dorny/paths-filter@v3
34+
with:
35+
filters: |
36+
docker:
37+
- 'Dockerfile'
38+
- 'environment.yaml'
39+
- 'renv.lock'
40+
- 'renv/**'
41+
42+
- name: Login to GitHub Container Registry
43+
if: >
44+
(!inputs.skip_docker_build) &&
45+
(inputs.force_docker_build || steps.changes.outputs.docker == 'true')
46+
uses: docker/login-action@v3
47+
with:
48+
registry: ghcr.io
49+
username: ${{ github.actor }}
50+
password: ${{ secrets.GITHUB_TOKEN }}
51+
52+
- name: Build the Docker image
53+
if: >
54+
(!inputs.skip_docker_build) &&
55+
(inputs.force_docker_build || steps.changes.outputs.docker == 'true')
56+
uses: docker/build-push-action@v6
57+
with:
58+
context: .
59+
tags: |
60+
ghcr.io/pythonhealthdatascience/hdruk_tests:latest
61+
push: true
62+
63+
build-deploy:
64+
runs-on: ubuntu-latest
65+
needs: [publish-docker]
66+
container:
67+
image: ghcr.io/pythonhealthdatascience/hdruk_tests:latest
68+
credentials:
69+
username: ${{ github.actor }}
70+
password: ${{ secrets.GITHUB_TOKEN }}
71+
permissions:
72+
contents: write
73+
packages: read
74+
steps:
75+
- name: Check out repository
76+
uses: actions/checkout@v4
77+
with:
78+
fetch-depth: 0
79+
80+
- name: Configure Git safe directory
81+
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
82+
83+
- name: Render and publish to GitHub pages
84+
uses: quarto-dev/quarto-actions/publish@v2
85+
with:
86+
target: gh-pages
87+
env:
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
/.quarto/
22
**/*.quarto_ipynb
3-
_site/
3+
_site/
4+
.Rproj.user
5+
.Renviron

DESCRIPTION

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Title: hdruk_tests
2+
Imports:
3+
knitr
4+
reticulate
5+
rmarkdown
6+
testthat

Dockerfile

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
FROM ubuntu:24.04
2+
3+
# Non-interactive and locale
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
6+
# System dependencies (R 4.4+ from CRAN, wget, etc.)
7+
RUN apt-get update && \
8+
apt-get install -y --no-install-recommends \
9+
wget \
10+
ca-certificates \
11+
gnupg \
12+
software-properties-common \
13+
dirmngr \
14+
locales \
15+
git && \
16+
locale-gen en_GB.UTF-8 && \
17+
rm -rf /var/lib/apt/lists/*
18+
19+
ENV LANG=en_GB.UTF-8
20+
ENV LC_ALL=en_GB.UTF-8
21+
22+
# Add CRAN repo for R >= 4.4 on Ubuntu 24.04 (noble)
23+
RUN wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | \
24+
gpg --dearmor -o /usr/share/keyrings/r-project.gpg && \
25+
echo "deb [signed-by=/usr/share/keyrings/r-project.gpg] https://cloud.r-project.org/bin/linux/ubuntu noble-cran40/" \
26+
> /etc/apt/sources.list.d/r-project.list && \
27+
apt-get update && \
28+
apt-get install -y --no-install-recommends \
29+
r-base \
30+
r-base-dev && \
31+
rm -rf /var/lib/apt/lists/*
32+
33+
# Install Quarto CLI
34+
RUN wget -qO /tmp/quarto.deb https://quarto.org/download/latest/quarto-linux-amd64.deb && \
35+
apt-get update && \
36+
apt-get install -y /tmp/quarto.deb && \
37+
rm /tmp/quarto.deb && \
38+
rm -rf /var/lib/apt/lists/*
39+
40+
# Install Miniconda
41+
ENV CONDA_DIR=/opt/conda
42+
RUN wget -qO /tmp/miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
43+
bash /tmp/miniconda.sh -b -p "$CONDA_DIR" && \
44+
rm /tmp/miniconda.sh
45+
ENV PATH="$CONDA_DIR/bin:${PATH}"
46+
47+
# Configure conda for non-interactive use and faster solving
48+
RUN conda config --system --set always_yes yes && \
49+
conda config --system --set changeps1 no
50+
51+
# Accept Anaconda ToS for required channels in non-interactive builds
52+
RUN conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && \
53+
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
54+
55+
# Copy project
56+
WORKDIR /workspace
57+
COPY . /workspace
58+
59+
# Remove .Renviron if it was copied (to avoid hardcoded host paths)
60+
RUN rm -f /workspace/.Renviron
61+
62+
# Create the conda environment
63+
RUN conda env create -f environment.yaml
64+
65+
# Make the environment active by default
66+
ENV CONDA_DEFAULT_ENV=hdruk_tests
67+
ENV PATH="/opt/conda/envs/hdruk_tests/bin:${PATH}"
68+
RUN echo "conda activate hdruk_tests" >> /root/.bashrc
69+
70+
# R: set renv path and restore packages
71+
ENV RENV_PATHS_LIBRARY=/workspace/renv/library
72+
73+
# Install renv and restore R packages
74+
RUN Rscript -e "install.packages('renv', repos = 'https://cloud.r-project.org')" && \
75+
Rscript -e "renv::restore()"
76+
77+
# Set conda environment as default for reticulate
78+
ENV RETICULATE_PYTHON=/opt/conda/envs/hdruk_tests/bin/python
79+
80+
# Default command
81+
CMD ["/bin/bash"]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# HDR UK Futures RSE Testing Course Materials
1+
# HDR UK Futures RSE: Testing in Research Workflows
22

3-
This repository contains code behind our website with materials for the 'Testing' module on HDR UK's RSE001 <a href='https://hdruklearn.org/courses/course-v1:HDRUK+RSE001+2024' target ='_blank'>Research Software Engineering training course</a>. It was developed as part of the <a href='https://pythonhealthdatascience.github.io/stars/' target='_blank'>STARS project</a>."
3+
This repository contains code behind our website with materials for the 'Testing in Research Workflows' module on HDR UK's RSE001 <a href='https://hdruklearn.org/courses/course-v1:HDRUK+RSE001+2024' target ='_blank'>Research Software Engineering training course</a>. It was developed as part of the <a href='https://pythonhealthdatascience.github.io/stars/' target='_blank'>STARS project</a>.
44

55
You can view the website here: <https://pythonhealthdatascience.github.io/hdruk_tests/>
66

_quarto.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ project:
22
type: website
33

44
website:
5-
title: "Testing Course Materials"
5+
title: "Testing in Research Workflows"
66
favicon: images/futures.png
77
page-navigation: true
88
navbar:
@@ -11,7 +11,7 @@ website:
1111
announcement:
1212
dismissable: false
1313
icon: info-circle
14-
content: "This site contains materials for the 'Testing' module on HDR UK's RSE001 <a href='https://hdruklearn.org/courses/course-v1:HDRUK+RSE001+2024' target ='_blank'>Research Software Engineering training course</a>. It was developed as part of the <a href='https://pythonhealthdatascience.github.io/stars/' target='_blank'>STARS project</a>."
14+
content: "This site contains materials for the testing module on HDR UK's RSE001 <a href='https://hdruklearn.org/courses/course-v1:HDRUK+RSE001+2024' target ='_blank'>Research Software Engineering training course</a>. It was developed as part of the <a href='https://pythonhealthdatascience.github.io/stars/' target='_blank'>STARS project</a>."
1515
position: below-navbar
1616
sidebar:
1717
contents:

environment.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
name: hdruk_tests
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
- pytest=9.0.2
6+
- python=3.14

hdruk_tests.Rproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Version: 1.0
2+
ProjectId: 3b6708d0-59ad-4b5f-a7b1-9f9769eaa5b0
3+
4+
RestoreWorkspace: Default
5+
SaveWorkspace: Default
6+
AlwaysSaveHistory: Default
7+
8+
EnableCodeIndexing: Yes
9+
UseSpacesForTab: Yes
10+
NumSpacesForTab: 2
11+
Encoding: UTF-8
12+
13+
RnwWeave: Sweave
14+
LaTeX: pdfLaTeX

images/website_screenshot.png

-297 Bytes
Loading

0 commit comments

Comments
 (0)