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

fix: update packages and rebuild deps on startup #231

Merged
merged 2 commits into from
Feb 8, 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
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
Loading