-
Notifications
You must be signed in to change notification settings - Fork 7
141 lines (125 loc) · 4.2 KB
/
test-apps.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Module and app tests
on:
pull_request:
paths:
- "packages/**"
- "!**/package.json"
- "!packages/storefront/**"
- "!packages/ssr/**"
- "!packages/feeds/**"
- "!packages/passort/**"
- "!packages/i18n/**"
- "!packages/__skeleton/**"
push:
branches:
- main
paths:
- ".github/workflows/test-apps.yml"
- "packages/**"
- "pnpm-lock.yaml"
- "!**/package.json"
- "!packages/storefront/**"
- "!packages/ssr/**"
- "!packages/feeds/**"
- "!packages/passort/**"
- "!packages/i18n/**"
- "!packages/__skeleton/**"
jobs:
test:
runs-on: ubuntu-latest
if: |
!contains(github.event.head_commit.message, '[skip ci]') &&
!contains(github.event.head_commit.author.name, '[bot]')
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: ecomplus/store
path: store
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: pnpm/action-setup@v2
with:
version: 8
run_install: false
- name: Get pnpm store directory
id: pnpm-paths
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: ${{ steps.pnpm-paths.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- shell: bash
run: bash scripts/pre-install.sh && pnpm install --no-frozen-lockfile
- uses: actions/cache@v4
with:
path: |
**/.turbo
**/.cache/turbo
packages/*/lib
packages/apps/*/lib
packages/apps/*/assets/*.min.js
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-
- shell: bash
env:
ECOM_STORE_ID: ${{ secrets.ECOM_STORE_ID }}
ECOM_AUTHENTICATION_ID: ${{ secrets.ECOM_AUTHENTICATION_ID }}
ECOM_API_KEY: ${{ secrets.ECOM_API_KEY }}
MERCADOPAGO_TOKEN: ${{ secrets.MERCADOPAGO_TOKEN }}
FRENET_TOKEN: ${{ secrets.FRENET_TOKEN }}
GALAXPAY_ID: ${{ secrets.GALAXPAY_ID }}
GALAXPAY_HASH: ${{ secrets.GALAXPAY_HASH }}
run: pnpm build
- name: Get npm global directories
id: npm-paths
shell: bash
run: |
lib_path=$(npm list -g | head -1)
echo "LIB_PATH=$lib_path" >> $GITHUB_OUTPUT
echo "BIN_PATH=${lib_path/\/lib//bin}" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
id: npm-g-cache
with:
path: |
${{ steps.npm-paths.outputs.LIB_PATH }}
${{ steps.npm-paths.outputs.BIN_PATH }}
~/.npm-global/bin
key: ${{ runner.os }}-npm-globals-firebase-tools-13.28.0
- if: steps.npm-g-cache.outputs.cache-hit != 'true'
shell: bash
run: npm install -g [email protected]
- name: Initialize Firebase emulators
shell: bash
working-directory: store
env:
ECOM_STORE_ID: ${{ secrets.ECOM_STORE_ID }}
ECOM_AUTHENTICATION_ID: ${{ secrets.ECOM_AUTHENTICATION_ID }}
ECOM_API_KEY: ${{ secrets.ECOM_API_KEY }}
MERCADOPAGO_TOKEN: ${{ secrets.MERCADOPAGO_TOKEN }}
run: |
printf "ECOM_AUTHENTICATION_ID=$ECOM_AUTHENTICATION_ID
ECOM_API_KEY=$ECOM_API_KEY
ECOM_STORE_ID=$ECOM_STORE_ID
" > functions/.env
npx cloudcommerce prepare
firebase --project=ecom2-demo emulators:start --only functions,hosting &
- name: Run tests
shell: bash
env:
ECOM_STORE_ID: ${{ secrets.ECOM_STORE_ID }}
ECOM_AUTHENTICATION_ID: ${{ secrets.ECOM_AUTHENTICATION_ID }}
ECOM_API_KEY: ${{ secrets.ECOM_API_KEY }}
MERCADOPAGO_TOKEN: ${{ secrets.MERCADOPAGO_TOKEN }}
FRENET_TOKEN: ${{ secrets.FRENET_TOKEN }}
GALAXPAY_ID: ${{ secrets.GALAXPAY_ID }}
GALAXPAY_HASH: ${{ secrets.GALAXPAY_HASH }}
run: |
sleep 10
pnpm test:apps