From a1723718a7f3db7f79efd9930eabc6f1aa9f5fa6 Mon Sep 17 00:00:00 2001 From: Ed Spencer Date: Thu, 22 Aug 2024 16:33:09 -0400 Subject: [PATCH] Consolidate CI test/release workflow --- .changeset/blue-dancers-jump.md | 5 +++++ .github/workflows/release.yml | 38 +++++++++++++++++++++++++++++---- .github/workflows/test.yml | 32 --------------------------- 3 files changed, 39 insertions(+), 36 deletions(-) create mode 100644 .changeset/blue-dancers-jump.md delete mode 100644 .github/workflows/test.yml diff --git a/.changeset/blue-dancers-jump.md b/.changeset/blue-dancers-jump.md new file mode 100644 index 0000000..092e273 --- /dev/null +++ b/.changeset/blue-dancers-jump.md @@ -0,0 +1,5 @@ +--- +"inform-ai": patch +--- + +CI changes diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9b97575..1372081 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,16 +1,47 @@ -name: Release +name: Test and Release on: push: branches: - - main + - '**' # Runs on all branches -concurrency: ${{ github.workflow }}-${{ github.ref }} +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: + test: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x, 20.x, 22.x] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + with: + version: 9.7.0 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: "pnpm" + + - name: Install dependencies + run: pnpm install + + - name: Run tests + run: npx jest + release: name: Release runs-on: ubuntu-latest + needs: test + if: github.ref == 'refs/heads/main' # Only run this job on the main branch steps: - name: Checkout Repo uses: actions/checkout@v4 @@ -33,7 +64,6 @@ jobs: id: changesets uses: changesets/action@v1 with: - # This expects you to have a script called release which does a build for your packages and calls changeset publish publish: npm run ci:publish env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 644a39a..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Run Jest Tests - -on: - push: # Runs on all pushes - -jobs: - test: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [18.x, 20.x, 22.x] - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - uses: pnpm/action-setup@v2 - with: - version: 9.5.0 - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: "pnpm" - - - name: Install dependencies - run: pnpm install - - - name: Run tests - run: npx jest