Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

feat: move to vitejs #157

Merged
merged 9 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions .github/workflows/cdelivery-s3-caller.yml

This file was deleted.

36 changes: 0 additions & 36 deletions .github/workflows/cdeployment-s3-caller.yml

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/cintegration-s3-caller.yml

This file was deleted.

69 changes: 53 additions & 16 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,58 @@ on:
push:
branches-ignore:
- main
- master

# This workflow is made up of one job that calls the reusable workflow in graasp-deploy
concurrency:
group: cypress-${{ github.ref }}
cancel-in-progress: false

jobs:
graasp-deploy-cypress-workflow:
# Replace with repository name
name: Cypress caller template
# Replace 'main' with the hash of a commit, so it points to an specific version of the reusable workflow that is used
# Reference reusable workflow file. Using the commit SHA is the safest for stability and security
uses: graasp/graasp-deploy/.github/workflows/cypress.yml@v1
with:
# Test values
tsc: true
node-env-test: test
hidden-item-tag-id-test: 12345678-1234-1234-1234-123456789012
# Insert required secrets based on repository with the following format: ${{ secrets.SECRET_NAME }}
secrets:
api-host-test: ${{ secrets.REACT_APP_API_HOST }}
cypress:
name: Cypress
environment: ci
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Yarn Install and Cache
uses: graasp/graasp-deploy/.github/actions/yarn-install-and-cache@v1
with:
cypress: true

# type check
- name: Type-check code
run: tsc --noEmit

# use the Cypress GitHub Action to run Cypress tests within the chrome browser
- name: Cypress run
uses: cypress-io/github-action@v5
with:
install: false
start: yarn dev
browser: chrome
quiet: true
config-file: cypress.config.ts
cache-key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
env:
VITE_PORT: ${{ vars.VITE_PORT }}
VITE_VERSION: ${{ vars.VITE_VERSION }}
VITE_GRAASP_DOMAIN: ${{ vars.VITE_GRAASP_DOMAIN }}
VITE_GRAASP_API_HOST: ${{ vars.VITE_GRAASP_API_HOST }}
VITE_GRAASP_AUTH_HOST: ${{ vars.VITE_GRAASP_AUTH_HOST }}
VITE_GRAASP_BUILDER_HOST: ${{ vars.VITE_GRAASP_BUILDER_HOST }}
VITE_SHOW_NOTIFICATIONS: ${{ vars.VITE_SHOW_NOTIFICATIONS }}
VITE_RECAPTCHA_SITE_KEY: ${{ secrets.VITE_RECAPTCHA_SITE_KEY }}

# after the test run completes
# store any screenshots
# NOTE: screenshots will be generated only if E2E test failed
# thus we store screenshots only on failures
- uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots

- name: coverage report
run: npx nyc report --reporter=text-summary
51 changes: 51 additions & 0 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy to development environment

# Control when the action will run
on:
# Triggers the workflow on push events only for the main branch
push:
branches:
- main

# Allows to run the workflow manually from the Actions tab
workflow_dispatch:

jobs:
deploy-app:
name: Deploy to dev
runs-on: ubuntu-latest
environment: development
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Yarn install and Cache dependencies
uses: graasp/graasp-deploy/.github/actions/yarn-install-and-cache@v1

- name: Yarn build
# Set environment variables required to perform the build. These are only available to this step
env:
VITE_PORT: ${{ vars.VITE_PORT }}
VITE_VERSION: ${{ github.sha }}
VITE_GRAASP_DOMAIN: ${{ vars.VITE_GRAASP_DOMAIN }}
VITE_GRAASP_API_HOST: ${{ vars.VITE_GRAASP_API_HOST }}
VITE_GRAASP_AUTH_HOST: ${{ vars.VITE_GRAASP_AUTH_HOST }}
VITE_GRAASP_BUILDER_HOST: ${{ vars.VITE_GRAASP_BUILDER_HOST }}
VITE_RECAPTCHA_SITE_KEY: ${{ secrets.VITE_RECAPTCHA_SITE_KEY }}
VITE_SENTRY_ENV: ${{ vars.VITE_SENTRY_ENV }}
VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN }}
VITE_GA_MEASUREMENT_ID: ${{ secrets.VITE_GA_MEASUREMENT_ID }}
VITE_SHOW_NOTIFICATIONS: ${{ vars.VITE_SHOW_NOTIFICATIONS }}
run: yarn build
shell: bash

- name: Deploy
uses: graasp/graasp-deploy/.github/actions/deploy-s3@v1
# Replace input build-folder or version if needed
with:
build-folder: 'build'
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_DEV }}
aws-region: ${{ secrets.AWS_REGION_DEV }}
aws-s3-bucket-name: ${{ secrets.AWS_S3_BUCKET_NAME_GRAASP_AUTH_DEV }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }}
cloudfront-distribution-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_GRAASP_AUTH_DEV }}
53 changes: 53 additions & 0 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Deploy to production environment

# Control when the action will run
on:
# Triggers the workflow on repository-dispatch event
repository_dispatch:
types: [production-deployment]

