Skip to content

Commit 013582a

Browse files
authored
chore: Cleaning up package verification scripts (#822)
* chore: Cleaning up package verification scripts * Added package metadata to test package.json file
1 parent 4974d00 commit 013582a

File tree

4 files changed

+32
-208
lines changed

4 files changed

+32
-208
lines changed

verifyReleaseTarball.sh renamed to .github/scripts/verify_package.sh

+20-22
Original file line numberDiff line numberDiff line change
@@ -21,55 +21,53 @@
2121
# applications.
2222

2323
set -e
24+
set -u
2425

2526
if [ -z "$1" ]; then
2627
echo "[ERROR] No package name provided."
27-
echo "[INFO] Usage: ./verifyReleaseTarball.sh <PACKAGE_NAME>"
28+
echo "[INFO] Usage: ./verify_package.sh <PACKAGE_NAME>"
2829
exit 1
2930
fi
3031

31-
# Variables
3232
PKG_NAME="$1"
33-
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
34-
MOCHA_CLI="$ROOT/node_modules/.bin/mocha -r ts-node/register"
35-
DIR="$ROOT/test/integration/typescript"
36-
WORK_DIR=`mktemp -d`
37-
38-
if [ ! -f "$ROOT/$PKG_NAME" ]; then
39-
echo "Package $PKG_NAME does not exist."
33+
if [ ! -f "${PKG_NAME}" ]; then
34+
echo "Package ${PKG_NAME} does not exist."
4035
exit 1
4136
fi
4237

43-
# check if tmp dir was created
44-
if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
38+
# create a temporary directory
39+
WORK_DIR=`mktemp -d`
40+
if [[ ! "${WORK_DIR}" || ! -d "${WORK_DIR}" ]]; then
4541
echo "Could not create temp dir"
4642
exit 1
4743
fi
4844

4945
# deletes the temp directory
50-
function cleanup {
51-
rm -rf "$WORK_DIR"
52-
echo "Deleted temp working directory $WORK_DIR"
46+
function cleanup {
47+
rm -rf "${WORK_DIR}"
48+
echo "Deleted temp working directory ${WORK_DIR}"
5349
}
5450

5551
# register the cleanup function to be called on the EXIT signal
5652
trap cleanup EXIT
5753

58-
# Enter work dir
59-
pushd "$WORK_DIR"
54+
# Copy package and test sources into working directory
55+
cp "${PKG_NAME}" "${WORK_DIR}"
56+
cp -r test/integration/typescript/* "${WORK_DIR}"
57+
cp test/resources/mock.key.json "${WORK_DIR}"
6058

61-
# Copy test sources into working directory
62-
cp -r $DIR/* .
63-
cp "$ROOT/test/resources/mock.key.json" .
59+
# Enter work dir
60+
pushd "${WORK_DIR}"
6461

6562
# Install the test package
6663
npm install
6764

6865
# Install firebase-admin package
69-
npm install -S "$ROOT/$PKG_NAME"
66+
npm install -S "${PKG_NAME}"
7067

7168
echo "> tsc -p tsconfig.json"
72-
$ROOT/node_modules/.bin/tsc -p tsconfig.json
69+
./node_modules/.bin/tsc -p tsconfig.json
7370

71+
MOCHA_CLI="./node_modules/.bin/mocha -r ts-node/register"
7472
echo "> $MOCHA_CLI src/*.test.ts"
75-
$MOCHA_CLI src/*.test.ts
73+
$MOCHA_CLI src/*.test.ts

.github/workflows/release.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,10 @@ jobs:
7878
name: dist
7979
path: dist
8080

81-
# TODO: Move this script to .github/scripts.
8281
- name: Verify tarball
8382
run: |
8483
PACKAGE_TARBALL=`ls firebase-admin-*.tgz`
85-
./verifyReleaseTarball.sh $PACKAGE_TARBALL
84+
./.github/scripts/verify_package.sh $PACKAGE_TARBALL
8685
8786
publish_release:
8887
needs: stage_release

createReleaseTarball.sh

-178
This file was deleted.
+11-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
{
22
"name": "firebase-admin-typescript-test",
33
"version": "1.0.0",
4+
"description": "Firebase Admin SDK post package test cases",
5+
"license": "Apache-2.0",
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/firebase/firebase-admin-node"
9+
},
410
"devDependencies": {
5-
"@types/google-cloud__storage": "^1.1.1",
611
"@types/chai": "^3.4.35",
7-
"@types/mocha": "^2.2.39",
8-
"@types/node": "^7.0.8",
12+
"@types/mocha": "^2.2.48",
13+
"@types/node": "^8.10.59",
914
"chai": "^3.5.0",
10-
"mocha": "^3.5.0",
15+
"mocha": "^5.2.0",
1116
"ts-node": "^3.3.0",
12-
"typescript": "^2.4.2"
17+
"typescript": "^3.7.3"
1318
}
14-
}
19+
}

0 commit comments

Comments
 (0)