Skip to content

Commit

Permalink
add scripts to publish
Browse files Browse the repository at this point in the history
  • Loading branch information
plusminushalf committed Jun 4, 2024
1 parent baa938e commit 9056d23
Show file tree
Hide file tree
Showing 9 changed files with 1,640 additions and 33 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/[email protected]/schema.json",
"changelog": "@changesets/changelog-git",
"commit": false,
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true
}
}
37 changes: 37 additions & 0 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release (Canary)
on:
push:
workflow_dispatch:

jobs:
canary:
name: Release canary
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Setup .npmrc file
uses: actions/setup-node@v3
with:
registry-url: 'https://registry.npmjs.org'

- name: Set alto version
run: |
jq --arg prop "workspaces" 'del(.[$prop])' package.json > package.tmp.json && rm package.json && cp package.tmp.json package.json && rm package.tmp.json
cd packages/alto
npm --no-git-tag-version version 0.0.0
npm --no-git-tag-version version $(npm pkg get version | sed 's/"//g')-$(git branch --show-current | tr -cs '[:alnum:]-' '-' | tr '[:upper:]' '[:lower:]' | sed 's/-$//').$(date +'%Y%m%dT%H%M%S')
- name: Build
run: pnpm run build

- name: Publish alto to npm
run: cd packages/alto && npm publish --tag $(git branch --show-current | tr -cs '[:alnum:]-' '-' | tr '[:upper:]' '[:lower:]' | sed 's/-$//')
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ORG_PIMLICO_TOKEN }}
30 changes: 15 additions & 15 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,32 @@ name: Run E2E Tests
on:
push:
branches:
- main
- main
pull_request:
branches:
- main
- main

jobs:
docker-e2e:
timeout-minutes: 10
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
uses: ./.github/actions/install-dependencies
- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Install test dependencies
run: cd test/e2e && pnpm install .
- name: Install test dependencies
run: cd test/e2e && pnpm install .

- name: Start Docker
run: docker compose -f "test/e2e/docker-compose.yml" up -d
- name: Start Docker
run: docker compose -f "test/e2e/docker-compose.yml" up -d

- name: Start tests
run: cd test/e2e && pnpm run test:ci
- name: Start tests
run: cd packages/test-e2e && pnpm run test:ci

- name: Stop containers
if: always()
run: docker compose -f "test/e2e/docker-compose.yml" down
- name: Stop containers
if: always()
run: docker compose -f "test/e2e/docker-compose.yml" down
4 changes: 2 additions & 2 deletions .github/workflows/kinto-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: pnpm install && pnpm build

- name: Install test dependencies
run: cd test/kinto-e2e && pnpm install .
run: cd packages/tests-kinto-e2e && pnpm install .

- name: Start tests
run: cd test/kinto-e2e && pnpm run test
run: cd packages/tests-kinto-e2e && pnpm run test
20 changes: 20 additions & 0 deletions .github/workflows/on-push-to-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Main
on:
push:
branches: [main]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build
uses: ./.github/workflows/verify.yaml
secrets: inherit

test:
name: Test E2W
uses: ./.github/workflows/tests-e2e.yaml
secrets: inherit
114 changes: 114 additions & 0 deletions .github/workflows/verify.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Verify
on:
workflow_call:
workflow_dispatch:

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Lint code
run: bun format && bun lint:fix

- uses: stefanzweifel/git-auto-commit-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commit_message: 'chore: format'
commit_user_name: 'github-actions[bot]'
commit_user_email: 'github-actions[bot]@users.noreply.github.com'

build:
name: Build
needs: lint
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Build
run: bun run build

types:
if: false
name: Types
needs: lint
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
typescript-version: ['5.0.4', 'latest']

steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- run: bun i -d typescript@${{ matrix.typescript-version }}

- name: Build contracts
shell: bash
run: bun run contracts:build

- name: Check types
run: bun run typecheck

- name: Test types
run: bun run test:typecheck
env:
VITE_ANVIL_BLOCK_NUMBER: ${{ vars.VITE_ANVIL_BLOCK_NUMBER }}

test:
if: false
name: Test
runs-on: ubuntu-latest
strategy:
max-parallel: 3
matrix:
transport-mode: ['http', 'webSocket']
shard: [1, 2, 3]
total-shards: [3]
steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Build contracts
shell: bash
run: bun run contracts:build

- name: Run tests
uses: nick-fields/retry@v2
with:
timeout_minutes: 10
max_attempts: 3
command: bun run test:ci --shard=${{ matrix.shard }}/${{ matrix.total-shards }}
env:
VITE_ANVIL_BLOCK_NUMBER: ${{ vars.VITE_ANVIL_BLOCK_NUMBER }}
VITE_ANVIL_BLOCK_TIME: ${{ vars.VITE_ANVIL_BLOCK_TIME }}
VITE_ANVIL_FORK_URL: ${{ secrets.VITE_ANVIL_FORK_URL }}
VITE_BATCH_MULTICALL: ${{ matrix.multicall }}
VITE_NETWORK_TRANSPORT_MODE: ${{ matrix.transport-mode }}

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@
"start": "node src/lib/cli/alto.js run",
"dev": "pnpm -r run dev",
"test": "pnpm -r --workspace-concurrency 1 test --verbose=true",
"test:spec": "./test/spec-tests/run-spec-tests.sh",
"test:spec": "./packages/spec-tests/run-spec-tests.sh",
"lint": "biome check .",
"lint:fix": "pnpm run lint --apply",
"format": "biome format . --write"
"format": "biome format . --write",
"changeset": "changeset",
"changeset:release": "pnpm run build && changeset publish",
"changeset:version": "changeset version && pnpm install --lockfile-only"

},
"devDependencies": {
"@biomejs/biome": "^1.5.1",
Expand All @@ -31,7 +35,10 @@
"nyc": "^15.1.0",
"rome": "^12.1.3",
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
"typescript": "^5.3.3",
"@changesets/changelog-git": "^0.1.14",
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.2"
},
"private": true,
"engines": {
Expand Down
Loading

0 comments on commit 9056d23

Please sign in to comment.