Skip to content

Commit

Permalink
fix: update packages and rebuild deps on startup (#231)
Browse files Browse the repository at this point in the history
* fix: update packages and rebuild deps on startup

* fix: add back crash reporting
  • Loading branch information
smrz2001 authored Feb 8, 2024
1 parent 99bc5cb commit 91ce457
Show file tree
Hide file tree
Showing 5 changed files with 1,842 additions and 641 deletions.
5 changes: 5 additions & 0 deletions ci/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,9 @@ echo "INFO: Sleeping for ${SLEEP}s"
sleep ${SLEEP} # Give time for services to finish starting up before starting tests
npm run test:ci

exit_code=$?;
if [ $exit_code != 0 ]; then
node report-exit.js;
fi

exec "$@"
46 changes: 46 additions & 0 deletions ci/report-exit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import {
generateDiscordCloudwatchLogUrl,
listECSTasks,
sendDiscordNotification,
} from './helpers.js'

const main = async () => {
try {
const taskArns = await listECSTasks()
console.log('INFO: listECSTasks taskArns:=', taskArns)
let logUrls = generateDiscordCloudwatchLogUrl()
if (logUrls.length < 1) {
logUrls = ['No log Urls found']
}

const message = [
{
title: 'Tests Exited',
description: `Run Id: ${process.env.RUN_ID}`,
color: 16711712,
fields: [
{
name: 'Configuration',
value: `${process.env.NODE_ENV}`
},
{
name: 'Logs',
value: `${logUrls}`
}
]
}
]
const data = { embeds: message, username: 'jest-reporter' }
const testFailuresUrl = process.env.DISCORD_WEBHOOK_URL_TEST_FAILURES
const testResultsUrl = process.env.DISCORD_WEBHOOK_URL_TEST_RESULTS

const retryDelayMs = 300000 // 300k ms = 5 mins
sendDiscordNotification(testFailuresUrl, data, retryDelayMs)
sendDiscordNotification(testResultsUrl, data, retryDelayMs)
} catch (err) {
console.error(err)
process.exit(1)
}
}

main()
17 changes: 9 additions & 8 deletions ci/update.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

set -e
set -ex

deps=$(jq -r '.dependencies | keys | .[]' package.json)
filtered_deps=''
Expand All @@ -27,14 +27,15 @@ do
esac
done

cmd="npm install --ignore-scripts $filtered_deps"
echo "$cmd"
$cmd
npm install --ignore-scripts $filtered_deps

# We have to repeat this step after updating dependencies
cmd="npm run postinstall -prefix ./node_modules/go-ipfs"
echo "$cmd"
$cmd
npm run postinstall -prefix ./node_modules/go-ipfs
npm rebuild bcrypto
npm rebuild loady
npm rebuild node-jq
npm rebuild sqlite3

npm run build

echo "Updated versions of dependencies:"
jq -r '.dependencies' package.json
Loading

0 comments on commit 91ce457

Please sign in to comment.