mirror of
https://github.com/status-im/sourcecred.git
synced 2025-01-10 04:36:25 +00:00
6415da7bc8
scripts/update_snapshots.sh is intended as a general-purpose snapshot updater for SourceCred. Currently, it includes updating Discourse snapshots, but only if an obsolete Discourse API key is present. Updating Discourse snapshots is very noisy, because the API responses are not stable (they include the view count, which increments when making API requests). Also, most times when we want to update our snapshots, it's because we changed some core data structure, not because we actually want new data from Discourse. Therefore, we should disconnect the Discourse snapshot update process from the general snapshot updating script. Test plan: Run `./scripts/update_snapshots.sh` and verify that it does not produce Discourse update churn. Run `./src/plugins/discourse/update_discourse_api_snapshots.sh` and verify that it does update all the Discourse snapshots.
43 lines
1.3 KiB
Bash
Executable File
43 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# Automatically update SourceCred snapshot data.
|
|
# This deliberately does not update Discourse API snapshots,
|
|
# because they are very noisy. If you want to update Discourse
|
|
# snapshots, run ./src/plugins/discourse/update_discourse_api_snapshots.sh
|
|
|
|
set -eu
|
|
|
|
toplevel="$(git -C "$(dirname "$0")" rev-parse --show-toplevel)"
|
|
cd "${toplevel}"
|
|
|
|
tmpdir="$(mktemp -d)"
|
|
cleanup() {
|
|
rm -r "${tmpdir}"
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
SOURCECRED_BIN="${tmpdir}/bin"
|
|
yarn run --silent backend --output-path "${SOURCECRED_BIN}"
|
|
export SOURCECRED_BIN # for Sharness and shell tests
|
|
export NODE_PATH="${toplevel}/node_modules${NODE_PATH:+:${NODE_PATH}}"
|
|
|
|
echo "Updating GitHub GraphQL Flow types"
|
|
cp .prettierrc.json "${SOURCECRED_BIN}/"
|
|
node "${SOURCECRED_BIN}/generateGithubGraphqlFlowTypes.js" \
|
|
>src/plugins/github/graphqlTypes.js
|
|
|
|
echo "Updating sharness/test_load_example_github.t"
|
|
(cd sharness; UPDATE_SNAPSHOT=1 ./test_load_example_github.t -l)
|
|
|
|
echo "Updating sharness/test_cli_scores.t"
|
|
(cd sharness; UPDATE_SNAPSHOT=1 ./test_cli_scores.t -l)
|
|
|
|
echo "Updating github/fetchGithubOrgTest.sh"
|
|
./src/plugins/github/fetchGithubOrgTest.sh -u --no-build
|
|
|
|
echo "Updating github/fetchGithubRepoTest.sh"
|
|
./src/plugins/github/fetchGithubRepoTest.sh -u --no-build
|
|
|
|
echo "Updating Jest snapshots"
|
|
yarn unit -u
|