Skip to content

Commit

Permalink
Write a simple e2e test (works locally, going to test it as a Github …
Browse files Browse the repository at this point in the history
…workflow
  • Loading branch information
CaspianA1 committed Jun 27, 2024
1 parent 50ce007 commit ea9ac55
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
run: |
npm install
npm test
bash e2e_test.bash
env:
NPM_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
SILENCE_LOGS: true
42 changes: 42 additions & 0 deletions e2e_test.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

fail() {
echo "$1"
exit 1
}

# Wrapping every command in this, in order to avoid a cascasing pile of errors
try_command() {
eval "$1" || fail "This command failed: '$1'"
}

####################################################################################################

directories=(
e-commerce/payment-backend e-commerce/shop-backend e-commerce/shop-frontend
greeting-emails shop-guide tpcc widget-store yky-social
)

# TODO: will I have `jq` available in the CI environment?
orig_dir="$PWD"
version=$(try_command "jq -r '.version' package.json")

tarball_name="dbos-inc-eslint-plugin-$version.tgz"
tarball_path="$orig_dir/$tarball_name"

try_command "tsc"
try_command "npm pack"
try_command "git clone https://github.com/dbos-inc/dbos-demo-apps"

for directory in "${directories[@]}"; do
echo ">>>>>>>>>> Running e2e test for $directory"

try_command "cd dbos-demo-apps/$directory"
try_command "cp $tarball_path ."
try_command "npm install $tarball_name"
try_command "npm run lint"

try_command "cd $orig_dir"
done

####################################################################################################

0 comments on commit ea9ac55

Please sign in to comment.