Skip to content

chore: Cleaning up package verification scripts #822

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

Merged
merged 2 commits into from
Mar 18, 2020
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
42 changes: 20 additions & 22 deletions verifyReleaseTarball.sh → .github/scripts/verify_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,55 +21,53 @@
# applications.

set -e
set -u

if [ -z "$1" ]; then
echo "[ERROR] No package name provided."
echo "[INFO] Usage: ./verifyReleaseTarball.sh <PACKAGE_NAME>"
echo "[INFO] Usage: ./verify_package.sh <PACKAGE_NAME>"
exit 1
fi

# Variables
PKG_NAME="$1"
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
MOCHA_CLI="$ROOT/node_modules/.bin/mocha -r ts-node/register"
DIR="$ROOT/test/integration/typescript"
WORK_DIR=`mktemp -d`

if [ ! -f "$ROOT/$PKG_NAME" ]; then
echo "Package $PKG_NAME does not exist."
if [ ! -f "${PKG_NAME}" ]; then
echo "Package ${PKG_NAME} does not exist."
exit 1
fi

# check if tmp dir was created
if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
# create a temporary directory
WORK_DIR=`mktemp -d`
if [[ ! "${WORK_DIR}" || ! -d "${WORK_DIR}" ]]; then
echo "Could not create temp dir"
exit 1
fi

# deletes the temp directory
function cleanup {
rm -rf "$WORK_DIR"
echo "Deleted temp working directory $WORK_DIR"
function cleanup {
rm -rf "${WORK_DIR}"
echo "Deleted temp working directory ${WORK_DIR}"
}

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

# Enter work dir
pushd "$WORK_DIR"
# Copy package and test sources into working directory
cp "${PKG_NAME}" "${WORK_DIR}"
cp -r test/integration/typescript/* "${WORK_DIR}"
cp test/resources/mock.key.json "${WORK_DIR}"

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

# Install the test package
npm install

# Install firebase-admin package
npm install -S "$ROOT/$PKG_NAME"
npm install -S "${PKG_NAME}"

echo "> tsc -p tsconfig.json"
$ROOT/node_modules/.bin/tsc -p tsconfig.json
./node_modules/.bin/tsc -p tsconfig.json

MOCHA_CLI="./node_modules/.bin/mocha -r ts-node/register"
echo "> $MOCHA_CLI src/*.test.ts"
$MOCHA_CLI src/*.test.ts
$MOCHA_CLI src/*.test.ts
3 changes: 1 addition & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,10 @@ jobs:
name: dist
path: dist

# TODO: Move this script to .github/scripts.
- name: Verify tarball
run: |
PACKAGE_TARBALL=`ls firebase-admin-*.tgz`
./verifyReleaseTarball.sh $PACKAGE_TARBALL
./.github/scripts/verify_package.sh $PACKAGE_TARBALL

publish_release:
needs: stage_release
Expand Down
178 changes: 0 additions & 178 deletions createReleaseTarball.sh

This file was deleted.

17 changes: 11 additions & 6 deletions test/integration/typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
{
"name": "firebase-admin-typescript-test",
"version": "1.0.0",
"description": "Firebase Admin SDK post package test cases",
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/firebase/firebase-admin-node"
},
"devDependencies": {
"@types/google-cloud__storage": "^1.1.1",
"@types/chai": "^3.4.35",
"@types/mocha": "^2.2.39",
"@types/node": "^7.0.8",
"@types/mocha": "^2.2.48",
"@types/node": "^8.10.59",
"chai": "^3.5.0",
"mocha": "^3.5.0",
"mocha": "^5.2.0",
"ts-node": "^3.3.0",
"typescript": "^2.4.2"
"typescript": "^3.7.3"
}
}
}