Skip to content

Commit

Permalink
Merge branch 'main' into pr/vezenovm/3
Browse files Browse the repository at this point in the history
* main:
  chore: fix linting
  chore: add CI
  • Loading branch information
TomAFrench committed Apr 23, 2024
2 parents acf1279 + 017a479 commit c3c9a4f
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 7 deletions.
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
14 changes: 7 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ async function run() {
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 @@ -89,15 +89,15 @@ async function run() {
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 Down Expand Up @@ -137,8 +137,8 @@ async function run() {
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

0 comments on commit c3c9a4f

Please sign in to comment.