@@ -48,90 +48,110 @@ jobs:
48
48
fi
49
49
echo "file_list=$FILES" >> $GITHUB_OUTPUT
50
50
51
- # Job to run tests in parallel based on the discovered files
52
- e2e-docker :
51
+ # # Job to run tests in parallel based on the discovered files
52
+ # e2e-docker:
53
+ # needs: get-e2e-files
54
+ # if: needs.get-e2e-files.outputs.file_list != '[]' && inputs.DOCKER_IMAGE_TAG != ''
55
+ # runs-on: ubuntu-latest # Or ubuntu-24.04
56
+ # strategy:
57
+ # fail-fast: false # Continue running other tests even if one fails
58
+ # matrix:
59
+ # file: ${{ fromJSON(needs.get-e2e-files.outputs.file_list) }}
60
+ # env:
61
+ # IMAGE_FILE_NAME: okr-docker-image.tar
62
+ #
63
+ # steps:
64
+ # - run: echo "${{ github.run_id }}"
65
+ # - name: Checkout Target Repo Code (for Cypress config/plugins)
66
+ # uses: actions/checkout@v4
67
+ #
68
+ # - name: Download Docker image artifact
69
+ # uses: actions/download-artifact@v4
70
+ # with:
71
+ # name: okr-image
72
+ # path: ${{ runner.temp }}
73
+ #
74
+ # - name: Load image into Docker
75
+ # run: docker load --input ${{ runner.temp }}/okr-docker-image.tar
76
+ #
77
+ # # --- E2E Test Execution Steps (Adjust as needed) ---
78
+ # - name: Set up Docker Compose / Start Services (if needed)
79
+ # run: cd docker && docker compose up -d keycloak-pitc
80
+ #
81
+ # - name: Run Application Container
82
+ # run: |
83
+ # docker run --network=host \
84
+ # -e SPRING_PROFILES_ACTIVE=integration-test \
85
+ # ${{inputs.DOCKER_IMAGE_TAG }} &
86
+ #
87
+ # - name: Set up node for Cypress
88
+ # uses: actions/setup-node@v4
89
+ # with:
90
+ # node-version: ${{vars.NODE_VERSION}}
91
+ #
92
+ # - name: Cypress run e2e tests
93
+ # uses: cypress-io/github-action@v6
94
+ # with:
95
+ # build: npm i -D cypress
96
+ # working-directory: frontend
97
+ # install: false
98
+ # wait-on: 'http://pitc.okr.localhost:8080/config, http://localhost:8544'
99
+ # wait-on-timeout: 120
100
+ # browser: chrome
101
+ # headed: false
102
+ # config: baseUrl=http://pitc.okr.localhost:8080
103
+ # spec: cypress/e2e/${{ matrix.file }}
104
+ #
105
+ # - uses: actions/upload-artifact@v4
106
+ # if: always()
107
+ # with:
108
+ # name: cypress-screenshots for ${{ matrix.file }}
109
+ # path: frontend/cypress/screenshots
110
+
111
+ e2e :
53
112
needs : get-e2e-files
54
- if : needs.get-e2e-files.outputs.file_list != '[]' && inputs.DOCKER_IMAGE_TAG != ''
113
+ if : needs.get-e2e-files.outputs.file_list != '[]' && inputs.COMMIT_HASH != ''
55
114
runs-on : ubuntu-latest # Or ubuntu-24.04
56
115
strategy :
57
116
fail-fast : false # Continue running other tests even if one fails
58
117
matrix :
59
118
file : ${{ fromJSON(needs.get-e2e-files.outputs.file_list) }}
60
119
env :
61
120
IMAGE_FILE_NAME : okr-docker-image.tar
121
+ BRANCH_NAME : ${{ github.head_ref || github.ref_name }}
122
+ COMMIT_REF : ${{ inputs.COMMIT_HASH || (github.head_ref || github.ref_name) }}
62
123
63
124
steps :
64
- - run : echo "${{ github.run_id }}"
65
125
- name : Checkout Target Repo Code (for Cypress config/plugins)
66
126
uses : actions/checkout@v4
127
+ with :
128
+ ref : ${{ env.COMMIT_REF }}
129
+
130
+ - name : Set up Docker Compose / Start Services (if needed)
131
+ run : cd docker && docker compose up -d keycloak-pitc
67
132
68
133
- name : Download Docker image artifact
134
+ if : inputs.DOCKER_IMAGE_TAG != ''
69
135
uses : actions/download-artifact@v4
70
136
with :
71
137
name : okr-image
72
138
path : ${{ runner.temp }}
73
139
74
140
- name : Load image into Docker
141
+ if : inputs.DOCKER_IMAGE_TAG != ''
75
142
run : docker load --input ${{ runner.temp }}/okr-docker-image.tar
76
143
77
- # --- E2E Test Execution Steps (Adjust as needed) ---
78
- - name : Set up Docker Compose / Start Services (if needed)
79
- run : cd docker && docker compose up -d keycloak-pitc
80
-
81
- - name : Run Application Container
144
+ - name : Run Application Container from image
145
+ if : inputs.DOCKER_IMAGE_TAG != ''
82
146
run : |
83
147
docker run --network=host \
84
148
-e SPRING_PROFILES_ACTIVE=integration-test \
85
149
${{inputs.DOCKER_IMAGE_TAG }} &
86
-
87
- - name : Set up node for Cypress
88
- uses : actions/setup-node@v4
89
- with :
90
- node-version : ${{vars.NODE_VERSION}}
91
-
92
- - name : Cypress run e2e tests
93
- uses : cypress-io/github-action@v6
94
- with :
95
- build : npm i -D cypress
96
- working-directory : frontend
97
- install : false
98
- wait-on : ' http://pitc.okr.localhost:8080/config, http://localhost:8544'
99
- wait-on-timeout : 120
100
- browser : chrome
101
- headed : false
102
- config : baseUrl=http://pitc.okr.localhost:8080
103
- spec : cypress/e2e/${{ matrix.file }}
104
-
105
- - uses : actions/upload-artifact@v4
106
- if : always()
107
- with :
108
- name : cypress-screenshots for ${{ matrix.file }}
109
- path : frontend/cypress/screenshots
110
-
111
- e2e-local :
112
- needs : get-e2e-files
113
- if : needs.get-e2e-files.outputs.file_list != '[]' && inputs.COMMIT_HASH != ''
114
- runs-on : ubuntu-latest # Or ubuntu-24.04
115
- strategy :
116
- fail-fast : false # Continue running other tests even if one fails
117
- matrix :
118
- file : ${{ fromJSON(needs.get-e2e-files.outputs.file_list) }}
119
- env :
120
- IMAGE_FILE_NAME : okr-docker-image.tar
121
-
122
- steps :
123
- - name : Checkout Target Repo Code (for Cypress config/plugins)
124
- uses : actions/checkout@v4
125
- with :
126
- ref : ${{ inputs.COMMIT_HASH }}
127
-
128
- - name : Set up Docker Compose / Start Services (if needed)
129
- run : cd docker && docker compose up -d keycloak-pitc
130
-
131
- - name : Run application
150
+
151
+ - name : Run application from local code
152
+ if : inputs.COMMIT_HASH != ''
132
153
run : cd ./backend && mvn spring-boot:run -Dspring-boot.run.profiles=integration-test &
133
154
134
-
135
155
- name : Set up node for Cypress
136
156
uses : actions/setup-node@v4
137
157
with :
0 commit comments