Skip to content
This repository was archived by the owner on Jun 3, 2021. It is now read-only.

Commit ab2971e

Browse files
committed
add better example for heroku deploy script
1 parent 496bc5a commit ab2971e

File tree

4 files changed

+66
-0
lines changed

4 files changed

+66
-0
lines changed

tests/examples.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ macro_rules! example {
4242

4343
example!(simple);
4444
example!(bigger);
45+
example!(heroku_deploy);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
All tests passed.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
3+
if [ -z "$1" ] ; then
4+
echo please, pass in the heroku app as an argument 1>&2
5+
exit 1
6+
fi
7+
8+
if [ -n "$(git status --porcelain)" ] && [ "$2" != "--force" ] ; then
9+
echo exiting, git repo not clean 1>&2
10+
exit 1
11+
fi
12+
13+
if ! cargo test ; then
14+
echo exiting, tests don\'t pass 1>&2
15+
exit 1
16+
fi
17+
18+
heroku container:push web --app "$1"
19+
heroku container:release web --app "$1"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
protocols:
2+
# exits when the git repo is not clean
3+
- env: &env
4+
PATH: /snap/bin:~/.cargo/bin:/usr/local/cargo/bin/:/usr/bin:/bin
5+
arguments: test-heroku-app
6+
protocol:
7+
- command: git status --porcelain
8+
stdout: " M some-changed-file\n"
9+
stderr: "exiting, git repo not clean\n"
10+
exitcode: 1
11+
12+
# exits and prints a usage message when no arguments given
13+
- env: *env
14+
protocol: []
15+
stderr: "please, pass in the heroku app as an argument\n"
16+
exitcode: 1
17+
18+
# exits when the tests don't pass
19+
- env: *env
20+
arguments: test-heroku-app
21+
protocol:
22+
- git status --porcelain
23+
- command: cargo test
24+
exitcode: 1
25+
stderr: "exiting, tests don't pass\n"
26+
exitcode: 1
27+
28+
# builds and deploys to heroku
29+
- env: *env
30+
arguments: test-heroku-app
31+
protocol:
32+
- git status --porcelain
33+
- cargo test
34+
- heroku container:push web --app test-heroku-app
35+
- heroku container:release web --app test-heroku-app
36+
37+
# allows to force deploying of dirty git repo
38+
- env: *env
39+
arguments: test-heroku-app --force
40+
protocol:
41+
- command: git status --porcelain
42+
stdout: " M some-changed-file\n"
43+
- cargo test
44+
- heroku container:push web --app test-heroku-app
45+
- heroku container:release web --app test-heroku-app

0 commit comments

Comments
 (0)