diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..a65d229f --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,27 @@ +name: Taskfile Ci + +on: + push: + branches: + - main + - task-ci + +jobs: + test_all: + runs-on: ubuntu-latest + steps: + - name: git checkout + uses: actions/checkout@v3 + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + - uses: DeterminateSystems/magic-nix-cache-action@main + - name: Check Nixpkgs inputs + uses: DeterminateSystems/flake-checker-action@main + with: + fail-mode: true + flake-lock-path: ./bsf/flake.lock + - uses: nicknovitski/nix-develop@v1 + with: + arguments: bsf/.#devShell + - name: run tests + run: task test diff --git a/Taskfile.yml b/Taskfile.yml new file mode 100644 index 00000000..683d8a0f --- /dev/null +++ b/Taskfile.yml @@ -0,0 +1,7 @@ +version: '3' + +tasks: + test: + desc: "Run all Go tests" + cmds: + - go test ./... diff --git a/bsf.hcl b/bsf.hcl index 07ca474b..6c297881 100644 --- a/bsf.hcl +++ b/bsf.hcl @@ -1,12 +1,13 @@ packages { - development = ["go@1.22.0", "delve@^1.22.0", "gotools@~0.7.0", "goreleaser@^1.24.0"] + development = ["go@1.21.6", "gotools@0.16.1", "delve@1.22.0", "go-task@~3.37.2"] runtime = ["cacert@3.95"] } gomodule { - name = "bsf" - src = "./." + name = "bsf" + src = "./." + ldFlags = null + tags = null doCheck = false } - diff --git a/bsf.lock b/bsf.lock index 0e0816d9..197b6d78 100644 --- a/bsf.lock +++ b/bsf.lock @@ -5,14 +5,14 @@ "packages": [ { "package": { - "name": "go", - "revision": "5a7b241264578c55cd25aa7422121aef072ce588", + "name": "delve", + "revision": "a731d0cb71c58f56895f71a5b02eda2962a46746", "version": "1.22.0", - "description": "The Go Programming language", - "homepage": "https://go.dev/", + "description": "debugger for the Go programming language", + "homepage": "https://github.com/go-delve/delve", "free": true, - "spdx_id": "BSD-3-Clause", - "epoch_seconds": 1707509006, + "spdx_id": "MIT", + "epoch_seconds": 1705066566, "platforms": [ "x86_64-darwin", "i686-darwin", @@ -39,21 +39,63 @@ "s390-linux", "s390x-linux", "x86_64-linux" - ], - "attr_name": "go_1_22" + ] }, "runtime": false }, { "package": { - "name": "goreleaser", - "revision": "5a7b241264578c55cd25aa7422121aef072ce588", - "version": "1.24.0", - "description": "Deliver Go binaries as fast and easily as possible", - "homepage": "https://goreleaser.com", + "name": "go-task", + "revision": "7445ccd775d8b892fc56448d17345443a05f7fb4", + "version": "3.37.2", + "description": "A task runner / simpler Make alternative written in Go", + "homepage": "https://taskfile.dev/", "free": true, "spdx_id": "MIT", - "epoch_seconds": 1707509006, + "epoch_seconds": 1716993062, + "platforms": [ + "x86_64-darwin", + "i686-darwin", + "aarch64-darwin", + "armv7a-darwin", + "aarch64-linux", + "armv5tel-linux", + "armv6l-linux", + "armv7a-linux", + "armv7l-linux", + "i686-linux", + "loongarch64-linux", + "m68k-linux", + "microblaze-linux", + "microblazeel-linux", + "mips-linux", + "mips64-linux", + "mips64el-linux", + "mipsel-linux", + "powerpc64-linux", + "powerpc64le-linux", + "riscv32-linux", + "riscv64-linux", + "s390-linux", + "s390x-linux", + "x86_64-linux", + "wasm64-wasi", + "wasm32-wasi" + ], + "attr_name": "go-task" + }, + "runtime": false + }, + { + "package": { + "name": "gotools", + "revision": "ac5c1886fd9fe49748d7ab80accc4c847481df14", + "version": "0.16.1", + "description": "Additional tools for Go development", + "homepage": "https://go.googlesource.com/tools", + "free": true, + "spdx_id": "BSD-3-Clause", + "epoch_seconds": 1699289668, "platforms": [ "x86_64-darwin", "i686-darwin", @@ -176,53 +218,13 @@ }, { "package": { - "name": "gotools", - "revision": "1ebb7d7bba2953a4223956cfb5f068b0095f84a7", - "version": "0.7.0", - "description": "Additional tools for Go development", - "homepage": "https://go.googlesource.com/tools", - "free": true, - "spdx_id": "BSD-3-Clause", - "epoch_seconds": 1653393815, - "platforms": [ - "x86_64-darwin", - "i686-darwin", - "aarch64-darwin", - "armv7a-darwin", - "aarch64-linux", - "armv5tel-linux", - "armv6l-linux", - "armv7a-linux", - "armv7l-linux", - "i686-linux", - "loongarch64-linux", - "m68k-linux", - "microblaze-linux", - "microblazeel-linux", - "mips-linux", - "mips64-linux", - "mips64el-linux", - "mipsel-linux", - "powerpc64-linux", - "powerpc64le-linux", - "riscv32-linux", - "riscv64-linux", - "s390-linux", - "s390x-linux", - "x86_64-linux" - ] - }, - "runtime": false - }, - { - "package": { - "name": "delve", + "name": "go", "revision": "a731d0cb71c58f56895f71a5b02eda2962a46746", - "version": "1.22.0", - "description": "debugger for the Go programming language", - "homepage": "https://github.com/go-delve/delve", + "version": "1.21.6", + "description": "The Go Programming language", + "homepage": "https://go.dev/", "free": true, - "spdx_id": "MIT", + "spdx_id": "BSD-3-Clause", "epoch_seconds": 1705066566, "platforms": [ "x86_64-darwin", diff --git a/bsf/flake.lock b/bsf/flake.lock index 40cfd59f..acb310ea 100644 --- a/bsf/flake.lock +++ b/bsf/flake.lock @@ -55,35 +55,19 @@ "type": "github" } }, - "nixpkgs-1ebb7d7bba2953a4223956cfb5f068b0095f84a7": { + "nixpkgs-7445ccd775d8b892fc56448d17345443a05f7fb4": { "locked": { - "lastModified": 1702939464, - "narHash": "sha256-mZqoH5fXxh8UxjUKpqi09UBXEPpz4w+2Ef0AVTLuF+g=", + "lastModified": 1716993062, + "narHash": "sha256-Q7+8FPD2V8OoGAe0d5LoE8HZ5KYJMyb80klPyrZj2hw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "1ebb7d7bba2953a4223956cfb5f068b0095f84a7", + "rev": "7445ccd775d8b892fc56448d17345443a05f7fb4", "type": "github" }, "original": { "owner": "nixos", "repo": "nixpkgs", - "rev": "1ebb7d7bba2953a4223956cfb5f068b0095f84a7", - "type": "github" - } - }, - "nixpkgs-5a7b241264578c55cd25aa7422121aef072ce588": { - "locked": { - "lastModified": 1707509006, - "narHash": "sha256-aqLiIgNEZ6Fy96QXmeQaMK/E3lmmiS0qkRZ0arvHoj4=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "5a7b241264578c55cd25aa7422121aef072ce588", - "type": "github" - }, - "original": { - "owner": "nixos", - "repo": "nixpkgs", - "rev": "5a7b241264578c55cd25aa7422121aef072ce588", + "rev": "7445ccd775d8b892fc56448d17345443a05f7fb4", "type": "github" } }, @@ -123,8 +107,7 @@ "inputs": { "gomod2nix": "gomod2nix", "nixpkgs": "nixpkgs", - "nixpkgs-1ebb7d7bba2953a4223956cfb5f068b0095f84a7": "nixpkgs-1ebb7d7bba2953a4223956cfb5f068b0095f84a7", - "nixpkgs-5a7b241264578c55cd25aa7422121aef072ce588": "nixpkgs-5a7b241264578c55cd25aa7422121aef072ce588", + "nixpkgs-7445ccd775d8b892fc56448d17345443a05f7fb4": "nixpkgs-7445ccd775d8b892fc56448d17345443a05f7fb4", "nixpkgs-a731d0cb71c58f56895f71a5b02eda2962a46746": "nixpkgs-a731d0cb71c58f56895f71a5b02eda2962a46746", "nixpkgs-ac5c1886fd9fe49748d7ab80accc4c847481df14": "nixpkgs-ac5c1886fd9fe49748d7ab80accc4c847481df14" } diff --git a/bsf/flake.nix b/bsf/flake.nix index 941150cc..a38079d9 100644 --- a/bsf/flake.nix +++ b/bsf/flake.nix @@ -3,10 +3,9 @@ description = ""; inputs = { - nixpkgs-a731d0cb71c58f56895f71a5b02eda2962a46746.url = "github:nixos/nixpkgs/a731d0cb71c58f56895f71a5b02eda2962a46746"; - nixpkgs-5a7b241264578c55cd25aa7422121aef072ce588.url = "github:nixos/nixpkgs/5a7b241264578c55cd25aa7422121aef072ce588"; nixpkgs-ac5c1886fd9fe49748d7ab80accc4c847481df14.url = "github:nixos/nixpkgs/ac5c1886fd9fe49748d7ab80accc4c847481df14"; - nixpkgs-1ebb7d7bba2953a4223956cfb5f068b0095f84a7.url = "github:nixos/nixpkgs/1ebb7d7bba2953a4223956cfb5f068b0095f84a7"; + nixpkgs-a731d0cb71c58f56895f71a5b02eda2962a46746.url = "github:nixos/nixpkgs/a731d0cb71c58f56895f71a5b02eda2962a46746"; + nixpkgs-7445ccd775d8b892fc56448d17345443a05f7fb4.url = "github:nixos/nixpkgs/7445ccd775d8b892fc56448d17345443a05f7fb4"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; gomod2nix.url = "github:nix-community/gomod2nix"; @@ -27,10 +26,9 @@ - nixpkgs-a731d0cb71c58f56895f71a5b02eda2962a46746, - nixpkgs-5a7b241264578c55cd25aa7422121aef072ce588, nixpkgs-ac5c1886fd9fe49748d7ab80accc4c847481df14, - nixpkgs-1ebb7d7bba2953a4223956cfb5f068b0095f84a7, + nixpkgs-a731d0cb71c58f56895f71a5b02eda2962a46746, + nixpkgs-7445ccd775d8b892fc56448d17345443a05f7fb4, }: let supportedSystems = [ "x86_64-linux" "aarch64-darwin" "x86_64-darwin" "aarch64-linux" ]; @@ -38,10 +36,9 @@ forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { inherit system; - nixpkgs-a731d0cb71c58f56895f71a5b02eda2962a46746-pkgs = import nixpkgs-a731d0cb71c58f56895f71a5b02eda2962a46746 { inherit system; }; - nixpkgs-5a7b241264578c55cd25aa7422121aef072ce588-pkgs = import nixpkgs-5a7b241264578c55cd25aa7422121aef072ce588 { inherit system; }; nixpkgs-ac5c1886fd9fe49748d7ab80accc4c847481df14-pkgs = import nixpkgs-ac5c1886fd9fe49748d7ab80accc4c847481df14 { inherit system; }; - nixpkgs-1ebb7d7bba2953a4223956cfb5f068b0095f84a7-pkgs = import nixpkgs-1ebb7d7bba2953a4223956cfb5f068b0095f84a7 { inherit system; }; + nixpkgs-a731d0cb71c58f56895f71a5b02eda2962a46746-pkgs = import nixpkgs-a731d0cb71c58f56895f71a5b02eda2962a46746 { inherit system; }; + nixpkgs-7445ccd775d8b892fc56448d17345443a05f7fb4-pkgs = import nixpkgs-7445ccd775d8b892fc56448d17345443a05f7fb4 { inherit system; }; buildGoApplication = gomod2nix.legacyPackages.${system}.buildGoApplication; pkgs = import nixpkgs { inherit system; }; @@ -53,10 +50,9 @@ buildGoApplication, - nixpkgs-a731d0cb71c58f56895f71a5b02eda2962a46746-pkgs, - nixpkgs-5a7b241264578c55cd25aa7422121aef072ce588-pkgs, nixpkgs-ac5c1886fd9fe49748d7ab80accc4c847481df14-pkgs, - nixpkgs-1ebb7d7bba2953a4223956cfb5f068b0095f84a7-pkgs, + nixpkgs-a731d0cb71c58f56895f71a5b02eda2962a46746-pkgs, + nixpkgs-7445ccd775d8b892fc56448d17345443a05f7fb4-pkgs, ... }: { default = pkgs.callPackage ./default.nix { inherit buildGoApplication; @@ -72,18 +68,17 @@ - nixpkgs-a731d0cb71c58f56895f71a5b02eda2962a46746-pkgs, - nixpkgs-5a7b241264578c55cd25aa7422121aef072ce588-pkgs, nixpkgs-ac5c1886fd9fe49748d7ab80accc4c847481df14-pkgs, - nixpkgs-1ebb7d7bba2953a4223956cfb5f068b0095f84a7-pkgs, + nixpkgs-a731d0cb71c58f56895f71a5b02eda2962a46746-pkgs, + nixpkgs-7445ccd775d8b892fc56448d17345443a05f7fb4-pkgs, ... }: { devShell = pkgs.mkShell { # The Nix packages provided in the environment packages = [ nixpkgs-a731d0cb71c58f56895f71a5b02eda2962a46746-pkgs.delve - nixpkgs-5a7b241264578c55cd25aa7422121aef072ce588-pkgs.go_1_22 - nixpkgs-5a7b241264578c55cd25aa7422121aef072ce588-pkgs.goreleaser - nixpkgs-1ebb7d7bba2953a4223956cfb5f068b0095f84a7-pkgs.gotools + nixpkgs-a731d0cb71c58f56895f71a5b02eda2962a46746-pkgs.go + nixpkgs-7445ccd775d8b892fc56448d17345443a05f7fb4-pkgs.go-task + nixpkgs-ac5c1886fd9fe49748d7ab80accc4c847481df14-pkgs.gotools ]; }; @@ -94,7 +89,7 @@ - nixpkgs-a731d0cb71c58f56895f71a5b02eda2962a46746-pkgs, nixpkgs-5a7b241264578c55cd25aa7422121aef072ce588-pkgs, nixpkgs-ac5c1886fd9fe49748d7ab80accc4c847481df14-pkgs, nixpkgs-1ebb7d7bba2953a4223956cfb5f068b0095f84a7-pkgs, ... }: { + nixpkgs-ac5c1886fd9fe49748d7ab80accc4c847481df14-pkgs, nixpkgs-a731d0cb71c58f56895f71a5b02eda2962a46746-pkgs, nixpkgs-7445ccd775d8b892fc56448d17345443a05f7fb4-pkgs, ... }: { runtime = pkgs.buildEnv { name = "runtimeenv"; paths = [ @@ -109,14 +104,14 @@ - nixpkgs-a731d0cb71c58f56895f71a5b02eda2962a46746-pkgs, nixpkgs-5a7b241264578c55cd25aa7422121aef072ce588-pkgs, nixpkgs-ac5c1886fd9fe49748d7ab80accc4c847481df14-pkgs, nixpkgs-1ebb7d7bba2953a4223956cfb5f068b0095f84a7-pkgs, ... }: { + nixpkgs-ac5c1886fd9fe49748d7ab80accc4c847481df14-pkgs, nixpkgs-a731d0cb71c58f56895f71a5b02eda2962a46746-pkgs, nixpkgs-7445ccd775d8b892fc56448d17345443a05f7fb4-pkgs, ... }: { development = pkgs.buildEnv { name = "devenv"; paths = [ nixpkgs-a731d0cb71c58f56895f71a5b02eda2962a46746-pkgs.delve - nixpkgs-5a7b241264578c55cd25aa7422121aef072ce588-pkgs.go_1_22 - nixpkgs-5a7b241264578c55cd25aa7422121aef072ce588-pkgs.goreleaser - nixpkgs-1ebb7d7bba2953a4223956cfb5f068b0095f84a7-pkgs.gotools + nixpkgs-a731d0cb71c58f56895f71a5b02eda2962a46746-pkgs.go + nixpkgs-7445ccd775d8b892fc56448d17345443a05f7fb4-pkgs.go-task + nixpkgs-ac5c1886fd9fe49748d7ab80accc4c847481df14-pkgs.gotools ]; }; diff --git a/pkg/update/update_test.go b/pkg/update/update_test.go index 84f5099d..ea610c09 100644 --- a/pkg/update/update_test.go +++ b/pkg/update/update_test.go @@ -23,7 +23,7 @@ func TestGetLatestPatchVersion(t *testing.T) { }, }, version: "1.2.0", - want: "v1.2.3", + want: "1.2.3", }, { name: "Test Case 2", @@ -35,7 +35,7 @@ func TestGetLatestPatchVersion(t *testing.T) { }, }, version: "1.3.0", - want: "v1.3.3", + want: "1.3.3", }, { name: "Test Case 3", @@ -54,7 +54,7 @@ func TestGetLatestPatchVersion(t *testing.T) { }, }, version: "1.4.0", - want: "v1.4.0", + want: "1.4.0", }, { @@ -67,7 +67,7 @@ func TestGetLatestPatchVersion(t *testing.T) { }, }, version: "1.3.3", - want: "v1.3.3", + want: "1.3.3", }, } @@ -97,7 +97,7 @@ func TestGetLatestMinorVersion(t *testing.T) { }, }, version: "1.2.0", - want: "v1.4.3", + want: "1.4.3", }, { name: "Test Case 2", @@ -111,7 +111,7 @@ func TestGetLatestMinorVersion(t *testing.T) { }, }, version: "1.3.0", - want: "v1.4.1", + want: "1.4.1", }, }