Skip to content
This repository was archived by the owner on Jun 3, 2021. It is now read-only.
Open
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
1 change: 1 addition & 0 deletions tests/examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ macro_rules! example {

example!(simple);
example!(bigger);
example!(heroku_deploy);
1 change: 1 addition & 0 deletions tests/examples/heroku_deploy/expected
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
All tests passed.
19 changes: 19 additions & 0 deletions tests/examples/heroku_deploy/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

if [ -z "$1" ] ; then
echo please, pass in the heroku app as an argument 1>&2
exit 1
fi

if [ -n "$(git status --porcelain)" ] && [ "$2" != "--force" ] ; then
echo exiting, git repo not clean 1>&2
exit 1
fi

if ! cargo test ; then
echo exiting, tests don\'t pass 1>&2
exit 1
fi

heroku container:push web --app "$1"
heroku container:release web --app "$1"
39 changes: 39 additions & 0 deletions tests/examples/heroku_deploy/script.test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
tests:
# exits when the git repo is not clean
- arguments: test-heroku-app
steps:
- command: git status --porcelain
stdout: " M some-changed-file\n"
stderr: "exiting, git repo not clean\n"
exitcode: 1

# exits and prints a usage message when no arguments given
- steps: []
stderr: "please, pass in the heroku app as an argument\n"
exitcode: 1

# exits when the tests don't pass
- arguments: test-heroku-app
steps:
- git status --porcelain
- command: cargo test
exitcode: 1
stderr: "exiting, tests don't pass\n"
exitcode: 1

# builds and deploys to heroku
- arguments: test-heroku-app
steps:
- git status --porcelain
- cargo test
- heroku container:push web --app test-heroku-app
- heroku container:release web --app test-heroku-app

# allows to force deploying of dirty git repo
- arguments: test-heroku-app --force
steps:
- command: git status --porcelain
stdout: " M some-changed-file\n"
- cargo test
- heroku container:push web --app test-heroku-app
- heroku container:release web --app test-heroku-app