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

chore: add CI #4

Merged
merged 2 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Install Yarn dependencies
description: Installs the workspace's yarn dependencies and caches them

runs:
using: composite
steps:
- uses: actions/setup-node@v4
id: node
with:
node-version: 18.19.0
cache: 'yarn'
cache-dependency-path: 'yarn.lock'

- name: Install
run: yarn --immutable
shell: bash
28 changes: 28 additions & 0 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Formatting

on:
pull_request:
push:
branches:
- master

# This will cancel previous runs when a branch or PR is updated
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }}
cancel-in-progress: true

jobs:
eslint:
name: eslint
runs-on: ubuntu-latest
timeout-minutes: 30

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

- name: Install Yarn dependencies
uses: ./.github/actions/setup

- name: Run `yarn lint`
run: yarn lint
28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Tests

on:
pull_request:
push:
branches:
- master

# This will cancel previous runs when a branch or PR is updated
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref || github.run_id }}
cancel-in-progress: true

jobs:
test:
name: Integration Tests (Node)
runs-on: ubuntu-latest
timeout-minutes: 30

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

- name: Install Yarn dependencies
uses: ./.github/actions/setup

- name: Run `yarn test`
run: yarn test
19 changes: 8 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
try {
// Upload the gates report to be used as a reference in later runs.
await uploadArtifact();
} catch (error: any) {
return core.setFailed(error.message);
} catch (error) {
return core.setFailed((error as Error).message);
}

// cannot use artifactClient because downloads are limited to uploads in the same workflow run
Expand Down Expand Up @@ -88,15 +88,15 @@
archive_format: "zip",
});

const zip = new Zip(Buffer.from(res.data as any));
const zip = new Zip(Buffer.from(res.data as ArrayBuffer));
for (const entry of zip.getEntries()) {
core.info(`Loading gas reports from "${entry.entryName}"`);
referenceContent = zip.readAsText(entry);
}
core.endGroup();
} else core.error(`No workflow run found with an artifact named "${baseReport}"`);
} catch (error: any) {
return core.setFailed(error.message);
} catch (error) {
return core.setFailed((error as Error).message);
}
}

Expand All @@ -113,10 +113,7 @@
core.endGroup();

core.startGroup("Compute gas diff");
const diffRows = computeProgramDiffs(
referenceReports.programs[0].functions,
compareReports.programs[0].functions
);
const diffRows = computeProgramDiffs(referenceReports.programs, compareReports.programs);

Check failure on line 116 in src/index.ts

View workflow job for this annotation

GitHub Actions / check-dist

Argument of type 'ProgramReport[]' is not assignable to parameter of type 'CircuitReport[]'.
core.info(`Format markdown of ${diffRows.length} diffs`);
const markdown = formatMarkdownDiff(
header,
Expand All @@ -136,8 +133,8 @@
core.setOutput("shell", shell);
core.setOutput("markdown", markdown);
}
} catch (error: any) {
core.setFailed(error.message);
} catch (error) {
core.setFailed((error as Error).message);
}
}

Expand Down
Loading