Merge pull request #633 from xmtp/rygine/optimize-workflows #4
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: JS SDK | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
paths: | |
- 'packages/js-sdk/**' | |
- '.github/workflows/js-sdk.yml' | |
- '.node-version' | |
- '.nvmrc' | |
- '.prettierignore' | |
- '.prettierrc.cjs' | |
jobs: | |
typecheck: | |
name: Typecheck | |
runs-on: warp-ubuntu-latest-x64-8x | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
env: | |
SKIP_YARN_COREPACK_CHECK: '1' | |
- name: Enable corepack | |
run: corepack enable | |
- name: Install dependencies | |
run: yarn | |
- name: Typecheck | |
run: | | |
cd packages/js-sdk | |
yarn typecheck | |
lint: | |
name: Lint | |
runs-on: warp-ubuntu-latest-x64-8x | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
env: | |
SKIP_YARN_COREPACK_CHECK: '1' | |
- name: Enable corepack | |
run: corepack enable | |
- name: Install dependencies | |
run: yarn | |
- name: Lint | |
run: | | |
cd packages/js-sdk | |
yarn lint | |
prettier: | |
name: Prettier | |
runs-on: warp-ubuntu-latest-x64-8x | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
env: | |
SKIP_YARN_COREPACK_CHECK: '1' | |
- name: Enable corepack | |
run: corepack enable | |
- name: Install dependencies | |
run: yarn | |
- name: Format check | |
run: | | |
cd packages/js-sdk | |
yarn format:check | |
node: | |
name: Test node | |
# TODO: Investigate why fetch is failing for some of these tests on warp build runners | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
env: | |
SKIP_YARN_COREPACK_CHECK: '1' | |
- name: Enable corepack | |
run: corepack enable | |
- name: Install dependencies | |
run: yarn | |
- run: ./dev/up | |
- run: | | |
cd packages/js-sdk | |
yarn test:node | |
env: | |
NODE_OPTIONS: '-r dd-trace/ci/init' | |
DD_ENV: ci:node | |
DD_SERVICE: xmtp-js | |
DD_CIVISIBILITY_AGENTLESS_ENABLED: 'true' | |
DD_API_KEY: ${{ secrets.DD_API_KEY }} | |
browser: | |
name: Test browser | |
# TODO: Investigate why fetch is failing for some of these tests on warp build runners | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
env: | |
SKIP_YARN_COREPACK_CHECK: '1' | |
- name: Enable corepack | |
run: corepack enable | |
- name: Install dependencies | |
run: yarn | |
- run: ./dev/up | |
- run: | | |
cd packages/js-sdk | |
yarn test:browser | |
build: | |
name: Build | |
runs-on: warp-ubuntu-latest-x64-8x | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
env: | |
SKIP_YARN_COREPACK_CHECK: '1' | |
- name: Enable corepack | |
run: corepack enable | |
- name: Install dependencies | |
run: yarn | |
- name: Build | |
run: | | |
cd packages/js-sdk | |
yarn build |