Skip to content

Commit

Permalink
chore: changesets and pnpm (#1901)
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <timo@animo.id>
  • Loading branch information
TimoGlastra committed Jun 20, 2024
1 parent 34257eb commit 2c7c374
Show file tree
Hide file tree
Showing 66 changed files with 17,533 additions and 12,986 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
13 changes: 13 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.1/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": true,
"privatePackages": false,
"fixed": [["@credo-ts/*"]],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"snapshot": {
"useCalculatedVersion": true
}
}
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"extensions": ["esbenp.prettier-vscode"]
}
},
"postCreateCommand": "yarn install"
"postCreateCommand": "pnpm install"
}
105 changes: 0 additions & 105 deletions .github/workflows/continuous-deployment.yml

This file was deleted.

106 changes: 30 additions & 76 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ name: Continuous Integration

on:
pull_request:
branches: [main, '**-pre']
branches:
- main
- '**-pre'
types: [opened, synchronize, reopened, labeled]
push:
branches: [main, '**-pre']
branches:
- main
- '**-pre'
workflow_dispatch:

env:
Expand Down Expand Up @@ -49,26 +53,30 @@ jobs:
- name: Checkout credo-ts
uses: actions/checkout@v4

- uses: pnpm/action-setup@v2
with:
version: 9.1.0

- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'
cache: 'pnpm'

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

- name: Linting
run: yarn lint
run: pnpm lint

- name: Prettier
run: yarn check-format
run: pnpm check-format

- name: Check Types
run: yarn check-types
run: pnpm check-types

- name: Compile
run: yarn build
run: pnpm build

unit-tests:
runs-on: ubuntu-20.04
Expand All @@ -87,17 +95,21 @@ jobs:
- name: Checkout credo
uses: actions/checkout@v4

- uses: pnpm/action-setup@v2
with:
version: 9.1.0

- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
cache: 'pnpm'

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

- name: Run tests
run: yarn test:unit --coverage --forceExit --shard=${{ matrix.shard }}/2
run: pnpm test:unit --coverage --forceExit --shard=${{ matrix.shard }}/2

# Upload coverage for shard
- run: mv coverage/coverage-final.json coverage/${{ matrix.shard }}.json
Expand All @@ -124,17 +136,21 @@ jobs:
- name: Setup services
run: docker compose up -d

- uses: pnpm/action-setup@v2
with:
version: 9.1.0

- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
cache: 'pnpm'

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

- name: Run tests
run: yarn test:e2e --coverage --forceExit
run: pnpm test:e2e --coverage --forceExit

# Upload coverage for e2e
- run: mv coverage/coverage-final.json coverage/e2e.json
Expand All @@ -157,65 +173,3 @@ jobs:
- uses: codecov/codecov-action@v4
with:
directory: coverage

version-stable:
runs-on: ubuntu-20.04
name: Release stable
needs: [e2e-tests, unit-tests, validate]
if: github.ref == 'refs/heads/main' && github.event_name == 'workflow_dispatch'
steps:
- name: Checkout agent-framework-javascript
uses: actions/checkout@v4
with:
# pulls all commits (needed for lerna to correctly version)
fetch-depth: 0
persist-credentials: false

- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'

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

- name: Git config
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
# Lerna will use the latest tag to determine the latest released version. As we create a tag for each commit
# we need to remove all pre-release tags so we can determine the last stable release
- name: Remove all pre-release tags
run: git tag -l | grep -vE 'v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$' | xargs git tag -d

# no-private is important to not include the internal packages (demo, sample, etc...)
- name: Update version
run: |
export NEXT_VERSION_BUMP=$(./node_modules/.bin/ts-node ./scripts/get-next-bump.ts)
yarn lerna version --conventional-commits --no-git-tag-version --no-push --yes --exact --no-private $NEXT_VERSION_BUMP
- name: Format lerna changes
run: yarn format

- name: Get updated version
id: new-version
run: |
NEW_VERSION=$(node -p "require('./lerna.json').version")
echo $NEW_VERSION
echo version="${NEW_VERSION}" >> "$GITHUB_OUTPUT"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
commit-message: |
chore(release): v${{ steps.new-version.outputs.version }}
author: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>'
committer: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>'
branch: lerna-release
signoff: true
title: |
chore(release): v${{ steps.new-version.outputs.version }}
body: |
Release version ${{ steps.new-version.outputs.version }}
56 changes: 56 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Release

on:
push:
branches:
- main
- '**-pre'

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions:
pull-requests: write
contents: write

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- uses: pnpm/action-setup@v2
with:
version: 9.1.0

- name: Setup Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'pnpm'

- name: Install Dependencies
run: pnpm install --frozen-lockfile

- name: Create Release Pull Request or Publish to npm
if: github.ref == 'refs/heads/main'
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: pnpm build && pnpm changeset publish
commit: 'chore(release): '
title: 'chore(release): '
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH }}

- name: Create unstable release
if: github.ref != 'refs/heads/main' || steps.changesets.outputs.published == 'false'
run: |
pnpm changeset version --snapshot alpha
pnpm changeset publish --tag alpha
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH }}
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
node_modules
build
.vscode
yarn-error.log
.idea
credo-*.tgz
# Keeping this one in for now to prevent accidental
Expand All @@ -10,5 +9,4 @@ aries-framework-*.tgz
coverage
.DS_Store
logs.txt
logs/
lerna-debug.log
logs/
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ Contributions are made pursuant to the Developer's Certificate of Origin, availa
- Non-breaking change PRs are merged earlier into **main**
- Breaking change PRs will go to a branch named **<release-version>-pre (ie. 0.3.0-pre)** and merged later in the release cycle.
- Consider separating your PR into a (usually larger) non-breaking PR and a (usually smaller) breaking change PR.
- Commits and PR titles MUST follow conventional commits (https://www.conventionalcommits.org/en/v1.0.0/). This allows us to automatically determine the next release version and generate changelog files.
- Use conventional commits to mark breaking changes. Adding `!` after the scope of a prefix message (e.g. `chore!: a breaking change`) or adding a **BREAKING CHANGE:** note to commit messages marks a commit as breaking. See examples: https://www.conventionalcommits.org/en/v1.0.0/#examples
- Relevant changes for the changelog must be documented using changesets. See [Changesets](.changeset/README.md) for more info. To add a changelog, run `pnpm changeset` and commit the files afterwards.
Loading

0 comments on commit 2c7c374

Please sign in to comment.