-
Notifications
You must be signed in to change notification settings - Fork 6
62 lines (51 loc) · 1.58 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: CI Workflow for API Integration Testing
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
# Add timestamp
print_timestamp:
runs-on: ubuntu-latest
steps:
- name: Generate timestamp
run: |
echo "TIMESTAMP=$(TZ='America/Los_Angeles' date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV
- name: Print timestamp
run: |
echo "Execution time (Pacific Time Zone) $TIMESTAMP"
test-and-publish:
needs: print_timestamp
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install pnpm
run: npm install -g pnpm
- name: Install Dependencies
run: pnpm install
- name: Lint
run: pnpm eslint .
# Ensure you have a lint script in your package.json
- name: Set env
env:
API_BASE_URL: ${{ vars.API_BASE_URL }}
API_PREFIX: ${{ vars.API_PREFIX }}
API_KEY: ${{ secrets.API_KEY }}
- name: Run Tests
run: pnpm exec playwright test
# Ensure you have a test:integration script in your package.json for your API integration tests
- name: Upload Test Results
uses: actions/upload-artifact@v2
if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/main'
with:
name: test-results
path: ./playwright-report/index.html