mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
96 lines
3.0 KiB
YAML
96 lines
3.0 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
|
|
outputs:
|
|
test-success: ${{ steps.test.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@v3
|
|
|
|
- name: Install turbo
|
|
run: yarn global add turbo@^2
|
|
|
|
- name: Prune frontend with turbos help
|
|
run: turbo prune frontend
|
|
|
|
- name: install dependencies
|
|
run: cd out && yarn install --frozen-lockfile --production=false
|
|
|
|
- name: Frontend | Unit tests
|
|
id: test
|
|
run: |
|
|
cd out && turbo frontend#test frontend#lint
|
|
echo "success=$([ $? -eq 0 ] && echo true || echo false)" >> $GITHUB_OUTPUT
|
|
|
|
lint:
|
|
if: needs.files-changed.outputs.frontend == 'true'
|
|
name: Lint - Frontend
|
|
needs: [files-changed, unit_test]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check result from previous step
|
|
run: if [ "${{ needs.unit_test.outputs.test-success }}" != "true" ]; then exit 1; fi
|
|
|
|
stylelint:
|
|
if: needs.files-changed.outputs.frontend == 'true'
|
|
name: Stylelint - Frontend
|
|
needs: [files-changed, unit_test]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check result from previous step
|
|
run: if [ "${{ needs.unit_test.outputs.test-success }}" != "true" ]; then exit 1; fi
|
|
|
|
locales:
|
|
if: needs.files-changed.outputs.frontend == 'true'
|
|
name: Locales - Frontend
|
|
needs: [files-changed, unit_test]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check result from previous step
|
|
run: if [ "${{ needs.unit_test.outputs.test-success }}" != "true" ]; then exit 1; fi
|