I have a monorepo (turbo) and a nextjs app. I changed the yml file, which is generated from firebase, but after all the checks were done in the actions and followed the link I got the following message from firebase Page Not Found:
The firebase.json:
{
"firestore": {
"rules": "firebase/firestore/firestore.rules",
"indexes": "firebase/firestore/firestore.indexes.json"
},
"functions": {
"source": "firebase/functions"
},
"hosting": {
"public": "apps/onboarding/out",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},
"storage": {
"rules": "firebase/cloud-storage/storage.rules"
},
And here is the .yml file:
name: Build and deploy to Firebase Hosting on PR
on: pull_request
env:
NEXT_PUBLIC_FIREBASE_CONFIG: '${{ secrets.NEXT_PUBLIC_FIREBASE_CONFIG }}'
NEXT_PUBLIC_ENVIRONMENT: development
jobs:
install-deps:
runs-on: ubuntu-latest
steps:
## Checkout current branch
- uses: actions/checkout#v2
## Setup node
- name: Use Node.js 16.x
uses: actions/setup-node#v1
with:
node-version: 16.x
## Cache node modules
- name: Cache node modules
id: cache-npm
uses: actions/cache#v3
env:
cache-name: cache-node-modules
with:
path: node_modules
key: v1-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
v1-${{ runner.os }}-build-${{ env.cache-name }}-
v1-${{ runner.os }}-build-
v1-${{ runner.os }}-
## Install dependencies
- name: Install dependencies
run: |
npm ci
lint:
needs: install-deps
runs-on: ubuntu-latest
steps:
## Checkout current branch
- uses: actions/checkout#v2
## Setup node
- name: Use Node.js 16.x
uses: actions/setup-node#v1
with:
node-version: 16.x
## Cache node modules
- name: Cache node modules
id: cache-npm
uses: actions/cache#v3
env:
cache-name: cache-node-modules
with:
path: node_modules
key: v1-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
v1-${{ runner.os }}-build-${{ env.cache-name }}-
v1-${{ runner.os }}-build-
v1-${{ runner.os }}-
## Run lint
- name: Run lint
run: |
npm run lint
test:
needs: install-deps
runs-on: ubuntu-latest
steps:
## Checkout current branch
- uses: actions/checkout#v2
## Setup node
- name: Use Node.js 16.x
uses: actions/setup-node#v1
with:
node-version: 16.x
## Cache node modules
- name: Cache node modules
id: cache-npm
uses: actions/cache#v3
env:
cache-name: cache-node-modules
with:
path: node_modules
key: v1-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
v1-${{ runner.os }}-build-${{ env.cache-name }}-
v1-${{ runner.os }}-build-
v1-${{ runner.os }}-
## Run test
- name: Run test
run: |
npm run test
build:
needs: install-deps
runs-on: ubuntu-latest
steps:
## Checkout current branch
- uses: actions/checkout#v2
## Setup node
- name: Use Node.js 16.x
uses: actions/setup-node#v1
with:
node-version: 16.x
## Cache node modules
- name: Cache node modules
id: cache-npm
uses: actions/cache#v3
env:
cache-name: cache-node-modules
with:
path: node_modules
key: v1-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
v1-${{ runner.os }}-build-${{ env.cache-name }}-
v1-${{ runner.os }}-build-
v1-${{ runner.os }}-
## Build
- name: Build
run: |
npm run build
## Store artifacts for deployment in case of push in the main
- name: Archive onboarding/out artifacts
uses: actions/upload-artifact#v3
with:
name: preview-build-onboarding
path: apps/onboarding/out/**
- name: Archive function/lib artifacts
uses: actions/upload-artifact#v3
with:
name: preview-build-functions
path: firebase/functions/lib/**
deploy:
runs-on: ubuntu-latest
env:
CI_FIREBASE_MESSAGE: ${{ github.event.head_commit.message }} - ${{ github.event.head_commit.url }}/checks
needs: [build, install-deps, lint, test]
steps:
## Checkout current branch
- uses: actions/checkout#v2
## Setup node
- name: Use Node.js 16.x
uses: actions/setup-node#v1
with:
node-version: 16.x
## Cache node modules
- name: Cache node modules
id: cache-npm
uses: actions/cache#v3
env:
cache-name: cache-node-modules
with:
path: node_modules
key: v1-${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
v1-${{ runner.os }}-build-${{ env.cache-name }}-
v1-${{ runner.os }}-build-
v1-${{ runner.os }}-
- name: Download onboarding/out artifacts
uses: actions/download-artifact#v3
with:
name: preview-build-onboarding
path: apps/onboarding/out/**
- name: Download function/lib artifacts
uses: actions/download-artifact#v3
with:
name: preview-build-functions
path: firebase/functions/lib/**
- name: Deploy Preview
uses: FirebaseExtended/action-hosting-deploy#v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_******** }}'
projectId: ********
I have absolutely no clue why it is failing at the moment, so any help would be appreciated!
Related
I am trying to create a CI/CD process using GitHub Actions. The process includes testing, building the docker image and uploading it to Google Cloud Run.
Everything works fine when running the project locally, because locally I have access to the .env file. But this file is not been pushed to github repository.
The issue happens when the firebase is initialized, because all the values are inside the .env file
The error showed in the workflow logs is below:
#15 1.258 info - Linting and checking validity of types...
#15 8.148 info - Creating an optimized production build...
#15 19.76 info - Compiled successfully
#15 19.76 info - Collecting page data...
#15 20.33 FirebaseError: Firebase: Error (auth/invalid-api-key).
#15 20.33 at createErrorInternal (file:///app/node_modules/#firebase/auth/dist/node-esm/index-3246d34e.js:467:40)
#15 20.33 at _assert (file:///app/node_modules/#firebase/auth/dist/node-esm/index-3246d34e.js:471:15)
#15 20.33 at file:///app/node_modules/#firebase/auth/dist/node-esm/index-3246d34e.js:6075:13
#15 20.33 at Component.instanceFactory (file:///app/node_modules/#firebase/auth/dist/node-esm/index-3246d34e.js:6092:11)
#15 20.33 at Provider.getOrInitializeService (file:///app/node_modules/#firebase/component/dist/esm/index.esm2017.js:290:39)
#15 20.33 at Provider.initialize (file:///app/node_modules/#firebase/component/dist/esm/index.esm2017.js:234:31)
#15 20.33 at initializeAuth (file:///app/node_modules/#firebase/auth/dist/node-esm/index-3246d34e.js:585:27)
#15 20.33 at getAuth (file:///app/node_modules/#firebase/auth/dist/node-esm/index-3246d34e.js:6141:18)
#15 20.33 at /app/.next/server/chunks/933.js:121:68 ***
#15 20.33 code: 'auth/invalid-api-key',
#15 20.33 customData: *** appName: '[DEFAULT]' ***
#15 20.33 ***
I inserted the environment variable in the files:
GitHub: Settings -> Security -> Secrets -> Actions
Cloud Run: Environment variables
next.config
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
output: 'standalone',
env: {
NEXT_PUBLIC_FIREBASE_API_KEY: process.env.NEXT_PUBLIC_FIREBASE_API_KEY,
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN,
NEXT_PUBLIC_FIREBASE_PROJECT_ID: process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID
}
}
module.exports = nextConfig
Below is the workflow. I placed the environment variables for the building process and the push to cloud run process.
name: CI and CD
on:
workflow_dispatch:
push:
branches: [main, develop]
env:
REGISTRY: gcr.io
IMAGE_NAME: ${{ secrets.GCP_PROJECT_NAME }}/${{ secrets.CLOUD_RUN_SERVICE }}
REGION: us-central1
jobs:
test-code:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout#v3
- name: Use Node.js 16.x
uses: actions/setup-node#v3
with:
node-version: 16.x
- run: npm ci
- run: npm run test
build-image:
needs: test-code
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-20.04
outputs:
tags: ${{ steps.meta.outputs.tags }}
concurrency: build-image-process
steps:
- name: Checkout repository
uses: actions/checkout#v3
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action#79abd3f86f79a9d68a23c75a09a9a85889262adf
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action#28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: _json_key
password: ${{ secrets.GCP_SERVICE_ACCOUNT }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action#98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action#ac9327eae2b366085ac7f6a2d02df8aa8ead720a
if: ${{ github.event_name != 'pull_request' }}
with:
context: .
file: ./Dockerfile.prod
secrets: |
"NEXT_PUBLIC_FIREBASE_API_KEY=${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}"
"NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}"
"NEXT_PUBLIC_FIREBASE_PROJECT_ID=${{ secrets.NEXT_PUBLIC_FIREBASE_PROJECT_ID }}"
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Outputs tags
run: echo "${{ steps.meta.outputs.tags }}"
deploy-image:
needs: build-image
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout#v3
- id: 'auth'
uses: 'google-github-actions/auth#v0'
with:
credentials_json: '${{ secrets.GCP_SERVICE_ACCOUNT }}'
- name: Build Image Outputs Tags
run: echo "${{ needs.build-image.outputs.tags }}"
- name: 'Deploy to Cloud Run'
uses: 'google-github-actions/deploy-cloudrun#v0'
with:
service: ${{ secrets.CLOUD_RUN_SERVICE }}
image: "${{ needs.build-image.outputs.tags }}"
region: ${{ env.REGION }}
env_vars:
NEXT_PUBLIC_FIREBASE_API_KEY=${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}
NEXT_PUBLIC_FIREBASE_PROJECT_ID=${{ secrets.NEXT_PUBLIC_FIREBASE_PROJECT_ID }}
I appreciate any help to make the whole process to work smoothly.
I have setup a Jupyterhub running on K8s
It authenticates and launches private user notebook-servers (pods) in the K8s
But these pods are private to K8s networking, and I want to connect to it from Local VSCode via its Remote Kernel Connection
I tried to find resources, but there isn't much available that matches my setup, can anyone help me redirect to the setup. Also attaching the jupyterhub-config.yaml I am using currently to create single user pods as a notebook-server.
singleuser:
extraContainers:
- name: "somename"
image: "{{ jupyter_notebook_image_name }}:{{ jupyter_notebook_tag }}"
command: ["/usr/local/bin/main.sh"]
securityContext:
runAsUser: 0
lifecycle:
postStart:
exec:
command: ["/bin/sh", "-c", "cp copy.json copy.json"]
env:
- name: JUPYTERHUB_USER
value: '{unescaped_username}'
volumeMounts:
- name: projects
mountPath: /.sols/
- name: home-projects-dir
mountPath: /home/jovyan/projects/
- name: kernels-path
mountPath: /usr/local/share/jupyter/kernels/
lifecycleHooks:
postStart:
exec:
command: ["/bin/sh", "-c", "cp copy.json copy.json"]
uid: 0
storage:
capacity: 1Gi
homeMountPath: /home/jovyan/{username}
extraVolumes:
- name: projects
persistentVolumeClaim:
claimName: projects--hub-pvc
- name: home-projects-dir
- name: kernels-path
extraVolumeMounts:
- name: projects
mountPath: /.sols/
- name: home-projects-dir
mountPath: /home/jovyan/projects/
- name: kernels-path
mountPath: /usr/local/share/jupyter/kernels/
dynamic:
storageClassName: jupyter
pvcNameTemplate: '{username}--hub-pvc'
volumeNameTemplate: '{username}--hub-pv'
storageAccessModes: [ReadWriteMany]
image:
name: {{ jupyter_notebook_image_name }}
tag: {{ jupyter_notebook_tag }}
pullSecrets:
xxxkey
Was trying to configure ci/cd with nextjs, deploy_development jobs is failing & throwing error like Error: The deployment https://rubrica-qlicv5ca9-manikangkandas.vercel.app is not ready. Error: The process '/opt/hostedtoolcache/node/14.20.0/x64/bin/npx' failed with exit code 1
This is just an initial boilerplate from nextjs, no code has been added so far except for workflow and vercel.json. Any kind of help would be greatly appreciated.
deploy.yml
name: Deploy to Vercel
on:
workflow_dispatch:
inputs:
deploy_production:
description: "Deploy Production"
required: true
type: boolean
# default: false
push:
branches:
tags:
pull_request:
jobs:
# --- check lint ---------------
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v2
- uses: actions/setup-node#v3
with:
node-version: 14
- name: Installing depedencies
run: yarn install
- name: Running test lint
run: yarn lint
# --- build ---------------
build:
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout#v2
- uses: actions/setup-node#v3
with:
node-version: 14
- name: Installing depedencies
run: yarn install
- name: Try to build
run: yarn build
# --- deploy development ---------------
deploy_development:
if: |
github.event_name != 'pull_request' &&
(
github.ref_name == 'main' ||
startsWith(github.ref, 'refs/tags/')
)
runs-on: ubuntu-latest
needs: [lint, build]
steps:
- uses: actions/checkout#v2
- uses: actions/setup-node#v3
with:
node-version: 14
- name: Installing depedencies
run: yarn install
- name: Try to build
run: yarn build
- name: Deploy to vercel
uses: amondnet/vercel-action#v20
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
alias-domains: github-action-next-dev.vercel.app
# --- deploy production ---------------
deploy_production:
if: |
startsWith(github.ref, 'refs/tags/') &&
github.event.inputs.deploy_production == 'true'
runs-on: ubuntu-latest
needs: [lint, build, deploy_development]
steps:
- uses: actions/checkout#v2
- uses: actions/setup-node#v3
with:
node-version: 14
- name: Installing depedencies
run: yarn install
- name: Try to build
run: yarn build
- name: Deploy to vercel
uses: amondnet/vercel-action#v20
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-args: "--prod"
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
package.json
{
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"next": "12.2.5",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"eslint": "8.23.0",
"eslint-config-next": "12.2.5"
}
}
error recieved
Run amondnet/vercel-action#v20
set environment for vercel cli
set env variable : VERCEL_ORG_ID
set env variable : VERCEL_PROJECT_ID
using scope
/opt/hostedtoolcache/node/14.20.0/x64/bin/npx vercel -t *** -m githubCommitSha=33299fce99919dac35bcacc0055e01d07b418e72 -m githubCommitAuthorName=manikangkandas -m githubCommitAuthorLogin=manikangkandas -m githubDeployment=1 -m githubOrg=manikangkandas -m githubRepo=rubrica -m githubCommitOrg=manikangkandas -m githubCommitRepo=rubrica -m githubCommitMessage="fix: deploy development scope add" -m githubCommitRef=main --scope ***
Vercel CLI 28.2.2
..............
..............
..............
set preview-name output
alias domains to this deployment
using scope
/opt/hostedtoolcache/node/14.20.0/x64/bin/npx vercel -t *** --scope *** alias https://rubrica-qlicv5ca9-manikangkandas.vercel.app github-action-next-dev.vercel.app
Vercel CLI 28.2.2
> Assigning alias github-action-next-dev.vercel.app to deployment rubrica-qlicv5ca9-manikangkandas.vercel.app
Creating alias
Error: The deployment https://rubrica-qlicv5ca9-manikangkandas.vercel.app is not ready.
Error: The process '/opt/hostedtoolcache/node/14.20.0/x64/bin/npx' failed with exit code 1
I am trying to get Github Action to check my package. The packages compiles fine (not even a note) on my computer. I created a yaml script to go into the github workflow directory using usethis::use_github_action_check_standard() but it fails with a bunch of warnings like
No files were found with the provided path: check. No artifacts will
be uploaded.
The path check is a temporary directory created by rcmdcheck for storing files. So, I presume it is a problem connected with this command. But everything was created by the usethis utility and nobody else seems to have the same problem.
I looked around a lot and the last fix I tried was to manually add a step to install imported and suggested packages, as suggested in this post, to no avail.
What am I doing wrong? Thanks in advance.
the yaml script is
on:
push:
branches:
- master
pull_request:
branches:
- master
name: R-CMD-check
jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
strategy:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout#v2
- uses: r-lib/actions/setup-r#v1
with:
r-version: ${{ matrix.config.r }}
- uses: r-lib/actions/setup-pandoc#v1
- name: Install dependencies
run: |
install.packages(c("geigen","stringr", "leaps", "stats"),dependencies=TRUE)
install.packages(c("elasticnet","glmnet"),dependencies=TRUE)
shell: Rscript {0}
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache#v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
- name: Install system dependencies
if: runner.os == 'Linux'
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}
- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: |
options(crayon.enabled = TRUE)
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}
- name: Upload check results
if: failure()
uses: actions/upload-artifact#main
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
I solved the problem by moving everything to the main branch.
I would like to use Sys.getenv() to retrieve an environment variable.
Locally, I'm able to save a .Renviron file in my working directory that has the variables in it. These load perfectly fine and tests pass.
The repository is here for reference: https://github.com/Stoltzman-Consulting/githubActionsR
However, due to the fact there are secrets stored, I cannot upload this file into my repository. I have created secrets in the GitHub secrets section:
My tests are as follows:
test_that("multiplication works", {
expect_equal(2 * 2, 4)
})
test_that("Environment variable exists", {
expect_equal(Sys.getenv('MY_SECRET'), 'i_want_this')
})
test_that("Environment variable 2 exists", {
expect_equal(Sys.getenv('MY_SECRET2'), 'i_want_this_2')
})
My GitHub Actions file is as follows:
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
name: R-CMD-check
jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
strategy:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
MY_SECRET: ${{ secrets.MY_SECRET }}
MY_SECRET2: ${{ secrets.MY_SECRET2 }}
steps:
- uses: actions/checkout#v2
- uses: r-lib/actions/setup-r#v1
with:
r-version: ${{ matrix.config.r }}
- uses: r-lib/actions/setup-pandoc#v1
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache#v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
- name: Install system dependencies
if: runner.os == 'Linux'
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}
- name: Run Tests
env:
MY_SECRET2: ${{ secrets.MY_SECRET2 }}
run: |
Sys.setenv(MY_SECRET2 = "$MY_SECRET2")
testthat::test_file('my_test.R')
shell: Rscript {0}
- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}
- name: Upload check results
if: failure()
uses: actions/upload-artifact#main
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
You'll notice that I have even tried using Sys.setenv() but that doesn't work either (and is not a very scalable solution).
How can I get this to pass?
One solution that works, create ~/.Renviron within a block
- name: Create and populate .Renviron file
run: |
echo MY_SECRET="$MY_SECRET" >> ~/.Renviron
echo MY_SECRET2="$MY_SECRET2" >> ~/.Renviron
shell: bash
As long as this goes before your tests, this will work. It has been added to the github repo listed.