Skip to content

Commit 594090a

Browse files
committed
only run certain journey tests if the gh program is installed.
Otherwise the output changes and journey tests fail.
1 parent b37affe commit 594090a

File tree

1 file changed

+82
-79
lines changed

1 file changed

+82
-79
lines changed

cargo-smart-release/tests/journey.sh

Lines changed: 82 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -82,109 +82,112 @@ title "smart-release"
8282
}
8383
)
8484
)
85-
(when "releasing 'a'"
86-
(with 'dry-run only'
87-
(with 'conditional version bumping'
88-
(with 'explicit bump specification'
89-
it "succeeds" && {
90-
WITH_SNAPSHOT="$snapshot/a-dry-run-success-multi-crate" \
91-
expect_run $SUCCESSFULLY "$exe" smart-release a --no-push --no-publish -v --allow-dirty -b minor
92-
}
93-
)
94-
(with 'implicit bump specification derived from commit history'
95-
it "succeeds" && {
96-
WITH_SNAPSHOT="$snapshot/a-dry-run-success-multi-crate-auto-bump-no-change" \
97-
expect_run $SUCCESSFULLY "$exe" smart-release a --no-push --no-publish -v --allow-dirty
98-
}
99-
(with "a breaking change"
100-
(cd a && touch break && git add break && git commit -m "refactor!: break") &>/dev/null
85+
86+
(with_program gh
87+
(when "releasing 'a'"
88+
(with 'dry-run only'
89+
(with 'conditional version bumping'
90+
(with 'explicit bump specification'
10191
it "succeeds" && {
102-
WITH_SNAPSHOT="$snapshot/a-dry-run-success-multi-crate-auto-bump-breaking-change" \
103-
expect_run $SUCCESSFULLY "$exe" smart-release a --no-push --no-publish -v --allow-dirty --allow-fully-generated-changelogs
92+
WITH_SNAPSHOT="$snapshot/a-dry-run-success-multi-crate" \
93+
expect_run $SUCCESSFULLY "$exe" smart-release a --no-push --no-publish -v --allow-dirty -b minor
10494
}
105-
(with "unconditional version bumping"
95+
)
96+
(with 'implicit bump specification derived from commit history'
97+
it "succeeds" && {
98+
WITH_SNAPSHOT="$snapshot/a-dry-run-success-multi-crate-auto-bump-no-change" \
99+
expect_run $SUCCESSFULLY "$exe" smart-release a --no-push --no-publish -v --allow-dirty
100+
}
101+
(with "a breaking change"
102+
(cd a && touch break && git add break && git commit -m "refactor!: break") &>/dev/null
106103
it "succeeds" && {
107-
WITH_SNAPSHOT="$snapshot/a-dry-run-success-multi-crate-auto-bump-breaking-change-no-bump-on-demand" \
108-
expect_run $SUCCESSFULLY "$exe" smart-release a --no-push --no-publish -v --allow-dirty --allow-fully-generated-changelogs --no-bump-on-demand --auto-publish-of-stable-crates
104+
WITH_SNAPSHOT="$snapshot/a-dry-run-success-multi-crate-auto-bump-breaking-change" \
105+
expect_run $SUCCESSFULLY "$exe" smart-release a --no-push --no-publish -v --allow-dirty --allow-fully-generated-changelogs
109106
}
110-
(with "--no-auto-publish-of-stable-crates"
107+
(with "unconditional version bumping"
111108
it "succeeds" && {
112-
WITH_SNAPSHOT="$snapshot/a-dry-run-success-multi-crate-auto-bump-breaking-change-no-bump-on-demand-no-publish-stable" \
113-
expect_run $SUCCESSFULLY "$exe" smart-release a --no-push --no-publish -v --allow-dirty --allow-fully-generated-changelogs --no-bump-on-demand
109+
WITH_SNAPSHOT="$snapshot/a-dry-run-success-multi-crate-auto-bump-breaking-change-no-bump-on-demand" \
110+
expect_run $SUCCESSFULLY "$exe" smart-release a --no-push --no-publish -v --allow-dirty --allow-fully-generated-changelogs --no-bump-on-demand --auto-publish-of-stable-crates
114111
}
112+
(with "--no-auto-publish-of-stable-crates"
113+
it "succeeds" && {
114+
WITH_SNAPSHOT="$snapshot/a-dry-run-success-multi-crate-auto-bump-breaking-change-no-bump-on-demand-no-publish-stable" \
115+
expect_run $SUCCESSFULLY "$exe" smart-release a --no-push --no-publish -v --allow-dirty --allow-fully-generated-changelogs --no-bump-on-demand
116+
}
117+
)
115118
)
119+
(when 'releasing "c" as well with unconditional version bumping'
120+
it "succeeds" && {
121+
WITH_SNAPSHOT="$snapshot/a-dry-run-success-multi-crate-auto-bump-breaking-change-dependant-publish" \
122+
expect_run $SUCCESSFULLY "$exe" smart-release c a --no-push --no-publish -v --allow-dirty --allow-fully-generated-changelogs --no-bump-on-demand --auto-publish-of-stable-crates
123+
}
124+
)
125+
git reset --hard HEAD~1 &>/dev/null
116126
)
117-
(when 'releasing "c" as well with unconditional version bumping'
118-
it "succeeds" && {
119-
WITH_SNAPSHOT="$snapshot/a-dry-run-success-multi-crate-auto-bump-breaking-change-dependant-publish" \
120-
expect_run $SUCCESSFULLY "$exe" smart-release c a --no-push --no-publish -v --allow-dirty --allow-fully-generated-changelogs --no-bump-on-demand --auto-publish-of-stable-crates
121-
}
122-
)
123-
git reset --hard HEAD~1 &>/dev/null
124-
)
125-
(with "a new feature"
126-
(cd a && touch feat && git add feat && git commit -m "feat: new") &>/dev/null
127-
it "succeeds" && {
128-
WITH_SNAPSHOT="$snapshot/a-dry-run-success-multi-crate-auto-bump-minor-change" \
129-
expect_run $SUCCESSFULLY "$exe" smart-release a --no-push --no-publish -v --allow-dirty
130-
}
131-
git reset --hard HEAD~1 &>/dev/null
132-
)
133-
(when 'releasing "c" as well'
134-
it "succeeds" && {
135-
WITH_SNAPSHOT="$snapshot/c-dry-run-success-multi-crate-auto-bump-no-change" \
136-
expect_run $SUCCESSFULLY "$exe" smart-release c a --no-push --no-publish -v --allow-dirty
137-
}
138-
(with "a breaking change"
139-
(cd c && touch break && git add break && git commit -m "refactor!: break") &>/dev/null
127+
(with "a new feature"
128+
(cd a && touch feat && git add feat && git commit -m "feat: new") &>/dev/null
140129
it "succeeds" && {
141-
WITH_SNAPSHOT="$snapshot/c-dry-run-success-multi-crate-auto-bump-breaking-change" \
142-
expect_run $SUCCESSFULLY "$exe" smart-release c a --no-push --no-publish -v --allow-dirty
130+
WITH_SNAPSHOT="$snapshot/a-dry-run-success-multi-crate-auto-bump-minor-change" \
131+
expect_run $SUCCESSFULLY "$exe" smart-release a --no-push --no-publish -v --allow-dirty
143132
}
144133
git reset --hard HEAD~1 &>/dev/null
145134
)
146-
(with "a new feature"
147-
(cd c && touch feat && git add feat && git commit -m "feat: new") &>/dev/null
135+
(when 'releasing "c" as well'
148136
it "succeeds" && {
149-
WITH_SNAPSHOT="$snapshot/c-dry-run-success-multi-crate-auto-bump-minor-change" \
137+
WITH_SNAPSHOT="$snapshot/c-dry-run-success-multi-crate-auto-bump-no-change" \
150138
expect_run $SUCCESSFULLY "$exe" smart-release c a --no-push --no-publish -v --allow-dirty
151139
}
152-
git reset --hard HEAD~1 &>/dev/null
140+
(with "a breaking change"
141+
(cd c && touch break && git add break && git commit -m "refactor!: break") &>/dev/null
142+
it "succeeds" && {
143+
WITH_SNAPSHOT="$snapshot/c-dry-run-success-multi-crate-auto-bump-breaking-change" \
144+
expect_run $SUCCESSFULLY "$exe" smart-release c a --no-push --no-publish -v --allow-dirty
145+
}
146+
git reset --hard HEAD~1 &>/dev/null
147+
)
148+
(with "a new feature"
149+
(cd c && touch feat && git add feat && git commit -m "feat: new") &>/dev/null
150+
it "succeeds" && {
151+
WITH_SNAPSHOT="$snapshot/c-dry-run-success-multi-crate-auto-bump-minor-change" \
152+
expect_run $SUCCESSFULLY "$exe" smart-release c a --no-push --no-publish -v --allow-dirty
153+
}
154+
git reset --hard HEAD~1 &>/dev/null
155+
)
153156
)
154157
)
155158
)
156-
)
157-
(with 'unconditional version bumping'
158-
it "succeeds" && {
159-
WITH_SNAPSHOT="$snapshot/a-dry-run-success-multi-crate-unconditional" \
160-
expect_run $SUCCESSFULLY "$exe" smart-release a --no-push --no-publish -v --no-bump-on-demand -b minor --auto-publish-of-stable-crates
161-
}
162-
(when 'releasing b as well'
159+
(with 'unconditional version bumping'
163160
it "succeeds" && {
164-
WITH_SNAPSHOT="$snapshot/a-b-dry-run-success-multi-crate-unconditional" \
165-
expect_run $SUCCESSFULLY "$exe" smart-release b a --no-push --no-publish -v --no-bump-on-demand -b minor --auto-publish-of-stable-crates
161+
WITH_SNAPSHOT="$snapshot/a-dry-run-success-multi-crate-unconditional" \
162+
expect_run $SUCCESSFULLY "$exe" smart-release a --no-push --no-publish -v --no-bump-on-demand -b minor --auto-publish-of-stable-crates
166163
}
164+
(when 'releasing b as well'
165+
it "succeeds" && {
166+
WITH_SNAPSHOT="$snapshot/a-b-dry-run-success-multi-crate-unconditional" \
167+
expect_run $SUCCESSFULLY "$exe" smart-release b a --no-push --no-publish -v --no-bump-on-demand -b minor --auto-publish-of-stable-crates
168+
}
169+
)
167170
)
168171
)
169-
)
170-
(with '--execute but without side-effects'
171-
it "succeeds" && {
172-
expect_run $SUCCESSFULLY "$exe" smart-release a -b keep -d keep --no-push --no-publish --execute --allow-dirty --no-changelog-preview --auto-publish-of-stable-crates
173-
}
174-
(with ".git and target/ directories removed"
175-
rm -Rf .git/ target/
176-
it "managed to bump B's minor but left C alone as it's not pre-release anymore" && {
177-
expect_snapshot "$snapshot/crate-a-released" .
172+
(with '--execute but without side-effects'
173+
it "succeeds" && {
174+
expect_run $SUCCESSFULLY "$exe" smart-release a -b keep -d keep --no-push --no-publish --execute --allow-dirty --no-changelog-preview --auto-publish-of-stable-crates
178175
}
179-
(with 'unconditional version minor bumping'
180-
init-git-repo &>/dev/null
181-
it "succeeds" && {
182-
expect_run $SUCCESSFULLY "$exe" smart-release -b minor a --no-push --no-publish --no-bump-on-demand --execute --allow-dirty --no-changelog-preview --auto-publish-of-stable-crates
183-
}
184-
rm -Rf .git/
185-
it "managed additionally bumped b but not c as it's not pre-release" && {
186-
expect_snapshot "$snapshot/crate-a-released-force-bump" .
176+
(with ".git and target/ directories removed"
177+
rm -Rf .git/ target/
178+
it "managed to bump B's minor but left C alone as it's not pre-release anymore" && {
179+
expect_snapshot "$snapshot/crate-a-released" .
187180
}
181+
(with 'unconditional version minor bumping'
182+
init-git-repo &>/dev/null
183+
it "succeeds" && {
184+
expect_run $SUCCESSFULLY "$exe" smart-release -b minor a --no-push --no-publish --no-bump-on-demand --execute --allow-dirty --no-changelog-preview --auto-publish-of-stable-crates
185+
}
186+
rm -Rf .git/
187+
it "managed additionally bumped b but not c as it's not pre-release" && {
188+
expect_snapshot "$snapshot/crate-a-released-force-bump" .
189+
}
190+
)
188191
)
189192
)
190193
)

0 commit comments

Comments
 (0)