Skip to content

Pull Request for changes made to repository after redeployment to new AWS account #35

Pull Request for changes made to repository after redeployment to new AWS account

Pull Request for changes made to repository after redeployment to new AWS account #35

Workflow file for this run

name: Node CI
on:
push:
branches:
- main
- 1466-fix-item-login # allow test to run for a temporary deploy
pull_request:
merge_group:
# abort running jobs if newer version is detected on same branch
concurrency:
group: ${{ github.head_ref || github.ref }}
env:
CI: true
LOG_LEVEL: fatal # avoid unnecessary logging
# random keys
APPS_JWT_SECRET: ${{ vars.MOCK_APPS_JWT_SECRET }}
APPS_PUBLISHER_ID: 9c9cea73-f3b7-48a3-aa6e-ead82c0685e7 # mock uuid
AUTH_CLIENT_HOST: 'localhost:3001'
AUTH_TOKEN_JWT_SECRET: ${{ vars.MOCK_AUTH_TOKEN_JWT_SECRET }}
BUILDER_CLIENT_HOST: 'http://localhost:3111'
ACCOUNT_CLIENT_HOST: 'http://localhost:3114'
ANALYTICS_CLIENT_HOST: 'http://localhost:3005'
COOKIE_DOMAIN: localhost
DB_PASSWORD: docker
DB_USERNAME: docker
DB_NAME: docker
DB_HOST: localhost
EMBEDDED_LINK_ITEM_IFRAMELY_HREF_ORIGIN: 'http://localhost:1234'
ETHERPAD_API_KEY: '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef'
ETHERPAD_PUBLIC_URL: 'http://localhost:9001'
ETHERPAD_URL: 'http://etherpad:9001'
LIBRARY_CLIENT_HOST: 'http://localhost:3113'
FILE_STORAGE_ROOT_PATH: /
H5P_FILE_STORAGE_TYPE: file
H5P_PATH_PREFIX: h5p-content/
H5P_STORAGE_ROOT_PATH: /tmp/h5p
H5P_FILE_STORAGE_HOST: http://localhost:1081
JWT_SECRET: ${{ vars.MOCK_JWT_SECRET }}
PASSWORD_RESET_JWT_SECRET: ${{ vars.MOCK_PASSWORD_RESET_JWT_SECRET }}
EMAIL_CHANGE_JWT_SECRET: ${{ vars.MOCK_EMAIL_CHANGE_JWT_SECRET }}
MAILER_CONFIG_PASSWORD: password
MAILER_CONFIG_SMTP_HOST: localhost
MAILER_CONFIG_USERNAME: username
PLAYER_CLIENT_HOST: 'http://localhost:3112'
RECAPTCHA_SECRET_ACCESS_KEY: 'iamamockkey'
REDIS_HOST: localhost
REDIS_PORT: 6379
REFRESH_TOKEN_JWT_SECRET: ${{ vars.MOCK_REFRESH_TOKEN_JWT_SECRET }}
S3_FILE_ITEM_ACCESS_KEY_ID: graasp-user
S3_FILE_ITEM_BUCKET: graasp
S3_FILE_ITEM_PLUGIN: true
S3_FILE_ITEM_REGION: us-east-1
S3_FILE_ITEM_SECRET_ACCESS_KEY: graasp-pwd
SECURE_SESSION_SECRET_KEY: ${{ vars.MOCK_SECURE_SESSION_SECRET_KEY }}
STRIPE_SECRET_KEY: ${{ secrets.STRIPE_SECRET_KEY }}
MEILISEARCH_URL: fake
MEILISEARCH_MASTER_KEY: fake
JOB_SCHEDULING: false
GEOLOCATION_API_KEY: geolocation-key
GEOLOCATION_API_HOST: http://localhost:12345
jobs:
build-node:
runs-on: ubuntu-latest
# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
POSTGRES_USER: ${{ env.DB_USERNAME }}
POSTGRES_DB: ${{ env.DB_NAME }}
ports:
- 5432:5432 # exposing 5432 port for application to use
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Get yarn cache directory
id: yarn-cache-dir-path
run: |
echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: yarn install and build
run: |
yarn
yarn build
- name: yarn check
run: yarn check
- name: apply migrations on empty database
run: yarn migration:run
- name: check migrations are synced with the current codebase
run: yarn migration:check
test-node:
needs: build-node
strategy:
matrix:
shard: [1/4, 2/4, 3/4, 4/4]
runs-on: ubuntu-latest
# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
POSTGRES_USER: ${{ env.DB_USERNAME }}
POSTGRES_DB: ${{ env.DB_NAME }}
ports:
- 5432:5432 # exposing 5432 port for application to use
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
postgres-2:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
POSTGRES_USER: ${{ env.DB_USERNAME }}
POSTGRES_DB: ${{ env.DB_NAME }}
ports:
- 5433:5432 # exposing 5432 port for application to use
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
# Label used to access the service container
graasp-redis:
# Docker Hub image
image: redis
ports:
# Opens tcp port 6379 on the host and service container
- 6379:6379
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
- name: Get yarn cache directory
id: yarn-cache-dir-path
run: |
echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- uses: actions/cache@v4
with:
path: .jest-cache
key: ${{ runner.os }}-jest-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-jest-
- name: yarn install
run: |
yarn
- name: yarn test
run: yarn test:ci --shard=${{ matrix.shard }}