-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.sh
More file actions
30 lines (25 loc) · 1.13 KB
/
test.sh
File metadata and controls
30 lines (25 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
set -e
mkdir -p public
# Get stored artifacts from api-data and unpack into the 'public' directory
wget -q -O '_gen.tar.gz' "$(curl -H "Circle-Token: $CIRCLECI_API_TOKEN_NARAMSIM" -s https://circleci.com/api/v1.1/project/github/PokeAPI/api-data/latest/artifacts?branch=staging | jq -r .[0].url)"
if [ $? -ne 0 ]; then
echo "Couldn't find the latest api-data .tar.gz for the branch staging"
exit 1
fi
tar xzf _gen.tar.gz -C public
# Get stored artifacts from pokeapi.co and unpack into the current directory
wget -q -O 'static_website.tar.gz' "$(curl -H "Circle-Token: $CIRCLECI_API_TOKEN_NARAMSIM" -s https://circleci.com/api/v1.1/project/github/PokeAPI/pokeapi.co/latest/artifacts?branch=staging | jq -r .[0].url)"
if [ $? -ne 0 ]; then
echo "Couldn't find the latest pokeapi.co website .tar.gz for the branch staging"
exit 1
fi
tar xzf static_website.tar.gz -C public
(cd functions_v1 && npm ci)
functions_v1/node_modules/.bin/firebase emulators:start --inspect-functions --project="${FIREBASE_PROJECT_ID_STAGING}" &
V1_PID=$!
sleep 30
curl -f http://localhost:5000/api/v2/
curl -f http://localhost:5000/
kill -9 $V1_PID
exit 0