Skip to content
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

Caching dependencies #73

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
59 changes: 59 additions & 0 deletions .github/workflows/caching.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#https://stackoverflow.com/questions/69365200/github-actions-how-to-cache-dependencies-between-workflow-runs-of-different-bra

name: update-cache
#When cached from an overhead branch,
#sub branches should refer to overhead branch when checking cache hit

on:
#push:
# branches: [main, master]
pull_request: {}

jobs:
cache:
name: Build Cache
runs-on: ubuntu-latest

steps:
#- name: Setup R
# uses: r-lib/actions/setup-r@v2

- name: Checkout Rep
uses: actions/checkout@v2

#Cache Dependencies to speed up workflow
- name: Cache dependencies
uses: actions/cache@v1
id: cache
with:
path: dependencies #${{ env.R_LIBS_USER }}
key: r-${{ hashFiles('DESCRIPTION') }}
# restore-keys:
# ${{ env.R_LIBS_USER }}

#If no cache hit, install dependencies
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
uses: r-lib/actions/setup-r-dependencies@v2

build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository so your job can access it
- uses: actions/checkout@v2

# build the docker image and give it the name main
- name: Build image
run: docker build -t main .
# run the docker image supply the secrets from the github secrets store.
- name: execute
run: >
docker run
-e SHINY_ACC_NAME=${{ secrets.SHINY_ACC_NAME }}
-e TOKEN=${{secrets.SHINY_APP_TOKEN}}
-e SECRET=${{secrets.SHINY_APP_SECRET}}
-e MASTERNAME=${{ secrets.MASTER_NAME }}
main
38 changes: 19 additions & 19 deletions .github/workflows/deploy-on-main-branch.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
name: Run on push to main
#name: Run on push to main

# Controls when the action will run.
on:
#on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main, master ]
# push:
# branches: [ main, master ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
#jobs:
# This workflow contains a single job called "build"
build:
# build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# steps:
# Checks-out your repository so your job can access it
- uses: actions/checkout@v2
# - uses: actions/checkout@v2

# build the docker image and give it the name main
- name: Build image
run: docker build -t main .
# - name: Build image
# run: docker build -t main .
# run the docker image supply the secrets from the github secrets store.
- name: execute
run: >
docker run
-e SHINY_ACC_NAME=${{ secrets.SHINY_ACC_NAME }}
-e TOKEN=${{secrets.SHINY_APP_TOKEN}}
-e SECRET=${{secrets.SHINY_APP_SECRET}}
-e MASTERNAME=${{ secrets.MASTER_NAME }}
main
# - name: execute
# run: >
# docker run
# -e SHINY_ACC_NAME=${{ secrets.SHINY_ACC_NAME }}
# -e TOKEN=${{secrets.SHINY_APP_TOKEN}}
# -e SECRET=${{secrets.SHINY_APP_SECRET}}
# -e MASTERNAME=${{ secrets.MASTER_NAME }}
# main
43 changes: 25 additions & 18 deletions .github/workflows/deploy-on-pullrequest.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,42 @@
name: Pull requests

# Controls when the action will run.
on:
#on:
# Triggers the workflow pull request events
pull_request: {}
# pull_request: {}
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
#jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
# build:
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v3
#- uses: r-lib/actions/setup-r@v2

#-name: Cache R Packages
#id: cache-r
#-uses: r-lib/action/setup-r@v2
#-uses: r-lib/actions/setup-r-dependencies@v2
#with:
# path: /tmp/cache
# key: ${{ runner.os }}-${{ hashFiles('**/DESCRIPTION')) }}

# build the docker image and give it the name main
- name: Cache R Packages
#id: cache-r
#-uses: r-lib/action/setup-r@v2
#-uses: r-lib/actions/setup-r-dependencies@v2
uses: actions/cache@v1
with:
path: ${{ env.R_LIBS_USER }}
key: r-${{ hashFiles('DESCRIPTION') }}

#- name: Restore cache
# with:
# path: ~/dependencies
# key:
#

# build the docker image and give it the name main
- name: Build image
run: docker build -t pullrequestimage .
# run the docker image supply the secrets from the github secrets store.
- name: execute
run: >
# run the docker image supply the secrets from the github secrets store.
# - name: execute
# run: >
docker run
-e SHINY_ACC_NAME=${{ secrets.SHINY_ACC_NAME }}
-e TOKEN=${{secrets.SHINY_APP_TOKEN}}
Expand Down