Merge pull request #2198 from NDLANO/chore/bump-ndla-packages #12613
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push, pull_request] | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.CI_AWS_CLIENT_ID }} | |
AWS_DEFAULT_REGION: "eu-west-1" | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_AWS_CLIENT_SECRET }} | |
NDLA_AWS_ECR_REPO: ${{ secrets.NDLA_AWS_ECR_REPO }} | |
CI_RELEASE_ROLE: ${{ secrets.CI_RELEASE_ROLE }} | |
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} | |
NDLA_RELEASES: ${{ secrets.NDLA_RELEASES }} | |
GH_TOKEN: ${{ secrets.CI_NOW_GH_TOKEN }} | |
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
GH_PR_NUMBER: ${{ github.event.number }} | |
GH_PR_REPO: ${{ github.event.pull_request.head.repo.full_name }} | |
GH_PR_SHA: ${{ github.event.pull_request.head.sha }} | |
NODE_OPTIONS: "--max-old-space-size=4096" | |
jobs: | |
unit_tests: | |
name: "Unit tests" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "20.13.1" | |
- name: "Login to ECR repo" | |
run: RES=$(aws sts assume-role --role-arn $CI_RELEASE_ROLE --role-session-name github-actions-ecr-login) | |
AWS_ACCESS_KEY_ID=$(echo $RES | jq -r .Credentials.AccessKeyId) | |
AWS_SECRET_ACCESS_KEY=$(echo $RES | jq -r .Credentials.SecretAccessKey) | |
AWS_SESSION_TOKEN=$(echo $RES | jq -r .Credentials.SessionToken) | |
aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin $NDLA_AWS_ECR_REPO | |
- name: "Login to dockerhub" | |
run: echo $DOCKER_HUB_PASSWORD | docker login --username $DOCKER_HUB_USERNAME --password-stdin | |
- name: "Enable yarn v4" | |
run: | | |
corepack enable | |
yarn set version berry | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
**/node_modules | |
.eslintcache | |
.yarn/cache | |
~/.npm | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | |
- name: "Install" | |
run: yarn install --immutable | |
- name: "Check-all" | |
run: yarn check-all | |
integration_tests: | |
name: "Integration tests" | |
runs-on: ubuntu-latest | |
env: | |
DEFAULT_TIMEOUT: 5000 | |
NDLA_PERSONAL_CLIENT_ID: ${{ secrets.NDLA_PERSONAL_CLIENT_ID }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "20.13.1" | |
- name: "Enable yarn v4" | |
run: | | |
corepack enable | |
yarn set version 4.1.1 | |
- name: "Login to ECR repo" | |
run: RES=$(aws sts assume-role --role-arn $CI_RELEASE_ROLE --role-session-name github-actions-ecr-login) | |
AWS_ACCESS_KEY_ID=$(echo $RES | jq -r .Credentials.AccessKeyId) | |
AWS_SECRET_ACCESS_KEY=$(echo $RES | jq -r .Credentials.SecretAccessKey) | |
AWS_SESSION_TOKEN=$(echo $RES | jq -r .Credentials.SessionToken) | |
aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin $NDLA_AWS_ECR_REPO | |
- name: "Login to dockerhub" | |
run: echo $DOCKER_HUB_PASSWORD | docker login --username $DOCKER_HUB_USERNAME --password-stdin | |
- name: "Install" | |
run: yarn install --immutable | |
- name: "Build" | |
run: yarn build | |
- name: "Deploy vercel build" | |
run: yarn ndla-scripts vercel-github | |
continue-on-error: true | |
- name: Install Playwright Browsers | |
run: yarn playwright install --with-deps chromium | |
- name: "E2E" | |
run: yarn e2e:headless |