test: Fix apps tests.sh bash syntax #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run 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@v3 | |
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@v3 | |
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 --frozen-lockfile | |
- uses: actions/cache@v3 | |
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 }} | |
INFINITEPAY_ID: ${{ secrets.INFINITEPAY_ID }} | |
INFINITEPAY_SECRET: ${{ secrets.INFINITEPAY_SECRET }} | |
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@v3 | |
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-12.5.2 | |
- 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 & | |
- 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 |