Skip to content

Commit

Permalink
Add yarn changesets (#2949)
Browse files Browse the repository at this point in the history
### Description

- monorepo commands will only run for packages which have changed since
baseRef: main

### Drive-by changes

- modify github actions to leverage filtered behavior
- upgrade to yarn 4.0.2

### Related issues

- Fixes hyperlane-xyz/issues#708
- Fixes hyperlane-xyz/issues#374

### Backward compatibility

Yes

### Testing

CI
  • Loading branch information
yorhodes authored Nov 22, 2023
2 parents 8db8fcd + db58ae1 commit ef9c09b
Show file tree
Hide file tree
Showing 9 changed files with 1,902 additions and 426 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)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
75 changes: 15 additions & 60 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0

- uses: actions/setup-node@v3
with:
node-version: 18
Expand All @@ -71,6 +73,10 @@ jobs:
needs: [yarn-install]
steps:
- uses: actions/checkout@v3
with:
# check out full history
fetch-depth: 0

- uses: actions/cache@v3
with:
path: |
Expand All @@ -90,27 +96,25 @@ jobs:
exit 1
fi
test-ts:
test:
runs-on: ubuntu-latest
needs: [yarn-build]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0

- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1

- uses: actions/cache@v3
with:
path: ./*
key: ${{ github.sha }}

- name: sdk
run: yarn workspace @hyperlane-xyz/sdk run test

- name: helloworld
run: yarn workspace @hyperlane-xyz/helloworld run test

- name: infra
run: yarn workspace @hyperlane-xyz/infra run test
- name: Unit Tests
run: yarn test

test-cli:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -152,64 +156,15 @@ jobs:
- name: Test ${{ matrix.environment }} ${{ matrix.module }} deployment (check, deploy, govern, check again)
run: cd typescript/infra && ./fork.sh ${{ matrix.environment }} ${{ matrix.module }}

test-sol:
env:
ETHERSCAN_API_KEY: ''

coverage:
runs-on: ubuntu-latest
needs: [yarn-build]

steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ./*
key: ${{ github.sha }}

- name: yarn-cache
uses: actions/cache@v3
with:
path: |
**/node_modules
.yarn/cache
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('./yarn.lock') }}

- name: Install Foundry
uses: onbjerg/foundry-toolchain@v1

- name: Install dependencies
run: cd solidity && forge install

- name: Forge build
run: cd solidity && forge build --build-info

#- name: gas
# run: yarn workspace @hyperlane-xyz/core run gas-ci

- name: Unit tests
run: yarn workspace @hyperlane-xyz/core run test

- name: Static analysis
uses: crytic/slither-action@v0.3.0
id: slither
with:
target: 'solidity/'
slither-config: 'solidity/slither.config.json'
sarif: results.sarif
fail-on: none
ignore-compile: true
fetch-depth: 0

- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: ${{ steps.slither.outputs.sarif }}

coverage-sol:
runs-on: ubuntu-latest
needs: [yarn-build]

steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ./*
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release

on:
push:
branches:
- main

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

jobs:
release:
permissions:
id-token: write
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
# check out full history
fetch-depth: 0
submodules: recursive

- name: Setup Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Install Dependencies
run: yarn

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: yarn build && yarn publish:all
env:
NPM_CONFIG_PROVENANCE: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
41 changes: 41 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: static-analysis

on:
# Triggers the workflow on pull request against main
pull_request:
branches: [main]
paths:
- 'solidity/**'

jobs:
slither:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: yarn-cache
uses: actions/cache@v3
with:
path: |
**/node_modules
.yarn/cache
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('./yarn.lock') }}

- run: yarn workspaces focus @hyperlane-xyz/core

- name: Static analysis
uses: crytic/slither-action@v0.3.0
id: slither
with:
target: 'solidity/'
slither-config: 'solidity/slither.config.json'
sarif: results.sarif
fail-on: none

- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: ${{ steps.slither.outputs.sarif }}
670 changes: 335 additions & 335 deletions .yarn/releases/yarn-4.0.1.cjs → .yarn/releases/yarn-4.0.2.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-outdated.cjs
spec: "https://mskelton.dev/yarn-outdated/v3"

yarnPath: .yarn/releases/yarn-4.0.1.cjs
yarnPath: .yarn/releases/yarn-4.0.2.cjs
21 changes: 12 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,22 @@
"lint-staged": "^12.4.3",
"prettier": "^2.8.8"
},
"packageManager": "yarn@4.0.1",
"dependencies": {
"@changesets/cli": "^2.26.2"
},
"packageManager": "yarn@4.0.2",
"private": true,
"scripts": {
"build": "yarn workspaces foreach --all --parallel --topological run build",
"clean": "yarn workspaces foreach --all --parallel run clean",
"prettier": "yarn workspaces foreach --all --parallel run prettier",
"lint": "yarn workspaces foreach --all --parallel run lint",
"test": "yarn workspaces foreach --all --parallel run test",
"coverage": "yarn workspaces foreach --all --parallel run coverage",
"version:prepare": "yarn workspaces foreach --all --no-private --topological version --immediate",
"publish:all": "yarn workspaces foreach --all --no-private --topological npm publish --access public",
"postinstall": "husky install",
"version:check": "yarn version check --interactive"
"prettier": "yarn workspaces foreach --since --parallel run prettier",
"lint": "yarn workspaces foreach --since --parallel run lint",
"test": "yarn workspaces foreach --since --parallel run test",
"coverage": "yarn workspaces foreach --since --parallel run coverage",
"version:prepare": "yarn changeset version",
"version:check": "yarn changeset status",
"publish:all": "yarn changeset publish",
"postinstall": "husky install"
},
"workspaces": [
"solidity",
Expand Down
Loading

0 comments on commit ef9c09b

Please sign in to comment.