Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ Yetman - RMI authored and CJ Yetman - RMI committed May 24, 2024
1 parent 0f1e9cd commit b83cfa7
Show file tree
Hide file tree
Showing 12 changed files with 521 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @cjyetman will be requested for review when someone opens
# a pull request.
* @cjyetman
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
26 changes: 26 additions & 0 deletions .github/workflows/add-issues-to-ADO.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
# This example file will enable actions that trigger on created or modified GitHub issues.
#
# Note the @main in `uses:` on the last line. This will call the latest version of the workflow from the `main` branch in the RMI-PACTA/actions repo.
# You can also specify a tag from that repo, or a commit SHA to pin action versions.
on:
issues:
types:
[opened, edited, deleted, closed, reopened, labeled, unlabeled, assigned]
issue_comment:
types: [created, edited, deleted]

name: GH issues

permissions:
issues: write
pull-requests: write

jobs:
issues:
name: Run issues workflows
uses: RMI-PACTA/actions/.github/workflows/issues.yml@main
with:
ado_area_path: "2DegreesInvesting\\GitHub Issues"
secrets:
ADO_TOKEN: ${{ secrets.ADO_PERSONAL_ACCESS_TOKEN }}
21 changes: 21 additions & 0 deletions .github/workflows/add-prs-and-issues-to-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Adds all new issues and PRs to appropriate projects

on:
issues:
types:
- opened
- transferred
pull_request:
branches: [main]
types:
- opened

jobs:
add-to-maintainer-project:
name: Add issue/PR to @cjyetman's maintainer project
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
project-url: https://github.com/orgs/RMI-PACTA/projects/13
github-token: ${{ secrets.PAT_ADD_ISSUES_TO_PROJECT }}
29 changes: 29 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
# This example file will enable docker-related checks on push or PR to the main
# branch.
# It will also run the checks every weeknight at midnight UTC
#
# Note the @main in `uses:` on the last line. This will call the latest version
# of the workflow from the `main` brnach in the RMI-PACTA/actions repo. You can
# also specify a tag from that repo, or a commit SHA to pin action versions.
on:
pull_request:
push:
branches: [main]
schedule:
- cron: '0 0 * * 1,2,3,4,5'
workflow_dispatch:

name: docker

jobs:
docker:
name: Docker actions
uses: RMI-PACTA/actions/.github/workflows/docker.yml@main
with:
build-platform: |
[
"linux/amd64"
]
do-lint: false
do-check-r-sysdeps: false
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata

# because RStudio adds one even though this repo isn't an R package
.Rbuildignore

# to not accidentally merge a local config
.env

# macOS file
.DS_Store

# inputs/ and outputs/ dirs
inputs/
outputs/
29 changes: 29 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Package: workflow.benchmark.preparation
Title: Run the Benchmark Preparation Workflow
Version: 0.0.0.9000
Authors@R:
c(
person(
given = "CJ",
family = "Yetman",
role = c("aut", "cre", "ctr"),
email = "[email protected]",
comment = c(ORCID = "0000-0001-5099-9500")
),
person(
given = "RMI",
role = c("cph", "fnd"),
email = "[email protected]"
)
)
Description: A workflow to prepare benchmark indices for the PACTA tool.
License: MIT + file LICENSE
Encoding: UTF-8
Imports:
config,
dplyr,
logger,
pacta.data.scraping,
readxl
Remotes:
RMI-PACTA/pacta.data.scraping
54 changes: 54 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# using rocker r-vers as a base with R 4.4.0
# https://hub.docker.com/r/rocker/r-ver
# https://rocker-project.org/images/versioned/r-ver.html
ARG R_VERS="4.4.0"
FROM rocker/r-ver:$R_VERS AS base

# set Docker image labels
LABEL org.opencontainers.image.source=https://github.com/RMI-PACTA/workflow.benchmark.preparation
LABEL org.opencontainers.image.description="Docker image to run benchmark preparation"
LABEL org.opencontainers.image.licenses=MIT
LABEL org.opencontainers.image.title=""
LABEL org.opencontainers.image.revision=""
LABEL org.opencontainers.image.version=""
LABEL org.opencontainers.image.vendor=""
LABEL org.opencontainers.image.base.name=""
LABEL org.opencontainers.image.ref.name=""
LABEL org.opencontainers.image.authors=""

WORKDIR /app

# set apt-get to noninteractive mode
ARG DEBIAN_FRONTEND="noninteractive"
ARG DEBCONF_NOWARNINGS="yes"

