Skip to content

♻️ Use same way to declare routes as in app-server #75

♻️ Use same way to declare routes as in app-server

♻️ Use same way to declare routes as in app-server #75

Workflow file for this run

name: run_tests
# Run this workflow every time a new commit pushed to your repository
on: push
jobs:
build-and-test-backend:
name: Build backend and test backend
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- name: Build
run: ./gradlew build --build-cache --console plain
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v2
with:
name: backend-tests-results # Name artifact for storage in cache
path: |
modules/**/build/test-results/**/*.xml
build-and-run-frontend-unit-tests:
name: Build frontend and run frontend unit test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Define node modules cache
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'
cache-dependency-path: modules/ui/yarn.lock
- name: Install dependencies
working-directory: ./modules/ui
run: yarn install
- name: Run frontend tests
working-directory: ./modules/ui
run: yarn run test
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v2
with:
name: frontend-unit-tests-results # Name artifact for storage in cache
path: |
./modules/ui/test-output.xml
execute-ui-e2e-tests:
name: Execute UI end to end tests
runs-on: ubuntu-latest
needs: [build-and-test-backend, build-and-run-frontend-unit-tests]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run docker with db
working-directory: modules/app-server/docker
run: docker-compose up -d
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- name: Run server
run: ./gradlew :modules:app-server:app:run &
- name: Define node modules cache
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'
cache-dependency-path: modules/ui/yarn.lock
- name: Install UI dependencies
working-directory: modules/ui
run: yarn install
- name: Run UI
working-directory: modules/ui
run: npm run dev &
- name: Install Cypress and run tests
uses: cypress-io/github-action@v6
with:
wait-on: 'http://localhost:5173'
working-directory: modules/ui
publish-all-test-results:
name: Publish all tests results
runs-on: ubuntu-latest
needs: [build-and-test-backend, build-and-run-frontend-unit-tests, execute-ui-e2e-tests]
# the build-and-test job might be skipped, we don't need to run this job then
if: success() || failure()
permissions:
checks: write
pull-requests: write
steps:
- name: Download backend tests artifact
uses: actions/download-artifact@v2
with:
name: backend-tests-results # Name of artifact in cache
path: tests-results/
- name: Download frontend unit tests
uses: actions/download-artifact@v2
with:
name: frontend-unit-tests-results # Name of artifact in cache
path: tests-results/
- name: Publish Unit Test Results
uses: docker://ghcr.io/enricomi/publish-unit-test-result-action:v1
if: always()
with:
github_token: ${{ github.token }}
files: tests-results/**/*.xml