diff --git a/.github/workflows/caching.yml b/.github/workflows/caching.yml new file mode 100644 index 0000000..d2b35bd --- /dev/null +++ b/.github/workflows/caching.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/deploy-on-main-branch.yml b/.github/workflows/deploy-on-main-branch.yml index 01aa321..159fa90 100644 --- a/.github/workflows/deploy-on-main-branch.yml +++ b/.github/workflows/deploy-on-main-branch.yml @@ -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 \ No newline at end of file +# - 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 \ No newline at end of file diff --git a/.github/workflows/deploy-on-pullrequest.yml b/.github/workflows/deploy-on-pullrequest.yml index f4e3e90..9841367 100644 --- a/.github/workflows/deploy-on-pullrequest.yml +++ b/.github/workflows/deploy-on-pullrequest.yml @@ -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}}