Skip to content

Commit

Permalink
add e2e for deploy action
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Nov 15, 2024
1 parent 6802267 commit 03cf48b
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/demo-deploy-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
java-version: ${{vars.JAVA_VERSION}}
distribution: 'adopt'

- name: Set up node 18
- name: Set up node ${{vars.NODE_VERSION}}
uses: actions/setup-node@v4
with:
node-version: ${{vars.NODE_VERSION}}
Expand Down
68 changes: 65 additions & 3 deletions .github/workflows/deploy-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ on:


jobs:
get-e2e-files:
runs-on: ubuntu-24.04
outputs:
file_list: ${{ steps.generate-file-list.outputs.file_list }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Generate file list
id: generate-file-list
run: |
FILES=$(ls frontend/cypress/e2e | jq -R . | jq -s . | jq -c)
echo $FILES
echo "file_list=$FILES" >> $GITHUB_OUTPUT
extract-version:
runs-on: ubuntu-latest
Expand All @@ -32,10 +46,10 @@ jobs:
java-version: ${{vars.JAVA_VERSION}}
distribution: 'adopt'

- name: Set up node 18
- name: Set up node ${{vars.NODE_VERSION}}
uses: actions/setup-node@v4
with:
node-version: 18.17.1
node-version: ${{vars.NODE_VERSION}}

- name: Install Dependencies
run: cd ./frontend && npm ci
Expand Down Expand Up @@ -68,9 +82,57 @@ jobs:
- name: print imagetags
run: echo ${{ needs.extract-version.outputs.okr-docker-image}}


e2e-docker:
runs-on: ubuntu-24.04
needs: [build-docker-image, extract-version, get-e2e-files]
strategy:
fail-fast: false
matrix:
file: ${{ fromJSON(needs.get-e2e-files.outputs.file_list) }}
steps:
- uses: actions/checkout@v4

- name: Download artifact
uses: actions/download-artifact@v4
with:
name: okr-image
path: /tmp

- name: Load image
run: docker load --input /tmp/okr-docker-image.tar

- name: Run keyloak server
run: cd docker && docker compose up -d keycloak-pitc

- name: run Springboot okr application
run: |
docker run --network=host \
-e SPRING_PROFILES_ACTIVE=integration-test \
${{ needs.read-version.outputs.okr-docker-image}} &
- name: Cypress run e2e tests
uses: cypress-io/github-action@v6
with:
build: npm i -D cypress
working-directory: frontend
install: false
wait-on: 'http://pitc.okr.localhost:8080/config, http://localhost:8544'
wait-on-timeout: 120
browser: chrome
headed: false
config: baseUrl=http://pitc.okr.localhost:8080
spec: cypress/e2e/${{ matrix.file }}

- uses: actions/upload-artifact@v4
if: always()
with:
name: cypress-screenshots for ${{ matrix.file }}
path: frontend/cypress/screenshots

okr-deploy:
runs-on: ubuntu-latest
needs: [build-docker-image, extract-version]
needs: [e2e-docker, extract-version]
steps:
- name: Checkout project
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/staging-deploy-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ jobs:

upload-to-quay:
runs-on: ubuntu-latest
needs: [update-version, build-docker-image] #[e2e-docker, update-version]
needs: [update-version, e2e-docker] #[e2e-docker, update-version]
steps:
- uses: actions/checkout@v4

Expand Down

0 comments on commit 03cf48b

Please sign in to comment.