Skip to content

Commit

Permalink
chore: switch to pnpm, add voucher pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
LoneRifle committed Jun 18, 2024
1 parent 99a118a commit e85b7f7
Show file tree
Hide file tree
Showing 343 changed files with 57,943 additions and 7,949 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/voucher.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Voucher

on:
push:
branches: [develop, master]
pull_request:
# defaults to run on opened, reopened, synchronized and assigned
branches: [develop, master]
env: # Environment variables
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
jobs:
e2e:
name: e2e
# Visual testing must be done on same platform as development
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
# Opted to implement 6 shards at this juncture due to the relatively higher number of test cases currently available in the voucher section.
# This decision aims to balance resource allocation and testing efficiency, ensuring that we neither overutilize nor underutilize our testing resources.
# As the test suite expands in the future, we will reassess the sharding strategy to accommodate growing demands and maintain optimal performance
shard: [1/6, 2/6, 3/6, 4/6, 5/6, 6/6]
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: "packages/voucher/.nvmrc"
- name: Cache Node.js modules
uses: actions/cache@v4
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.pnpm-store
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- run: corepack enable pnpm
- run: pnpm i --frozen-lockfile
- name: Set up PERCY_PARALLEL_TOTAL
# setting the total number of percy shards as an environment variable. If PERCY_PARALLEL_TOTAL is set to to -1 this tells the API to
# disregard the number of builds created and finalized. The API will then wait for a finalize all builds call, which will close the
# build for that nonce. The Percy CLI sets the total to -1 when the --parallel flag is passed.
run: echo "PERCY_PARALLEL_TOTAL=-1" >> $GITHUB_ENV
- run: npx playwright install-deps
- run: npx playwright install
- run: pnpm --filter @redeem/voucher build
- run: pnpm --filter @redeem/voucher test:e2e:ci --shard ${{ matrix.shard }}
env:
DEBUG: pw:api
- name: Upload failure report to GitHub actions Artificats
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: diffs
path: test-results/

# Multiple containers are deployed to facilitate the concurrent running of tests. To aggregate all Percy snapshots into a single build,
# an additional job is configured to execute at the conclusion of all test runs. This job is tasked with waiting for all containerized tests to complete,
# subsequently gathering all generated snapshots, and then uploading them cohesively to Percy.
upload-percy-snapshot:
# Merge reports after e2e test, even if some shards have failed
if: ${{ always() }}
needs: [e2e]

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Cache Node.js modules
uses: actions/cache@v4
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.pnpm-store
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- run: corepack enable pnpm
- name: Download node dependencies from npm cache instead
run: pnpm i --frozen-lockfile --prefer-offline
- name: "Finalise percy build into one"
if: ${{ env.PERCY_TOKEN != '' }}
run: pnpm --filter @redeem/voucher percy:ci:build
140 changes: 20 additions & 120 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,130 +1,30 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# Optional stylelint cache
.stylelintcache
# dependencies
/node_modules
/.pnp
.pnp.js

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# testing
/coverage
/test-results

# Optional REPL history
.node_repl_history
# production
/build

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# environment variables
/env

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
test-results/
playwright-report/
6 changes: 6 additions & 0 deletions .husky/install.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Skip Husky install in production and CI
if (process.env.NODE_ENV === 'production' || process.env.CI === 'true') {
process.exit(0)
}
const husky = (await import('husky')).default
console.log(husky())
3 changes: 3 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

pnpm --filter @redeem/* pre-push
12 changes: 12 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# By default, pnpm creates a semistrict node_modules, meaning dependencies
# have access to undeclared dependencies but modules outside of node_modules do
# not. With this layout, most of the packages in the ecosystem work with no
# issues. However, if some tooling only works when the hoisted dependencies are
# in the root of node_modules, you can set this to true to hoist them for you.

shamefully-hoist=true

# Excludes module-alias from being hoisted as it must be present in the package
# node_modules for compilation to work properly.

hoist-pattern[]=!module-alias
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v22
Loading

0 comments on commit e85b7f7

Please sign in to comment.