Skip to content

Commit fca58f7

Browse files
Created env variables globally.
1 parent 2a44ab0 commit fca58f7

1 file changed

Lines changed: 11 additions & 27 deletions

File tree

.github/workflows/ci.yml

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
name: Playwright Test Framework
2-
env:
3-
TZ: Asia/Kolkata
42

53
on:
64
workflow_dispatch:
@@ -15,6 +13,15 @@ on:
1513
schedule:
1614
- cron: '0 0 * * *'
1715

16+
env:
17+
TZ: Asia/Kolkata
18+
SWAGLABS_URL: ${{ secrets.SWAGLABS_URL }}
19+
SWAGLABS_USERNAME: ${{ secrets.SWAGLABS_USERNAME }}
20+
SWAGLABS_PASSWORD: ${{ secrets.SWAGLABS_PASSWORD }}
21+
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
22+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
23+
CODECOV_SLUG: ${{ secrets.CODECOV_SLUG }}
24+
1825
jobs:
1926
build_and_test:
2027
name: Build and Test
@@ -55,11 +62,6 @@ jobs:
5562
uses: browser-actions/setup-edge@v1
5663

5764
- name: Run Unit Tests
58-
env:
59-
# Inject secret as environment variable
60-
SWAGLABS_URL: ${{ secrets.SWAGLABS_URL }}
61-
SWAGLABS_USERNAME: ${{ secrets.SWAGLABS_USERNAME }}
62-
SWAGLABS_PASSWORD: ${{ secrets.SWAGLABS_PASSWORD }}
6365
run: |
6466
mvn clean test -Drunmode=headless -Dbrowser=${{ matrix.browser }} \
6567
-Dgroups=SWAG_LABS_UNIT \
@@ -72,8 +74,8 @@ jobs:
7274
- name: Upload Coverage to Codecov
7375
uses: codecov/codecov-action@v4
7476
with:
75-
token: ${{ secrets.CODECOV_TOKEN }}
76-
slug: ${{ secrets.CODECOV_SLUG }}
77+
token: $CODECOV_TOKEN
78+
slug: $CODECOV_SLUG
7779
verbose: true
7880

7981
- name: Upload Artifacts
@@ -108,10 +110,6 @@ jobs:
108110
name: target-${{ matrix.browser }} # Match the unique artifact name
109111

110112
- name: Run Tests for ${{ matrix.browser }}
111-
env:
112-
SWAGLABS_URL: ${{ secrets.SWAGLABS_URL }}
113-
SWAGLABS_USERNAME: ${{ secrets.SWAGLABS_USERNAME }}
114-
SWAGLABS_PASSWORD: ${{ secrets.SWAGLABS_PASSWORD }}
115113
run: |
116114
mvn clean test -Drunmode=headless -Dbrowser=${{ matrix.browser }} \
117115
-Dgroups=SWAG_LABS_SMOKE \
@@ -128,8 +126,6 @@ jobs:
128126
if: always()
129127

130128
- name: Send Results to Discord
131-
env:
132-
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
133129
run: |
134130
# Gather metrics from test-summary output
135131
passed="${{ steps.summary.outputs.passed }}"
@@ -181,10 +177,6 @@ jobs:
181177
name: target-${{ matrix.browser }} # Match the unique artifact name
182178

183179
- name: Run Tests for ${{ matrix.browser }}
184-
env:
185-
SWAGLABS_URL: ${{ secrets.SWAGLABS_URL }}
186-
SWAGLABS_USERNAME: ${{ secrets.SWAGLABS_USERNAME }}
187-
SWAGLABS_PASSWORD: ${{ secrets.SWAGLABS_PASSWORD }}
188180
run: |
189181
mvn clean test -Drunmode=headless -Dbrowser=${{ matrix.browser }} \
190182
-Dgroups=SWAG_LABS_REGRESSION \
@@ -201,8 +193,6 @@ jobs:
201193
if: always()
202194

203195
- name: Send Results to Discord
204-
env:
205-
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
206196
run: |
207197
# Gather metrics from test-summary output
208198
passed="${{ steps.summary.outputs.passed }}"
@@ -256,10 +246,6 @@ jobs:
256246
name: target-${{ matrix.browser }} # Match the unique artifact name
257247

258248
- name: Run Tests for ${{ matrix.browser }}
259-
env:
260-
SWAGLABS_URL: ${{ secrets.SWAGLABS_URL }}
261-
SWAGLABS_USERNAME: ${{ secrets.SWAGLABS_USERNAME }}
262-
SWAGLABS_PASSWORD: ${{ secrets.SWAGLABS_PASSWORD }}
263249
run: |
264250
mvn clean test -Drunmode=headless -Dbrowser=${{ matrix.browser }} \
265251
-Dgroups=SWAG_LABS_E2E \
@@ -276,8 +262,6 @@ jobs:
276262
if: always()
277263

278264
- name: Send Results to Discord
279-
env:
280-
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
281265
run: |
282266
# Gather metrics from test-summary output
283267
passed="${{ steps.summary.outputs.passed }}"

0 commit comments

Comments
 (0)