Merge pull request #1361 from IFRCGo/feature/per-consideration #3809
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: | |
pull_request: | |
push: | |
branches: | |
- 'develop' | |
env: | |
APP_ADMIN_URL: ${{ vars.APP_ADMIN_URL }} | |
APP_API_ENDPOINT: ${{ vars.APP_API_ENDPOINT }} | |
APP_ENVIRONMENT: ${{ vars.APP_ENVIRONMENT }} | |
APP_MAPBOX_ACCESS_TOKEN: ${{ vars.APP_MAPBOX_ACCESS_TOKEN }} | |
APP_RISK_ADMIN_URL: ${{ vars.APP_RISK_ADMIN_URL }} | |
APP_RISK_API_ENDPOINT: ${{ vars.APP_RISK_API_ENDPOINT }} | |
APP_SENTRY_DSN: ${{ vars.APP_SENTRY_DSN }} | |
APP_SENTRY_NORMALIZE_DEPTH: ${{ vars.APP_SENTRY_NORMALIZE_DEPTH }} | |
APP_SENTRY_TRACES_SAMPLE_RATE: ${{ vars.APP_SENTRY_TRACES_SAMPLE_RATE }} | |
APP_SHOW_ENV_BANNER: ${{ vars.APP_SHOW_ENV_BANNER }} | |
APP_TINY_API_KEY: ${{ vars.APP_TINY_API_KEY }} | |
APP_TITLE: ${{ vars.APP_TITLE }} | |
GITHUB_WORKFLOW: true | |
jobs: | |
ui: | |
name: Build UI Library | |
environment: 'test' | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: packages/ui | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'yarn' | |
- name: Install dependencies on UI library | |
run: yarn install --frozen-lockfile | |
- name: Typecheck | |
run: yarn typecheck | |
- name: Lint CSS | |
run: yarn lint:css | |
- name: Lint JS | |
run: yarn lint:js | |
- name: build UI library | |
run: yarn build | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ui-build | |
path: packages/ui/dist | |
test: | |
name: Run tests | |
environment: 'test' | |
runs-on: ubuntu-latest | |
needs: [ui] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'yarn' | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ui-build | |
path: packages/ui/dist | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
working-directory: app | |
- name: Run test | |
run: yarn test | |
working-directory: app | |
translation: | |
name: Identify error with translation files | |
runs-on: ubuntu-latest | |
needs: [ui] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'yarn' | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ui-build | |
path: packages/ui/dist | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
working-directory: app | |
- name: Identify error with translation files | |
run: yarn lint:translation | |
working-directory: app | |
unimported: | |
name: Identify unused files | |
runs-on: ubuntu-latest | |
needs: [ui] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'yarn' | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ui-build | |
path: packages/ui/dist | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
working-directory: app | |
- name: Identify unused files | |
run: yarn lint:unused | |
working-directory: app | |
lint: | |
name: Lint JS | |
runs-on: ubuntu-latest | |
needs: [ui] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'yarn' | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ui-build | |
path: packages/ui/dist | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
working-directory: app | |
- name: Lint JS | |
run: yarn lint:js | |
working-directory: app | |
lint-css: | |
name: Lint CSS | |
runs-on: ubuntu-latest | |
needs: [ui] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'yarn' | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ui-build | |
path: packages/ui/dist | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
working-directory: app | |
- name: Lint CSS | |
run: yarn lint:css | |
working-directory: app | |
# FIXME: Identify a way to generate schema before we run typecheck | |
# typecheck: | |
# name: Typecheck | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - uses: actions/setup-node@v4 | |
# with: | |
# node-version: 20 | |
# cache: 'yarn' | |
# - name: Install dependencies | |
# run: yarn install --frozen-lockfile | |
# - name: Typecheck | |
# run: yarn typecheck | |
build: | |
name: Build GO Web App | |
environment: 'test' | |
needs: [lint, lint-css, test, ui] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'yarn' | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ui-build | |
path: packages/ui/dist | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
working-directory: app | |
- name: Build | |
run: yarn build | |
working-directory: app |