-
-
Notifications
You must be signed in to change notification settings - Fork 29
neil dep upgrade
#110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
neil dep upgrade
#110
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
720f54c
dep-upgrade outline
teodorlu a529e90
Experiment, print latest versions
teodorlu 4b665b1
Comment-out unused binding (CI)
teodorlu cf984e0
Also regenerate script
teodorlu 845ff0a
Remove comments
teodorlu 6cac9fe
Query for latest in parallell
teodorlu 03222ef
Works without :dry-run
teodorlu 5cae2c0
Cleanup whitespace & comments
teodorlu 9c955ec
Try updating single dependency, hit option problem
teodorlu 6cb126c
:lib must be symbol!!!
teodorlu 36d4657
Add changelog entry
teodorlu d4b2694
Update->upgrade
teodorlu 9bf493c
Try writing some tests -- but other tests failing
teodorlu 4f55ce1
Merge branch 'main' into dep-upgrade
teodorlu 28593d3
Move `dep upgrade` tests to own namespace
teodorlu 8312682
Use neil from `babashka.neil.test-util`
teodorlu ffc6cbc
Whoops, more neil
teodorlu 8ee3528
Also use `test-file` from `test-util`
teodorlu 131bfc1
First passing test 🎉
teodorlu b681108
Use github token if found, cleanup
teodorlu 3d08a4f
Rewrite tests to not use :dry-run
teodorlu 410aff4
Remove unused dep
teodorlu 1eea1ef
Merge remote-tracking branch 'upstream/main' into dep-upgrade
teodorlu 40f65f1
Cleanup: remove comments
teodorlu ab118dc
Improve comment
teodorlu e7f1cb4
fix: support :deps-file, :dry-run in test-util/neil
russmatney fb8c108
fix: ignore unused _all in neil/dep-upgrade
russmatney b69c592
Merge: Dep Upgrade: fix tests and linter errors
russmatney 483b08d
Merge remote-tracking branch 'origin/main' into dep-upgrade
russmatney b2b0f73
Trigger CI
teodorlu 29d098b
Regenerate `neil` script
teodorlu 3f318c9
Remove comment to trigger CI
teodorlu ab99ce4
docs: initial help text for upgrade command
russmatney 67f7703
docs: nest upgrade in `dep` properly
russmatney f63c4d6
test: add test for updating a single dep
russmatney 8032039
test: coverage for :git/sha dep upgrades
russmatney 6738ecc
fix: maintain :git/sha based deps across upgrades
russmatney 83e84c1
feat: support `update` as alias of `upgrade`
russmatney 77f1b90
feat: print when performing an upgrade
russmatney d20cdf8
fix: rely on :git/sha rather than :git/url
russmatney File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,89 @@ | ||
(ns babashka.neil.dep-upgrade-test | ||
(:require | ||
[babashka.neil.test-util :as test-util] | ||
[clojure.test :as t :refer [deftest is testing]] | ||
[clojure.edn :as edn])) | ||
|
||
(def test-file-path (str (test-util/test-file "deps.edn"))) | ||
(defn get-dep-version [dep-name] | ||
(-> test-file-path slurp edn/read-string :deps (get dep-name))) | ||
|
||
(deftest dep-upgrade-test | ||
(testing "a fresh project is up-to-date" | ||
(spit test-file-path "{}") | ||
(test-util/neil "dep add :lib clj-kondo/clj-kondo" :deps-file test-file-path) | ||
(let [clj-kondo-version-original (get-dep-version 'clj-kondo/clj-kondo)] | ||
(test-util/neil "dep upgrade" :deps-file test-file-path) | ||
(is (= clj-kondo-version-original (get-dep-version 'clj-kondo/clj-kondo))))) | ||
|
||
(testing "an old dependency can be upgraded, and --dry-run is respected" | ||
(spit test-file-path "{}") | ||
(test-util/neil "dep add :lib clj-kondo/clj-kondo :version 2022.01.01" :deps-file test-file-path) | ||
(let [clj-kondo-version-original (get-dep-version 'clj-kondo/clj-kondo)] | ||
|
||
;; should be the same version after --dry-run | ||
(test-util/neil "dep upgrade" :deps-file test-file-path :dry-run true) | ||
(is (= clj-kondo-version-original (get-dep-version 'clj-kondo/clj-kondo))) | ||
|
||
;; after a non-dry-run, the version should be changed | ||
(test-util/neil "dep upgrade" :deps-file test-file-path) | ||
(is (not (= clj-kondo-version-original (get-dep-version 'clj-kondo/clj-kondo))))))) | ||
|
||
(deftest dep-upgrade-test-one-lib | ||
(testing "specifying :lib only updates one dep" | ||
(spit test-file-path "{}") | ||
(test-util/neil "dep add :lib clj-kondo/clj-kondo :version 2022.01.01" :deps-file test-file-path) | ||
(test-util/neil "dep add :lib babashka/fs :version 0.0.1" :deps-file test-file-path) | ||
(let [clj-kondo-original (get-dep-version 'clj-kondo/clj-kondo) | ||
fs-original (get-dep-version 'babashka/fs)] | ||
(test-util/neil "dep upgrade :lib clj-kondo/clj-kondo" :deps-file test-file-path) | ||
(let [clj-kondo-upgraded (get-dep-version 'clj-kondo/clj-kondo) | ||
fs-upgraded (get-dep-version 'babashka/fs)] | ||
(is (not (= clj-kondo-original clj-kondo-upgraded))) | ||
(is (= fs-original fs-upgraded)))))) | ||
|
||
(deftest dep-upgrade-test-maintain-dep-source | ||
(testing "upgrading a :git/sha dep should maintain :git/sha" | ||
(spit test-file-path "{}") | ||
(test-util/neil "dep add :lib clj-kondo/clj-kondo :latest-sha true" :deps-file test-file-path) | ||
(let [clj-kondo-original (get-dep-version 'clj-kondo/clj-kondo)] | ||
;; this upgrade should return the same latest sha, NOT a :mvn/version | ||
(test-util/neil "dep upgrade" :deps-file test-file-path) | ||
(let [{:keys [git/url git/sha]} (get-dep-version 'clj-kondo/clj-kondo)] | ||
(is url) | ||
(is sha) | ||
(is (= clj-kondo-original (get-dep-version 'clj-kondo/clj-kondo)))))) | ||
|
||
(testing "upgrading an older :git/sha dep should set the latest :git/sha" | ||
(spit test-file-path "{}") | ||
(test-util/neil "dep add :lib clj-kondo/clj-kondo :sha 6ffc3934cb83d2c4fff16d84198c73b40cd8a078" | ||
:deps-file test-file-path) | ||
(let [clj-kondo-original (get-dep-version 'clj-kondo/clj-kondo)] | ||
;; here we upgrade and then assert that the sha is different, but still :git/sha based | ||
(test-util/neil "dep upgrade" :deps-file test-file-path) | ||
(let [{:keys [git/url git/sha]} (get-dep-version 'clj-kondo/clj-kondo)] | ||
(is url) | ||
(is sha) | ||
;; should be a different sha | ||
(is (not (= sha (:git/sha clj-kondo-original))))))) | ||
|
||
(testing "upgrading a single lib should also maintain :git/url and sha" | ||
(spit test-file-path "{}") | ||
(test-util/neil "dep add :lib clj-kondo/clj-kondo :sha 6ffc3934cb83d2c4fff16d84198c73b40cd8a078" | ||
:deps-file test-file-path) | ||
(test-util/neil "dep add :lib babashka/fs :sha 791009052fe8916b4e10e55732622a69250c7598" | ||
:deps-file test-file-path) | ||
|
||
(let [clj-kondo-original (get-dep-version 'clj-kondo/clj-kondo) | ||
fs-original (get-dep-version 'babashka/fs)] | ||
(test-util/neil "dep upgrade :lib babashka/fs" :deps-file test-file-path) | ||
(let [clj-kondo-upgraded (get-dep-version 'clj-kondo/clj-kondo) | ||
fs-upgraded (get-dep-version 'babashka/fs)] | ||
(is (:git/sha clj-kondo-upgraded)) | ||
(is (:git/url clj-kondo-upgraded)) | ||
(is (:git/sha fs-upgraded)) | ||
(is (:git/url fs-upgraded)) | ||
;; should be unchanged | ||
(is (= clj-kondo-original clj-kondo-upgraded)) | ||
;; should be a different sha | ||
(is (not (= fs-original fs-upgraded))))))) |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.