-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #296 from ayyess/main
Fix updating all matching version numbers
- Loading branch information
Showing
6 changed files
with
149 additions
and
3 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,91 @@ | ||
import os | ||
import subprocess | ||
|
||
import conftest | ||
import pytest | ||
|
||
from nix_update import main | ||
|
||
|
||
@pytest.mark.skipif( | ||
"GITHUB_TOKEN" not in os.environ, reason="No GITHUB_TOKEN environment variable set" | ||
) | ||
def test_multiple_sources(helpers: conftest.Helpers) -> None: | ||
with helpers.testpkgs(init_git=True) as path: | ||
main(["--file", str(path), "--commit", "set.fd"]) | ||
fd_version = subprocess.run( | ||
[ | ||
"nix", | ||
"eval", | ||
"--raw", | ||
"--extra-experimental-features", | ||
"nix-command", | ||
"-f", | ||
path, | ||
"set.fd.version", | ||
], | ||
check=True, | ||
text=True, | ||
stdout=subprocess.PIPE, | ||
).stdout.strip() | ||
skim_version = subprocess.run( | ||
[ | ||
"nix", | ||
"eval", | ||
"--raw", | ||
"--extra-experimental-features", | ||
"nix-command", | ||
"-f", | ||
path, | ||
"set.skim.version", | ||
], | ||
check=True, | ||
text=True, | ||
stdout=subprocess.PIPE, | ||
).stdout.strip() | ||
assert tuple(map(int, fd_version.split("."))) >= (4, 4, 3) | ||
assert tuple(map(int, skim_version.split("."))) == (0, 0, 0) | ||
commit = subprocess.run( | ||
["git", "-C", path, "log", "-1"], | ||
text=True, | ||
stdout=subprocess.PIPE, | ||
check=True, | ||
).stdout.strip() | ||
print(commit) | ||
assert fd_version in commit | ||
assert "sharkdp/fd/compare/v0.0.0..." in commit | ||
assert "skim" not in commit | ||
|
||
|
||
@pytest.mark.skipif( | ||
"GITHUB_TOKEN" not in os.environ, reason="No GITHUB_TOKEN environment variable set" | ||
) | ||
def test_let_bound_version(helpers: conftest.Helpers) -> None: | ||
with helpers.testpkgs(init_git=True) as path: | ||
main(["--file", str(path), "--commit", "let-bound-version"]) | ||
version = subprocess.run( | ||
[ | ||
"nix", | ||
"eval", | ||
"--raw", | ||
"--extra-experimental-features", | ||
"nix-command", | ||
"-f", | ||
path, | ||
"let-bound-version.version", | ||
], | ||
check=True, | ||
text=True, | ||
stdout=subprocess.PIPE, | ||
).stdout.strip() | ||
assert tuple(map(int, version.split("."))) >= (8, 5, 2) | ||
commit = subprocess.run( | ||
["git", "-C", path, "log", "-1"], | ||
text=True, | ||
stdout=subprocess.PIPE, | ||
check=True, | ||
).stdout.strip() | ||
print(commit) | ||
assert version in commit | ||
assert "github" in commit | ||
assert "https://github.com/sharkdp/fd/compare/v8.0.0...v" in commit |
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,16 @@ | ||
{ stdenv, fetchFromGitHub }: | ||
|
||
let | ||
version = "8.0.0"; | ||
in | ||
stdenv.mkDerivation rec { | ||
pname = "fd"; | ||
inherit version; | ||
|
||
src = fetchFromGitHub { | ||
owner = "sharkdp"; | ||
repo = pname; | ||
rev = "v${version}"; | ||
sha256 = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; | ||
}; | ||
} |
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,26 @@ | ||
{ stdenv, fetchFromGitHub }: | ||
{ | ||
fd = stdenv.mkDerivation rec { | ||
pname = "fd"; | ||
version = "0.0.0"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "sharkdp"; | ||
repo = pname; | ||
rev = "v${version}"; | ||
sha256 = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; | ||
}; | ||
}; | ||
|
||
skim = stdenv.mkDerivation rec { | ||
pname = "skim"; | ||
version = "0.0.0"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "skim-rs"; | ||
repo = pname; | ||
rev = "v${version}"; | ||
sha256 = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; | ||
}; | ||
}; | ||
} |