Skip to content

Web App CI

Web App CI #7

Workflow file for this run

name: Web App CI
on:
pull_request:
push:
branches:
- master
- mono-repo*
defaults:
run:
shell: bash
jobs:
check-lint:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: webapp
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: ci/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
id: setup_node
with:
node-version-file: ".nvmrc"
cache: npm
cache-dependency-path: 'webapp/package-lock.json'
# - uses: actions/cache@2b8105bdae4b746666ee225970c4a281bbd9d51f # v3.2.4
# id: npm-cache
# with:
# path: |
# '**/node_modules'
# 'e2e/playwright/node_modules'
# 'e2e/cypress/node_modules'
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('e2e/cypress/package-lock.json') }}-${{ hashFiles('e2e/playwright/package-lock.json') }}
- name: ci/get-node-modules
# if: steps.npm-cache.outputs.cache-hit != 'true'
run: |
make node_modules
# make channels/e2e/playwright/node_modules
- name: ci/lint
working-directory: webapp/channels
run: |
npm run check
check-i18n:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: webapp
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: ci/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
id: setup_node
with:
node-version-file: ".nvmrc"
cache: npm
cache-dependency-path: 'webapp/package-lock.json'
# - uses: actions/cache@2b8105bdae4b746666ee225970c4a281bbd9d51f # v3.2.4
# id: npm-cache
# with:
# path: |
# '**/node_modules'
# 'e2e/playwright/node_modules'
# 'e2e/cypress/node_modules'
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('e2e/cypress/package-lock.json') }}-${{ hashFiles('e2e/playwright/package-lock.json') }}
- name: ci/get-node-modules
# if: steps.npm-cache.outputs.cache-hit != 'true'
run: |
make node_modules
# make channels/e2e/playwright/node_modules
- name: ci/lint
working-directory: webapp/channels
run: |
cp src/i18n/en.json /tmp/en.json
mkdir -p /tmp/fake-mobile-dir/assets/base/i18n/
echo '{}' > /tmp/fake-mobile-dir/assets/base/i18n/en.json
npm run mmjstool -- i18n extract-webapp --webapp-dir ./src --mobile-dir /tmp/fake-mobile-dir
diff /tmp/en.json src/i18n/en.json
# Address weblate behavior which does not remove whole translation item when translation string is set to empty
npm run mmjstool -- i18n clean-empty --webapp-dir ./src --mobile-dir /tmp/fake-mobile-dir --check
npm run mmjstool -- i18n check-empty-src --webapp-dir ./src --mobile-dir /tmp/fake-mobile-dir
rm -rf tmp
check-type:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: webapp
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: ci/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
id: setup_node
with:
node-version-file: ".nvmrc"
cache: npm
cache-dependency-path: 'webapp/package-lock.json'
# - uses: actions/cache@2b8105bdae4b746666ee225970c4a281bbd9d51f # v3.2.4
# id: npm-cache
# with:
# path: |
# '**/node_modules'
# 'e2e/playwright/node_modules'
# 'e2e/cypress/node_modules'
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('e2e/cypress/package-lock.json') }}-${{ hashFiles('e2e/playwright/package-lock.json') }}
- name: ci/get-node-modules
# if: steps.npm-cache.outputs.cache-hit != 'true'
run: |
make node_modules
# make channels/e2e/playwright/node_modules
- name: ci/lint
working-directory: webapp/channels
run: |
npm run check-types
tests:
runs-on: ubuntu-22.04
needs: [check-type, check-i18n, check-lint]
permissions:
checks: write
pull-requests: write
defaults:
run:
working-directory: webapp
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: ci/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
id: setup_node
with:
node-version-file: ".nvmrc"
cache: npm
cache-dependency-path: 'webapp/package-lock.json'
# - uses: actions/cache@2b8105bdae4b746666ee225970c4a281bbd9d51f # v3.2.4
# id: npm-cache
# with:
# path: |
# '**/node_modules'
# 'e2e/playwright/node_modules'
# 'e2e/cypress/node_modules'
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('e2e/cypress/package-lock.json') }}-${{ hashFiles('e2e/playwright/package-lock.json') }}
- name: ci/get-node-modules
# if: steps.npm-cache.outputs.cache-hit != 'true'
run: |
make node_modules
# make channels/e2e/playwright/node_modules
- name: ci/detect-cpu-core
id: cpu-cores
uses: SimenB/github-actions-cpu-cores@c508d404ab007faae80a014072fd8c0e17792118 # v1.1.0
- name: ci/test
working-directory: webapp/channels
run: |
npm run test-ci -- --maxWorkers=${{ steps.cpu-cores.outputs.count }}
- name: ci/publish-test-results
uses: EnricoMi/publish-unit-test-result-action@a3caf02865c0604ad3dc1ecfcc5cdec9c41b7936 # v2.3.0
if: always()
with:
junit_files: "webapp/channels/build/**/*.xml"
comment_mode: always
compare_to_earlier_commit: false
build:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: webapp
steps:
- name: ci/checkout-repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: ci/setup-node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
id: setup_node
with:
node-version-file: ".nvmrc"
cache: npm
cache-dependency-path: 'webapp/package-lock.json'
# - uses: actions/cache@2b8105bdae4b746666ee225970c4a281bbd9d51f # v3.2.4
# id: npm-cache
# with:
# path: |
# '**/node_modules'
# 'e2e/playwright/node_modules'
# 'e2e/cypress/node_modules'
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('e2e/cypress/package-lock.json') }}-${{ hashFiles('e2e/playwright/package-lock.json') }}
- name: ci/get-node-modules
# if: steps.npm-cache.outputs.cache-hit != 'true'
run: |
make node_modules
# make channels/e2e/playwright/node_modules
- name: ci/build
working-directory: webapp/channels
run: |
npm run build
# run-performance-bechmarks:
# uses: ./.github/workflows/performance-benchmarks.yml
# needs: build