Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(CI checks): Add support for GitLab CI checks
Check `GITLAB_CI` environment variable and then verify `CI_COMMIT_REF_NAME` matches the given branch. Includes tests Closes #88 re #32
- Loading branch information
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import pytest | ||
|
||
from semantic_release import ci_checks | ||
from semantic_release.errors import CiVerificationError | ||
|
||
|
||
def test_gitlab_should_pass_if_branch_is_master(monkeypatch): | ||
monkeypatch.setenv('CI_COMMIT_REF_NAME', 'master') | ||
|
||
assert ci_checks.gitlab('master') | ||
|
||
|
||
def test_gitlab_should_pass_if_branch_is_correct(monkeypatch): | ||
monkeypatch.setenv('CI_COMMIT_REF_NAME', 'other-branch') | ||
|
||
assert ci_checks.gitlab('other-branch') | ||
|
||
|
||
def test_gitlab_should_raise_ci_verification_error_for_wrong_branch(monkeypatch): | ||
monkeypatch.setenv('CI_COMMIT_REF_NAME', 'other-branch') | ||
|
||
with pytest.raises(CiVerificationError): | ||
ci_checks.gitlab('master') |