# install system dependencies
RUN apt-get update \
&& rm -rf /var/lib/apt/lists/*

# sets CRAN repo to use Posit Package Manager to freeze R package versions to
# those available on 2024-05-15
# https://packagemanager.posit.co/client/#/repos/2/overview
# https://packagemanager.posit.co/cran/__linux__/jammy/2024-05-15
ARG CRAN_REPO="https://packagemanager.posit.co/cran/__linux__/jammy/2024-05-15"

RUN echo "options(repos = c(CRAN = '$CRAN_REPO'), pkg.sysreqs = FALSE)" >> "${R_HOME}/etc/Rprofile.site" \
&& Rscript -e "\
install.packages('pak'); \
"

# copy in DESCRIPTION from this repo
COPY DESCRIPTION /app/DESCRIPTION

# install pak, find dependencies from DESCRIPTION, and install them
RUN Rscript -e "\
deps <- pak::local_deps(root = '.'); \
pkg_deps <- deps[!deps[['direct']], 'ref']; \
print(pkg_deps); \
pak::pak(pkg_deps); \
"
COPY config.yml /app/config.yml
COPY *.R /app/

CMD ["Rscript", "/app/main.R"]

76 changes: 76 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
default:
project_code: "" # a single string specifying the desired project code, e.g."PA2024CH"
pacta_financial_timestamp: "" # a single string specifying the desired timestamp in the form "YYYYQN", e.g. "2023Q4"
msci_filename: "" # a single string specifying the filename of the MSCI XLSX input data
ishares_date: "" # a single string specifying the desired date of iShares data in the form "YYYYMMDD", e.g."20231229"
bonds_indices_urls: "" # a R expression specifying a named vector including the desired names and URLS of the iShares Bond indices to include
equity_indices_urls: "" # a R expression specifying a named vector including the desired names and URLS of the iShares Equity indices to include


2021Q4:
project_code: ""
pacta_financial_timestamp: "2021Q4"
msci_filename: ""
ishares_date: "20211231"
bonds_indices_urls: !expr |-
c(
"iShares Global Corp Bond UCITS ETF <USD (Distributing)>" =
"https://www.ishares.com/uk/individual/en/products/251813/ishares-global-corporate-bond-ucits-etf/"
)
equity_indices_urls: !expr |-
c(
"iShares Core S&P 500 UCITS ETF USD (Dist) <USD (Distributing)>" =
"https://www.ishares.com/uk/individual/en/products/251900/ishares-sp-500-ucits-etf-inc-fund/",
"iShares MSCI World UCITS ETF <USD (Distributing)>" =
"https://www.ishares.com/uk/individual/en/products/251881/ishares-msci-world-ucits-etf-inc-fund/",
"iShares MSCI EM UCITS ETF USD (Acc)" =
"https://www.ishares.com/uk/individual/en/products/251858/ishares-msci-emerging-markets-ucits-etf-acc-fund/",
"iShares MSCI ACWI UCITS ETF <USD (Accumulating)>" =
"https://www.ishares.com/uk/individual/en/products/251850/ishares-msci-acwi-ucits-etf/"
)
2022Q4:
project_code: ""
pacta_financial_timestamp: "2022Q4"
msci_filename: ""
ishares_date: "20221230"
bonds_indices_urls: !expr |-
c(
"iShares Global Corp Bond UCITS ETF <USD (Distributing)>" =
"https://www.ishares.com/uk/individual/en/products/251813/ishares-global-corporate-bond-ucits-etf/"
)
equity_indices_urls: !expr |-
c(
"iShares Core S&P 500 UCITS ETF USD (Dist) <USD (Distributing)>" =
"https://www.ishares.com/uk/individual/en/products/251900/ishares-sp-500-ucits-etf-inc-fund/",
"iShares MSCI World UCITS ETF <USD (Distributing)>" =
"https://www.ishares.com/uk/individual/en/products/251881/ishares-msci-world-ucits-etf-inc-fund/",
"iShares MSCI EM UCITS ETF USD (Acc)" =
"https://www.ishares.com/uk/individual/en/products/251858/ishares-msci-emerging-markets-ucits-etf-acc-fund/",
"iShares MSCI ACWI UCITS ETF <USD (Accumulating)>" =
"https://www.ishares.com/uk/individual/en/products/251850/ishares-msci-acwi-ucits-etf/"
)
2023Q4:
project_code: ""
pacta_financial_timestamp: "2023Q4"
msci_filename: "Constituents -29th Dec 2023-3.xlsx"
ishares_date: "20231229"
bonds_indices_urls: !expr |-
c(
"iShares Global Corp Bond UCITS ETF <USD (Distributing)>" =
"https://www.ishares.com/uk/individual/en/products/251813/ishares-global-corporate-bond-ucits-etf/"
)
equity_indices_urls: !expr |-
c(
"iShares Core S&P 500 UCITS ETF USD (Dist) <USD (Distributing)>" =
"https://www.ishares.com/uk/individual/en/products/251900/ishares-sp-500-ucits-etf-inc-fund/",
"iShares MSCI World UCITS ETF <USD (Distributing)>" =
"https://www.ishares.com/uk/individual/en/products/251881/ishares-msci-world-ucits-etf-inc-fund/",
"iShares MSCI EM UCITS ETF USD (Acc)" =
"https://www.ishares.com/uk/individual/en/products/251858/ishares-msci-emerging-markets-ucits-etf-acc-fund/",
"iShares MSCI ACWI UCITS ETF <USD (Accumulating)>" =
"https://www.ishares.com/uk/individual/en/products/251850/ishares-msci-acwi-ucits-etf/"
)
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
services:
scenario_prep:
platform: linux/amd64
build:
context: .
environment:
R_CONFIG_ACTIVE: ${R_CONFIG_ACTIVE:-2023Q4}
BENCHMARKS_PREPARATION_INPUTS_PATH: /mnt/inputs
BENCHMARKS_PREPARATION_OUTPUTS_PATH: /mnt/outputs
volumes:
- type: bind
source: ${BENCHMARKS_PREPARATION_INPUTS_PATH:-./inputs}
# target must be kept in sync with config.yml
target: /mnt/inputs
- type: bind
source: ${BENCHMARKS_PREPARATION_OUTPUTS_PATH:-./outputs}
# target must be kept in sync with config.yml
target: /mnt/outputs
Loading

0 comments on commit b83cfa7

Please sign in to comment.