Merge pull request #46 from nilshartmann/spring_boot_3_2 #1
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
on: | |
- push | |
jobs: | |
petclinic-graphiql: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./petclinic-graphiql | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- uses: pnpm/[email protected] | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: 8 | |
run_install: false | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build application | |
run: pnpm build | |
- name: Archive artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: graphiql-dist | |
path: ./petclinic-graphiql/dist/** | |
retention-days: 1 | |
backend: | |
runs-on: ubuntu-latest | |
needs: petclinic-graphiql | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Java 21 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: "21" | |
distribution: "temurin" | |
cache: maven | |
- name: Clear embedded graphiql | |
run: rm -rf backend/src/main/resources/ui/graphiql | |
- name: Download graphiql | |
uses: actions/download-artifact@v3 | |
with: | |
name: graphiql-dist | |
path: backend/src/main/resources/ui/graphiql | |
- name: show graphiql artifact | |
run: ls -lR backend/src/main/resources/ui/ | |
- name: Build with maven | |
run: ./mvnw -pl backend spring-boot:build-image -Dspring-boot.build-image.imageName=spring-petclinic/petclinic-graphql-backend:0.0.1 | |
- name: Export docker image | |
run: docker save spring-petclinic/petclinic-graphql-backend:0.0.1|gzip>petclinic-graphql-backend.tar.gz | |
- name: Archive artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: petclinic-backend-docker | |
path: petclinic-graphql-backend.tar.gz | |
retention-days: 1 | |
frontend: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./frontend | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- uses: pnpm/[email protected] | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: 8 | |
run_install: false | |
- name: Install dependencies | |
run: pnpm install | |
- name: Code checks | |
run: pnpm run check | |
- name: Build application | |
run: pnpm build | |
- name: Build frontend docker image | |
run: docker build . --tag spring-petclinic/petclinic-graphql-frontend:0.0.1 | |
- name: Export frontend docker image | |
run: docker save spring-petclinic/petclinic-graphql-frontend:0.0.1|gzip>../petclinic-graphql-frontend.tar.gz | |
- name: LS | |
run: ls -lR .. | |
- name: Archive artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: petclinic-frontend-docker | |
path: petclinic-graphql-frontend.tar.gz | |
retention-days: 1 | |
end-to-end-test: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
needs: [petclinic-graphiql,backend,frontend] | |
steps: | |
- name: setup playwright | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Download backend artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: petclinic-backend-docker | |
path: petclinic-backend-docker | |
- name: Download frontend docker image | |
uses: actions/download-artifact@v3 | |
with: | |
name: petclinic-frontend-docker | |
path: petclinic-frontend-docker | |
- name: LS | |
run: ls -lR | |
- name: Import backend Docker image | |
run: gunzip -c petclinic-backend-docker/petclinic-graphql-backend.tar.gz|docker load | |
- name: Import frontend Docker image | |
run: gunzip -c petclinic-frontend-docker/petclinic-graphql-frontend.tar.gz|docker load | |
- name: run docker compose | |
run: docker-compose -f docker-compose-petclinic.yml up -d | |
- uses: pnpm/[email protected] | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: 8 | |
run_install: false | |
- name: Install dependencies | |
working-directory: ./e2e-tests | |
run: pnpm install | |
- name: Install Playwright Browsers | |
working-directory: ./e2e-tests | |
run: pnpm exec playwright install --with-deps | |
- name: wait for backend on port 3090 | |
uses: iFaxity/[email protected] | |
with: | |
resource: http-get://localhost:3090 | |
- name: wait for frontend on port 3091 | |
uses: iFaxity/[email protected] | |
with: | |
resource: http-get://localhost:3091 | |
- name: Run Playwright tests | |
working-directory: ./e2e-tests | |
run: pnpm test:docker-compose | |
- name: Test Report | |
uses: dorny/test-reporter@v1 | |
if: success() || failure() # run this step even if previous step failed | |
with: | |
name: PlayWright Test # Name of the check run which will be created | |
path: e2e-tests/test-results.xml # Path to test results | |
reporter: java-junit # Format of test results | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-report | |
path: ./e2e-tests/playwright-report/ | |
retention-days: 2 |