Skip to content

Commit 338768d

Browse files
authored
fix: Merge dummy workflow for testing kubernetes stuff (#78)
1 parent d91d15c commit 338768d

File tree

1 file changed

+230
-0
lines changed

1 file changed

+230
-0
lines changed
Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
name: Deploy & run E2E on k8s
2+
run-name: 'E2E by ${{ github.event.client_payload.actor || github.actor }} to ${{ github.event.client_payload.stack || github.event.inputs.stack }}. Images core: ${{ github.event.client_payload.core-image-tag || github.event.inputs.core-image-tag }} and farajaland: ${{ github.event.client_payload.countryconfig-image-tag || github.event.inputs.countryconfig-image-tag }}'
3+
on:
4+
repository_dispatch:
5+
# TODO: Do we need to call workflow that way?
6+
types: [run_k8s_e2e]
7+
workflow_dispatch:
8+
inputs:
9+
core-image-tag:
10+
description: Core DockerHub image tag
11+
required: true
12+
default: 'v1.8.0'
13+
countryconfig-image-tag:
14+
description: Your Country Config DockerHub image tag
15+
required: true
16+
default: 'v1.8.0'
17+
stack:
18+
type: string
19+
description: Stack name
20+
required: true
21+
keep-e2e:
22+
description: Keep environment after run
23+
required: true
24+
default: true
25+
type: boolean
26+
branch:
27+
description: e2e branch
28+
required: false
29+
default: 'develop'
30+
concurrency:
31+
group: ${{ github.event.client_payload.stack || github.event.inputs.stack }}
32+
cancel-in-progress: true
33+
34+
jobs:
35+
debug:
36+
name: Debug output
37+
runs-on: ubuntu-22.04
38+
steps:
39+
- name: Print Entire Event Payload
40+
run: |
41+
echo "${{ toJson(github.event) }}"
42+
deploy:
43+
uses: opencrvs/infrastructure/.github/workflows/deploy-on-kubernetes.yml
44+
with:
45+
core-image-tag: ${{ github.event.client_payload.core-image-tag || github.event.inputs.core-image-tag }}
46+
countryconfig-image-tag: ${{ github.event.client_payload.countryconfig-image-tag || github.event.inputs.countryconfig-image-tag }}
47+
environment: ${{ github.event.client_payload.stack || github.event.inputs.stack }}
48+
reset: 'true'
49+
secrets: inherit
50+
51+
# discover-tests:
52+
# name: Discover test directories
53+
# runs-on: ubuntu-24.04
54+
# outputs:
55+
# test_matrix: ${{ steps.list-tests.outputs.test_matrix }}
56+
# steps:
57+
# - uses: actions/checkout@v4
58+
# with:
59+
# repository: 'opencrvs/opencrvs-farajaland'
60+
# fetch-depth: 0
61+
62+
# - name: Checkout country branch
63+
# run: |
64+
# git checkout ${{ github.event.client_payload.countryconfig-image-tag || inputs.countryconfig-image-tag }}
65+
66+
# - name: Set up Node.js from country .nvmrc
67+
# uses: actions/setup-node@v4
68+
# with:
69+
# node-version-file: .nvmrc
70+
71+
# - name: List Test Directories
72+
# id: list-tests
73+
# run: |
74+
# tests_suites=$(cd e2e/testcases; find * -type f -name "*.spec.ts" | jq -R -s -c 'split("\n")[:-1]')
75+
# echo "Test suites: $tests_suites"
76+
# echo "test_matrix=$tests_suites" >> $GITHUB_OUTPUT
77+
# echo "test_matrix=$tests_suites"
78+
# - name: Cache Node.js dependencies
79+
# uses: actions/cache@v4
80+
# with:
81+
# path: |
82+
# node_modules
83+
# ~/.cache/yarn/v6
84+
# ~/.cache/ms-playwright
85+
# key: ${{ github.event.client_payload.countryconfig-image-tag || github.event.inputs.countryconfig-image-tag }}
86+
# restore-keys: |
87+
# ${{ runner.os }}-node-
88+
89+
# - name: Install Dependencies
90+
# run: yarn
91+
# - uses: nick-fields/retry@v3
92+
# with:
93+
# timeout_minutes: 10
94+
# max_attempts: 3
95+
# command: npx playwright install --with-deps
96+
# - name: Cache Node.js dependencies
97+
# uses: actions/cache@v4
98+
# with:
99+
# path: |
100+
# node_modules
101+
# ~/.cache/yarn/v6
102+
# ~/.cache/ms-playwright
103+
# key: ${{ github.event.client_payload.countryconfig-image-tag || github.event.inputs.countryconfig-image-tag }}
104+
# restore-keys: |
105+
# ${{ runner.os }}-node-
106+
# test:
107+
# needs: [deploy, discover-tests]
108+
# runs-on: ubuntu-22.04
109+
# environment: ${{ github.event.client_payload.stack || github.event.inputs.stack }}
110+
# strategy:
111+
# fail-fast: false
112+
# matrix:
113+
# test_file: ${{ fromJson(needs.discover-tests.outputs.test_matrix) }}
114+
# name: ${{ matrix.test_file }}
115+
# steps:
116+
# - uses: actions/checkout@v4
117+
# with:
118+
# repository: 'opencrvs/opencrvs-farajaland'
119+
# fetch-depth: 0
120+
121+
# - name: Checkout country branch
122+
# run: |
123+
# git checkout ${{ github.event.client_payload.countryconfig-image-tag || github.event.inputs.countryconfig-image-tag }}
124+
# - name: Set up Node.js from country .nvmrc
125+
# uses: actions/setup-node@v4
126+
# with:
127+
# node-version-file: .nvmrc
128+
129+
# - name: Cache Node.js dependencies
130+
# uses: actions/cache@v4
131+
# id: cache
132+
# with:
133+
# path: |
134+
# node_modules
135+
# ~/.cache/yarn/v6
136+
# ~/.cache/ms-playwright
137+
# key: ${{ github.event.client_payload.countryconfig-image-tag || github.event.inputs.countryconfig-image-tag }}
138+
# restore-keys: |
139+
# ${{ runner.os }}-node-
140+
141+
# - name: Install Dependencies
142+
# if: steps.cache.outputs.cache-hit != 'true'
143+
# run: yarn
144+
# - uses: nick-fields/retry@v3
145+
# if: steps.cache.outputs.cache-hit != 'true'
146+
# with:
147+
# timeout_minutes: 10
148+
# max_attempts: 3
149+
# command: npx playwright install --with-deps
150+
# - name: Run Playwright Tests
151+
# run: npx playwright test ./e2e/testcases/${{ matrix.test_file }}
152+
# env:
153+
# DOMAIN: '${{ github.event.client_payload.stack || inputs.stack }}.${{ vars.DOMAIN }}'
154+
# - id: ctrf_check
155+
# if: always()
156+
# run: |
157+
# [ -d ctrf ] && \
158+
# echo "ctrf=true" >> $GITHUB_OUTPUT || \
159+
# echo "ctrf=false" >> $GITHUB_OUTPUT
160+
# - name: Publish Test Summary Results
161+
# run: npx github-actions-ctrf ctrf/ctrf-report.json
162+
# if: always() && steps.ctrf_check.outputs.ctrf == 'true'
163+
164+
# - name: Form the artifact name from test_file
165+
# if: always()
166+
# id: artifact
167+
# run: echo "artifact=$(echo '${{ matrix.test_file }}' | sed 's/\//__/g')" >> $GITHUB_OUTPUT
168+
169+
# - uses: actions/upload-artifact@v4
170+
# if: always()
171+
# with:
172+
# name: playwright-report-${{ github.event.client_payload.stack || github.event.inputs.stack }}-${{ steps.artifact.outputs.artifact }}-${{ github.run_id }}-${{ github.run_attempt }}
173+
# path: playwright-report/
174+
# retention-days: 30
175+
176+
# get-previous-run:
177+
# runs-on: ubuntu-latest
178+
# outputs:
179+
# previous_run_result: ${{ steps.set-output.outputs.result }}
180+
181+
# steps:
182+
# - name: Checkout code
183+
# uses: actions/checkout@v3
184+
# with:
185+
# fetch-depth: 0
186+
187+
# - name: Get Previous Run Conclusion
188+
# id: get-previous-conclusion
189+
# run: |
190+
# previous_conclusion=$(gh run list --limit 1 --status=completed --workflow="Deploy & run E2E" --json conclusion -q '.[0].conclusion')
191+
# echo "PREVIOUS_CONCLUSION=$previous_conclusion" >> $GITHUB_ENV
192+
# env:
193+
# GH_TOKEN: ${{ secrets.GH_TOKEN }}
194+
195+
# - name: Set Output Based on Conclusion
196+
# id: set-output
197+
# run: |
198+
# echo "result=$PREVIOUS_CONCLUSION" >> $GITHUB_OUTPUT
199+
200+
# cleanup-stack:
201+
# needs: [test]
202+
# runs-on: ubuntu-24.04
203+
# if: github.event.client_payload.keep-e2e == 'false' || github.event.inputs.keep-e2e == 'false'
204+
# env:
205+
# stack: ${{ github.event.client_payload.stack || github.event.inputs.stack }}
206+
# keep_e2e: ${{ github.event.client_payload.keep-e2e || github.event.inputs.keep-e2e }}
207+
# steps:
208+
# - uses: actions/checkout@v4
209+
# - name: Read known hosts
210+
# run: |
211+
# echo "KNOWN_HOSTS<<EOF" >> $GITHUB_ENV
212+
# sed -i -e '$a\' ./infrastructure/known-hosts
213+
# cat ./infrastructure/known-hosts >> $GITHUB_ENV
214+
# echo "EOF" >> $GITHUB_ENV
215+
# - name: Install SSH Key
216+
# uses: shimataro/ssh-key-action@v2
217+
# with:
218+
# key: ${{ secrets.SSH_KEY }}
219+
# known_hosts: ${{ env.KNOWN_HOSTS }}
220+
221+
# - name: Unset KNOWN_HOSTS variable
222+
# run: |
223+
# echo "KNOWN_HOSTS=" >> $GITHUB_ENV
224+
# - name: Cleanup e2e stack
225+
# run: |
226+
# bash infrastructure/deployment/cleanup-e2e-stack.sh \
227+
# --stack=${stack} \
228+
# --ssh_host=${{ vars.SSH_HOST || secrets.SSH_HOST }} \
229+
# --ssh_port=${{ vars.SSH_PORT || secrets.SSH_PORT }} \
230+
# --ssh_user=${{ secrets.SSH_USER }}

0 commit comments

Comments
 (0)