mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
116 lines
3.4 KiB
YAML
116 lines
3.4 KiB
YAML
name: Gradido Frontend Test CI
|
|
|
|
on: push
|
|
|
|
jobs:
|
|
# only (but most important) job from this workflow required for pull requests
|
|
# check results serve as run conditions for all other jobs here
|
|
files-changed:
|
|
name: Detect File Changes - Frontend
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
config: ${{ steps.changes.outputs.config }}
|
|
frontend: ${{ steps.changes.outputs.frontend }}
|
|
steps:
|
|
- uses: actions/checkout@v3.3.0
|
|
|
|
- name: Check for frontend file changes
|
|
uses: dorny/paths-filter@v2.11.1
|
|
id: changes
|
|
with:
|
|
token: ${{ github.token }}
|
|
filters: .github/file-filters.yml
|
|
list-files: shell
|
|
|
|
|
|
build_test:
|
|
if: needs.files-changed.outputs.config == 'true' || needs.files-changed.outputs.frontend == 'true'
|
|
name: Docker Build Test - Frontend
|
|
needs: files-changed
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Frontend | Build 'test' image
|
|
run: docker build -f ./frontend/Dockerfile --target production -t "gradido/frontend:production" --build-arg NODE_ENV="production" --build-arg BUILD_COMMIT=$(git rev-parse HEAD) --build-arg BUILD_COMMIT_SHORT=$(git rev-parse --short HEAD) .
|
|
|
|
unit_test:
|
|
if: needs.files-changed.outputs.config == 'true' || needs.files-changed.outputs.frontend == 'true'
|
|
name: Unit Tests - Frontend
|
|
needs: files-changed
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Set Node.js version
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '18.20.7'
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: install bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version-file: '.bun-version'
|
|
|
|
- name: install dependencies
|
|
run: bun install --filter frontend --frozen-lockfile
|
|
|
|
- name: Frontend | Unit tests
|
|
run: cd frontend && yarn test
|
|
|
|
lint:
|
|
if: needs.files-changed.outputs.config == 'true' || needs.files-changed.outputs.frontend == 'true'
|
|
name: Lint - Frontend
|
|
needs: files-changed
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
success: ${{ steps.lint.outputs.success }}
|
|
steps:
|
|
- name: Set Node.js version
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '18.20.7'
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: install bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version-file: '.bun-version'
|
|
|
|
- name: install dependencies
|
|
run: |
|
|
bun install --filter frontend --frozen-lockfile
|
|
bun install --global --no-save turbo@^2
|
|
|
|
- name: Frontend | Lint
|
|
id: lint
|
|
run: |
|
|
turbo frontend#lint
|
|
echo "success=$([ $? -eq 0 ] && echo true || echo false)" >> $GITHUB_OUTPUT
|
|
|
|
stylelint:
|
|
if: needs.files-changed.outputs.frontend == 'true'
|
|
name: Stylelint - Frontend
|
|
needs: [files-changed, lint]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check result from previous step
|
|
run: if [ "${{ needs.lint.outputs.success }}" != "true" ]; then exit 1; fi
|
|
|
|
locales:
|
|
if: needs.files-changed.outputs.frontend == 'true'
|
|
name: Locales - Frontend
|
|
needs: files-changed
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Frontend | Locales
|
|
run: cd frontend && yarn locales
|