Skip to content

Commit

Permalink
update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kcinay055679 committed Oct 29, 2024
1 parent 3c05485 commit b98a724
Showing 1 changed file with 103 additions and 1 deletion.
104 changes: 103 additions & 1 deletion .github/workflows/test-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ name: 'Show Variables'

on:
workflow_dispatch:
push:

jobs:
display-variables:
name: Show GitHub Variables
runs-on: ubuntu-22.04
steps:
- name: Try to show GitHub Variables
run: |
Expand All @@ -16,4 +18,104 @@ jobs:
echo "IMAGE_TAG : $vars.ENV_CONTEXT_VAR"
echo "IMAGE_TAG : $IMAGE_TAG"
echo "QUAY_URL : $QUAY_URL"
update-version:
if: github.event.pull_request.merged == true
runs-on: ubuntu-24.04
outputs:
okr-docker-image: ${{ vars.NEW_VALUE_URL }}:${{ steps.store-version.outputs.version}}-STAGING
steps:
- uses: actions/checkout@v4
with:
token: ${{secrets.VERSION_TOKEN}}

- name: Extract Maven project version
run: echo "version=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)" >> $GITHUB_OUTPUT
id: store-version

- name: Set New Snapshot Version
run: mvn build-helper:parse-version versions:set -DnewVersion=${{ steps.store-version.outputs.version}}-SNAPSHOT -DgenerateBackupPoms=false



build-run-docker-image:
needs: update-version
runs-on: ubuntu-24.04
services:
cypress:
image: cypress/browsers:latest
options: --user 1001

steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'

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

- name: Install Dependencies
run: cd ./frontend && npm ci

- name: Build frontend with Angular
run: cd ./frontend && npm run build

- name: Build backend with Maven
run: mvn -B clean package --file pom.xml -P build-for-docker

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build the docker image
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
tags: ${{ needs.update-version.outputs.okr-docker-image}}
load: true
push: false


- name: print imagetags
run: echo ${{ needs.update-version.outputs.okr-docker-image}}

- name: show images
run: docker image ls -a

- name: Run docker image
run: |
docker run --network=host \
-e SPRING_PROFILES_ACTIVE=integration-test \
${{ needs.update-version.outputs.okr-docker-image}} &
- name: run keycloak docker
run: |
docker run \
-e KEYCLOAK_ADMIN=admin \
-e KEYCLOAK_ADMIN_PASSWORD=keycloak \
-v ./docker/config/realm-export.json:/opt/keycloak/data/import/realm.json \
-p 8544:8080 \
quay.io/keycloak/keycloak:23.0.1 \
start-dev --import-realm &
- name: Cypress run e2e tests
uses: cypress-io/github-action@v6
with:
wait-on: 'http://pitc.okr.localhost:8080/config, http://localhost:8544'
wait-on-timeout: 120
browser: chrome
headed: true
working-directory: frontend
config: baseUrl=http://pitc.okr.localhost:8080

- uses: actions/upload-artifact@v4
if: always()
with:
name: cypress-screenshots
path: frontend/cypress/screenshots

0 comments on commit b98a724

Please sign in to comment.