Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
YassinEldeeb committed Jul 19, 2024
1 parent 53028a2 commit 83c4539
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ jobs:
shell: bash

- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.settings.target }}
path: packages/napi-utils/${{ env.APP_NAME }}.*.node
Expand Down Expand Up @@ -236,7 +236,7 @@ jobs:
working-directory: packages/napi-utils

- name: Download all artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: packages/napi-utils/artifacts

Expand Down
26 changes: 25 additions & 1 deletion packages/cli/src/commands/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import path from 'path'
import { filesystem } from 'gluegun'
import yaml from 'js-yaml'
// This'd import the N-API bindings based on the OS and architecture
import { runTests } from '@graphprotocol/graph-tooling-napi-utils/mod/testing'
import { Args, Command, Flags } from '@oclif/core'
import { execSync } from 'child_process'

export default class TestCommand extends Command {
static description = 'Runs rust binary for subgraph testing.';
Expand Down Expand Up @@ -46,6 +46,28 @@ export default class TestCommand extends Command {
flags: { coverage, force, logs, recompile, version },
} = await this.parse(TestCommand)

// Ensure PostgreSQL 14 is installed
try {
const versionOutput = execSync('psql --version').toString()
const versionMatch = versionOutput.match(/\b14\.\d+/)
if (!versionMatch) {
this.error(`PostgreSQL version 14 is required. Detected version: ${versionOutput}`, {
exit: 1,
})
}
} catch (error) {
this.error(`PostgreSQL version 14 is required. It seems PostgreSQL is not installed.\n
To install PostgreSQL 14:\n
On Linux (Ubuntu/Debian based):
sudo apt update
sudo apt install -y postgresql-14
On macOS:
brew install postgresql@14`, {
exit: 1,
})
}

let testsDir = './tests'

// Check if matchstick.yaml config exists
Expand Down Expand Up @@ -113,6 +135,8 @@ async function runNapi(
if (datasource) args.push(datasource)

try {
// Dynamically import runTests only after PostgreSQL check
const { runTests } = await import('@graphprotocol/graph-tooling-napi-utils/mod/testing')
// Call the N-API function
runTests(args)
} catch (error) {
Expand Down

0 comments on commit 83c4539

Please sign in to comment.