From b86960af6afe33cf7a6d703fa3b35e1ced877654 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Sat, 15 Jun 2024 10:30:32 -0500 Subject: [PATCH] Optimize CI workflows --- .github/workflows/build.yml | 25 --- .github/workflows/js-sdk.yml | 144 ++++++++++++++++++ .../workflows/{lint.yml => mls-client.yml} | 49 +++++- .github/workflows/release.yml | 3 +- .github/workflows/test.yml | 49 ------ 5 files changed, 188 insertions(+), 82 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/js-sdk.yml rename .github/workflows/{lint.yml => mls-client.yml} (54%) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 39a74449..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Build -on: - push: - branches: - - main - pull_request: - -jobs: - build: - name: Build - 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 - - name: Build - run: yarn build diff --git a/.github/workflows/js-sdk.yml b/.github/workflows/js-sdk.yml new file mode 100644 index 00000000..ee9df55b --- /dev/null +++ b/.github/workflows/js-sdk.yml @@ -0,0 +1,144 @@ +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 diff --git a/.github/workflows/lint.yml b/.github/workflows/mls-client.yml similarity index 54% rename from .github/workflows/lint.yml rename to .github/workflows/mls-client.yml index dd4f3be0..460ce5e2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/mls-client.yml @@ -1,14 +1,23 @@ -name: Code checks +name: MLS Client + on: push: branches: - main + pull_request: + paths: + - 'packages/mls-client/**' + - '.github/workflows/mls-client.yml' + - '.node-version' + - '.nvmrc' + - '.prettierignore' + - '.prettierrc.cjs' jobs: typecheck: name: Typecheck - runs-on: ubuntu-latest + runs-on: warp-ubuntu-latest-x64-8x steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -22,11 +31,13 @@ jobs: - name: Install dependencies run: yarn - name: Typecheck - run: yarn typecheck + run: | + cd packages/mls-client + yarn typecheck lint: name: Lint - runs-on: ubuntu-latest + runs-on: warp-ubuntu-latest-x64-8x steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -40,11 +51,13 @@ jobs: - name: Install dependencies run: yarn - name: Lint - run: yarn lint + run: | + cd packages/mls-client + yarn lint prettier: name: Prettier - runs-on: ubuntu-latest + runs-on: warp-ubuntu-latest-x64-8x steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -58,4 +71,26 @@ jobs: - name: Install dependencies run: yarn - name: Format check - run: yarn format:check + run: | + cd packages/mls-client + yarn format:check + + 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/mls-client + yarn build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 87995542..d34dc08b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,10 @@ name: Release + on: push: branches: - main - - releases/beta + - releases/** concurrency: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 68a7a72a..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Test -on: - push: - branches: - - main - pull_request: - -jobs: - node: - name: node - 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: 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: happy-dom - 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: yarn test:browser