Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move hyperdrive-wasm into repo #1026

Merged
merged 14 commits into from
May 1, 2024
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
"ignore": ["!@delvtech/*"]
}
52 changes: 52 additions & 0 deletions .github/workflows/build_wasm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: build wasm package

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main
release:
types: [published]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
detect-changes:
uses: ./.github/workflows/check_diff.yml
with:
pattern: ^crates/hyperdrive-wasm/

build:
needs: detect-changes
# Run if changes are detected OR if triggered by a release
if: (needs.detect-changes.outputs.changed == 'true') || (github.event_name == 'release' && startsWith(github.ref, 'refs/tags/hyperdrive-wasm@v'))
name: build
runs-on: ubuntu-latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
token: ${{github.token}}

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: "https://registry.npmjs.org"

- name: setup foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: build hyperdrive-wasm
working-directory: crates/hyperdrive-wasm
run: sh scripts/build.sh

- name: publish hyperdrive-wasm
if: github.event_name == 'release'
working-directory: packages/hyperdrive-wasm
run: npm publish --access public
36 changes: 36 additions & 0 deletions .github/workflows/check_diff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Check Diff

on:
workflow_call:
inputs:
pattern:
description: Pattern to check
required: true
type: string
outputs:
changed:
description: true if the files matching the pattern have changed
value: ${{ jobs.check.outputs.changed }}

jobs:
check:
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.check.outputs.changed }}
steps:
- uses: actions/checkout@v3
with:
# Important to diff against the base branch
fetch-depth: 2
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}

- name: Check for changes
id: check
run: |
FILES_CHANGED=$(git diff --name-only ${{ github.event.pull_request.base.sha }} HEAD)
if echo "$FILES_CHANGED" | grep -m 1 "${{ inputs.pattern }}"; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
31 changes: 0 additions & 31 deletions .github/workflows/format.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/lint.yml

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Pull Request

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
verify:
runs-on: ubuntu-latest
strategy:
matrix:
task: [format, lint, typecheck, test]
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'

# Required for hyperdrive-wasm
- name: setup foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

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

- name: Run ${{ matrix.task }}
run: yarn ${{ matrix.task }}
34 changes: 0 additions & 34 deletions .github/workflows/test.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/typecheck.yml

This file was deleted.

6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,8 @@ yarn-error.log*
.turbo

# parcel
.parcel-cache
.parcel-cache

# rust
target
packages/hyperdrive-wasm
Loading
Loading