From 91d2481593a7904fee3404e971ee79458f9d0094 Mon Sep 17 00:00:00 2001 From: Binoy Patel Date: Thu, 30 Nov 2023 15:13:33 -0500 Subject: [PATCH] test(ci): move cli test to separate workflow without sharding (#5292) * test(ci): move cli test to separate workflow without sharding * test(cli): re-enable cli tests --- .github/workflows/cli-test.yml | 67 ++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 4 +- 2 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/cli-test.yml diff --git a/.github/workflows/cli-test.yml b/.github/workflows/cli-test.yml new file mode 100644 index 00000000000..b3486226a8c --- /dev/null +++ b/.github/workflows/cli-test.yml @@ -0,0 +1,67 @@ +name: CLI Unit tests + +on: + # Build on pushes branches that have a PR (including drafts) + pull_request: + # Build on commits pushed to branches without a PR if it's in the allowlist + push: + branches: [next] + +jobs: + cli-test: + timeout-minutes: 60 + name: CLI Tests (${{ matrix.os }} / node ${{ matrix.node }}) + runs-on: ${{ matrix.os }} + env: + TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} + TURBO_TEAM: ${{ vars.TURBO_TEAM }} + continue-on-error: ${{ matrix.experimental }} + + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + node: [18, 20] + experimental: [false] + # include: + # - os: windows-latest + # node: 16 + # experimental: true + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + + - name: Cache node modules + id: cache-node-modules + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + path: '**/node_modules' + key: ${{ runner.os }}-modules-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-modules-${{ env.cache-name }}- + ${{ runner.os }}-modules- + ${{ runner.os }}- + + - name: Install project dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' + run: yarn install --frozen-lockfile + + - name: Build CLI + run: yarn build:cli # Needed for CLI tests + + - name: Test + id: test + run: | + node -v + npm -v + yarn test --silent --selectProjects=@sanity/cli + env: + SANITY_CI_CLI_AUTH_TOKEN: ${{ secrets.SANITY_CI_CLI_AUTH_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c68e2a81967..bfd8f784830 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -133,10 +133,8 @@ jobs: run: | node -v npm -v - yarn test --silent --shard=${{ matrix.shardIndex}}/${{ matrix.shardTotal }} + yarn test --silent --shard=${{ matrix.shardIndex}}/${{ matrix.shardTotal }} --ignoreProjects=@sanity/cli env: - # FIXME: re-enable CLI tests with this - # SANITY_CI_CLI_AUTH_TOKEN: ${{ secrets.SANITY_CI_CLI_AUTH_TOKEN }} GITHUB_SHARD_IDENTIFIER: ${{ matrix.shardIndex }}-${{ matrix.shardTotal }} cleanup: