Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: ci for v1 #111

Merged
merged 3 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions .github/workflows/pr-check-v1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: CI

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/v1' }}

on:
pull_request:
branches:
- v1

jobs:
setup:
name: Setup
runs-on: ubuntu-20.04

steps:
- name: Load current commit
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}

- name: Setup Node.js
uses: volta-cli/action@v4

- name: Restore cache
uses: actions/cache@v3
id: yarn-cache
if: github.event_name == 'pull_request' || github.event_name == 'push'
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}


- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: |
yarn --frozen-lockfile --no-progress

static-checks:
name: Static checks
needs: setup
runs-on: ubuntu-20.04

steps:
- name: Load current commit
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}

- name: Setup Node.js
uses: volta-cli/action@v4

- name: Restore cache
uses: actions/cache@v3
id: yarn-cache
if: github.event_name == 'pull_request' || github.event_name == 'push'
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}


- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: |
yarn --frozen-lockfile --no-progress

- name: Prettier check
run: yarn prettier:check

- name: Linter
run: yarn lint

- name: Type check
run: yarn typecheck

tests:
name: Unit tests
needs: setup
runs-on: ubuntu-20.04

steps:
- name: Load current commit
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}

- name: Setup Node.js
uses: volta-cli/action@v4

- name: Restore cache
uses: actions/cache@v3
id: yarn-cache
if: github.event_name == 'pull_request' || github.event_name == 'push'
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}


- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: |
yarn --frozen-lockfile --no-progress

- name: Run unit tests
run: yarn test
74 changes: 74 additions & 0 deletions .github/workflows/release-v1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Publish package

on:
push:
tags:
- v1.*.*

jobs:
publish-to-npm:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
scope: ${{ github.repository_owner }}

- name: Update package.json
run: |
TAG_NAME=${GITHUB_REF/refs\/tags\//}
PACKAGE_VERSION=${TAG_NAME#v}
echo "Updating package.json to version $PACKAGE_VERSION"
cat <<< $(jq -r ".version=\"$PACKAGE_VERSION\"" package.json) > package.json
cat package.json

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Build
run: yarn build

- name: Publish
run: yarn publish
working-directory: dist
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

publish-to-github:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://npm.pkg.github.com'
scope: ${{ github.repository_owner }}

- name: Update package.json
run: |
TAG_NAME=${GITHUB_REF/refs\/tags\//}
PACKAGE_VERSION=${TAG_NAME#v}
echo "Updating package.json to version $PACKAGE_VERSION"
cat <<< $(jq -r ".version=\"$PACKAGE_VERSION\"" package.json) > package.json
cat package.json

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Build
run: yarn build

- name: Publish
run: yarn publish
working-directory: dist
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export default {
transformIgnorePatterns: [
// "/node_modules/",
// "\\.pnp\\.[^\\/]+$",
'node_modules/.pnpm/(?!axios)'
'<rootDir>/node_modules/.pnpm/(?!(axios|@1inch\\+limit-order-sdk)@)',
]

// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"compilerOptions": {
"target": "ES2021",
"lib": ["ES2021"],
"module": "ESNext",
"moduleResolution": "Node",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
Expand Down
Loading