Skip to content

Commit

Permalink
Tests running on ci (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanmino authored Mar 6, 2024
1 parent 3132f0d commit d0909b2
Show file tree
Hide file tree
Showing 6 changed files with 218 additions and 17 deletions.
36 changes: 23 additions & 13 deletions .github/workflows → .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@ on:
pull_request:
merge_group:
push:
branches: [main]
workflow_dispatch:

branches:
- main
jobs:
# INSTALL DEPS
install:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -25,6 +21,13 @@ jobs:
run: yarn
- name: Check for frozen lockfile
run: yarn check-lockfile
- name: Zip node_modules
run: tar czf node_modules.tar.gz node_modules/
- name: Upload deps artifacts
uses: actions/upload-artifact@v3
with:
name: node_modules.tar.gz
path: node_modules.tar.gz

# TEST
test:
Expand All @@ -35,14 +38,15 @@ jobs:
DISPLAY: :0
VITEST_SEGFAULT_RETRY: 3
steps:
- name: Run tests
continue-on-error: true
uses: actions/setup-node@v3
- uses: actions/checkout@v3
- name: Download deps cache artifacts
uses: actions/download-artifact@v3
with:
node-version: "18.18.0"
timeout_minutes: 25
max_attempts: 2
command: yarn test
name: node_modules.tar.gz
- name: Unzip node_modules
run: tar xzf node_modules.tar.gz
- name: Run tests
run: yarn test

# LINT, TYPECHECK, AUDIT
ci-checks:
Expand All @@ -53,6 +57,12 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: "18.18.0"
- name: Download deps cache artifacts
uses: actions/download-artifact@v3
with:
name: node_modules.tar.gz
- name: Unzip node_modules
run: tar xzf node_modules.tar.gz
- name: Lint
run: yarn lint
- name: Audit CI
Expand Down
7 changes: 7 additions & 0 deletions audit-ci.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// audit-ci.jsonc
{
// $schema provides code completion hints to IDEs.
"$schema": "https://github.com/IBM/audit-ci/raw/main/docs/schema.json",
"moderate": true,
"allowlist": []
}
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rainbow-me/provider",
"version": "0.0.4",
"version": "0.0.5",
"main": "dist/index.js",
"license": "MIT",
"files": [
Expand All @@ -10,12 +10,16 @@
"build": "tsc",
"test": "vitest",
"lint": "eslint --cache --max-warnings 0",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"check-lockfile": "./scripts/check-lockfile.sh",
"audit:ci": "yarn audit-ci --moderate --config audit-ci.jsonc"
},
"type": "module",
"module": "dist/index.js",
"devDependencies": {
"@typescript-eslint/eslint-plugin": "6.20.0",
"@typescript-eslint/parser": "6.20.0",
"audit-ci": "6.6.1",
"eslint": "8.56.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-prettier": "5.1.3",
Expand Down
5 changes: 5 additions & 0 deletions scripts/check-lockfile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
git diff yarn.lock
if ! git diff --exit-code yarn.lock; then
echo "Changes were detected in yarn.lock file after running 'yarn', which is not expected. Please run 'yarn' locally and commit the changes.";
exit 1;
fi
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export { RainbowProvider } from './RainbowProvider';
export { handleProviderRequest } from './handleProviderRequest';
export { IMessageSender } from './references/messengers';
export { AddEthereumChainProposedChain } from './references/chains';
export { RequestArguments, RequestResponse } from './references/messengers';
Loading

0 comments on commit d0909b2

Please sign in to comment.