Skip to content

Retrieve real-time data from your long-range Nordic Semiconductor Development Kit within seconds

License

Notifications You must be signed in to change notification settings

hello-nrfcloud/web

hello.nrfcloud.com

GitHub Actions semantic-release Renovate @commitlint/config-conventional code style: prettier ESLint: TypeScript

Retrieve real-time data from your Nordic Semiconductor Development Kit within seconds.

Setup

Install the dependencies:

npm ci

Run

npm start

Running the tests

End-to-end tests are run completely without a backend using Vite's built-in dev server to serve the data.

Deploy an instance of the AWS Map resources and export the map settings as environment variables MAP_REGION, MAP_NAME, and MAP_API_KEY before running it.

Note: It's currently not possible to run test for multiple browsers in parallel since the webServer > cannot be defined per project, and there is a state in the backend mock server that gets manipulated by the tests. So by default only the chrome project is run

npm run test:e2e

Run the Playwright code generator

npx playwright codegen

Debug individual tests

PWDEBUG=1 npx playwright test e2e-tests/

Interact with the e2e backend

See ./e2e-tests/README.e2e-server.md

Deploy

npx cdk bootstrap
npx cdk deploy --all

Create map resources

Deploy https://github.com/hello-nrfcloud/aws-map and follow the instructions to acquire the necessary parameters to display the map.

Continuous Deployment with GitHub Actions

Create a GitHub environment production.

Store the registry endpoint as a GitHub Action variable:

gh variable set REGISTRY_ENDPOINT --env production --body "<registry endpoint>"
# If using a custom domain name
gh variable set DOMAIN_NAME --env production --body "<domain name>"

Store the role used for continuous deployment as a secret:

CD_ROLE_ARN=`aws cloudformation describe-stacks --stack-name ${STACK_NAME:-hello-nrfcloud-web} | jq -r '.Stacks[0].Outputs[] | select(.OutputKey == "gitHubCdRoleArn") | .OutputValue'`
gh secret set AWS_ROLE --env production --body "${CD_ROLE_ARN}"

Store the stack name and the region as a variable:

gh variable set STACK_NAME --env production --body "${STACK_NAME:-hello-nrfcloud-web}"
gh variable set AWS_REGION --env production --body "eu-west-1"

Continuous integration

Deploy an instance of the AWS Map resources to the CI AWS account and store the map settings as variables:

# Make sure that the `ci` environment exists in this repo
gh variable set MAP_REGION --env ci --body "<mapRegion>"
gh variable set MAP_NAME --env ci --body "<mapName>"
gh variable set MAP_API_KEY --env ci --body "<apiKey>"