jobs:
deploy-app:
name: Deploy to production
runs-on: ubuntu-latest
environment: production

concurrency:
group: deploy-production
cancel-in-progress: true

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.client_payload.tag }}

- name: Yarn install and Cache dependencies
uses: graasp/graasp-deploy/.github/actions/yarn-install-and-cache@v1

- name: Yarn build
# Set environment variables required to perform the build. These are only available to this step
env:
VITE_VERSION: ${{ github.event.client_payload.tag }}
VITE_GRAASP_DOMAIN: ${{ vars.VITE_GRAASP_DOMAIN }}
VITE_GRAASP_API_HOST: ${{ vars.VITE_GRAASP_API_HOST }}
VITE_GRAASP_AUTH_HOST: ${{ vars.VITE_GRAASP_AUTH_HOST }}
VITE_GRAASP_BUILDER_HOST: ${{ vars.VITE_GRAASP_BUILDER_HOST }}
VITE_RECAPTCHA_SITE_KEY: ${{ secrets.VITE_RECAPTCHA_SITE_KEY }}
VITE_SENTRY_ENV: ${{ vars.VITE_SENTRY_ENV }}
VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN }}
VITE_GA_MEASUREMENT_ID: ${{ secrets.VITE_GA_MEASUREMENT_ID }}
VITE_SHOW_NOTIFICATIONS: ${{ vars.VITE_SHOW_NOTIFICATIONS }}
run: yarn build
shell: bash

- name: Deploy
uses: graasp/graasp-deploy/.github/actions/deploy-s3@v1
# Replace input build-folder or version if needed
with:
build-folder: 'build'
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_PROD }}
aws-region: ${{ secrets.AWS_REGION_PROD }}
aws-s3-bucket-name: ${{ secrets.AWS_S3_BUCKET_NAME_GRAASP_AUTH_PROD }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PROD }}
cloudfront-distribution-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_GRAASP_AUTH_PROD }}
53 changes: 53 additions & 0 deletions .github/workflows/deploy-stage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Deploy to staging environment

# Control when the action will run
on:
# Triggers the workflow on repository-dispatch event
repository_dispatch:
types: [staging-deployment]

jobs:
deploy-app:
name: Deploy to stage
runs-on: ubuntu-latest
environment: staging

concurrency:
group: deploy-staging
cancel-in-progress: true

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.client_payload.tag }}

- name: Yarn install and Cache dependencies
uses: graasp/graasp-deploy/.github/actions/yarn-install-and-cache@v1

- name: Yarn build
# Set environment variables required to perform the build. These are only available to this step
env:
VITE_VERSION: ${{ github.event.client_payload.tag }}
VITE_GRAASP_DOMAIN: ${{ vars.VITE_GRAASP_DOMAIN }}
VITE_GRAASP_API_HOST: ${{ vars.VITE_GRAASP_API_HOST }}
VITE_GRAASP_AUTH_HOST: ${{ vars.VITE_GRAASP_AUTH_HOST }}
VITE_GRAASP_BUILDER_HOST: ${{ vars.VITE_GRAASP_BUILDER_HOST }}
VITE_RECAPTCHA_SITE_KEY: ${{ secrets.VITE_RECAPTCHA_SITE_KEY }}
VITE_SENTRY_ENV: ${{ vars.VITE_SENTRY_ENV }}
VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN }}
# VITE_GA_MEASUREMENT_ID: ${{ secrets.VITE_GA_MEASUREMENT_ID }}
VITE_SHOW_NOTIFICATIONS: ${{ vars.VITE_SHOW_NOTIFICATIONS }}
run: yarn build
shell: bash

- name: Deploy
uses: graasp/graasp-deploy/.github/actions/deploy-s3@v1
# Replace input build-folder or version if needed
with:
build-folder: 'build'
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGE }}
aws-region: ${{ secrets.AWS_REGION_STAGE }}
aws-s3-bucket-name: ${{ secrets.AWS_S3_BUCKET_NAME_GRAASP_AUTH_STAGE }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGE }}
cloudfront-distribution-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_GRAASP_AUTH_STAGE }}
36 changes: 0 additions & 36 deletions .github/workflows/update-staging-version.yml

This file was deleted.

16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# graasp-auth

Create an `.env.local` file with:
Create an `.env.development` file with:

```sh
REACT_APP_API_HOST=http://localhost:3000
PORT=3001
REACT_APP_DOMAIN=localhost:3001
REACT_APP_SHOW_NOTIFICATIONS=true
REACT_APP_AUTHENTICATION_HOST=http://localhost:3001
VITE_PORT=3001
VITE_API_HOST=http://localhost:3000
VITE_VERSION=latest
VITE_APP_DOMAIN=localhost:3001
VITE_GRAASP_BUILDER_HOST=http://localhost:3111
VITE_SHOW_NOTIFICATIONS=true
VITE_GRAASP_AUT_HOST=http://localhost:3001

REACT_APP_RECAPTCHA_SITE_KEY=
VITE_RECAPTCHA_SITE_KEY=
```

Generate your recaptcha key from [the reCAPTCHA admin console](https://www.google.com/recaptcha/admin/create)
Loading