Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 3 additions & 80 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,89 +8,12 @@ on:
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install mise
uses: jdx/mise-action@v2
with:
version: latest
install: true

- name: Install dependencies
run: |
mise install
sudo apt-get update
sudo apt-get install -y lua5.4

- name: Run linter
run: mise run lint

test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Install mise
uses: jdx/mise-action@v2
with:
version: latest
install: true

- name: Install Lua (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y lua5.4

- name: Install Lua (macOS)
if: runner.os == 'macOS'
run: |
brew install lua

- name: Run tests
run: |
mise install
mise run test

integration-test:
ci:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
semver-version: ['3.4.0', '3.3.0', '3.2.0']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Install mise
uses: jdx/mise-action@v2
with:
version: latest
install: true

- name: Test plugin installation
run: |
# Install the plugin from current directory
mise plugin install semver .

# List available versions
mise ls-remote semver | head -20

# Install specific version
mise install semver@${{ matrix.semver-version }}

# Test execution
mise exec semver@${{ matrix.semver-version }} -- semver --version

# Test basic functionality
mise exec semver@${{ matrix.semver-version }} -- semver bump major 1.2.3 | grep -q "2.0.0"
mise exec semver@${{ matrix.semver-version }} -- semver bump minor 1.2.3 | grep -q "1.3.0"
mise exec semver@${{ matrix.semver-version }} -- semver bump patch 1.2.3 | grep -q "1.2.4"

# Clean up
mise plugin uninstall semver
- uses: jdx/mise-action@v2
- run: mise run ci
32 changes: 0 additions & 32 deletions .github/workflows/release.yml

This file was deleted.

39 changes: 39 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
-- .luacheckrc configuration for mise-semver plugin

-- Globals defined by the vfox plugin system
globals = {
"PLUGIN"
}

-- Read-only globals from vfox environment
read_globals = {
-- Standard Lua globals
"require",
"os",
"io",
"table",
"string",
"math",
"loadfile",
"error",
"ipairs",
"pairs",
"print",
"tostring",
"tonumber",
"type",
"getmetatable",
"setmetatable",

-- vfox context object
"ctx"
}

-- Ignore line length warnings
max_line_length = false

-- Ignore unused arguments in hook functions
unused_args = false

-- Allow trailing whitespace (can be auto-fixed)
allow_defined_top = true
6 changes: 3 additions & 3 deletions hooks/available.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function PLUGIN:Available(ctx)
-- Make API request
local resp, err = http.get({
url = repo_url,
headers = headers
headers = headers,
})

if err ~= nil then
Expand All @@ -39,9 +39,9 @@ function PLUGIN:Available(ctx)
-- Add version to result
table.insert(result, {
version = version,
note = nil
note = nil,
})
end

return result
end
end
6 changes: 3 additions & 3 deletions hooks/env_keys.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function PLUGIN:EnvKeys(ctx)
return {
{
key = "PATH",
value = mainPath .. "/bin"
}
value = mainPath .. "/bin",
},
}
end
end
6 changes: 2 additions & 4 deletions hooks/post_install.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
-- hooks/post_install.lua
function PLUGIN:PostInstall(ctx)
local rootPath = ctx.rootPath
local sdkInfo = ctx.sdkInfo['semver']
local sdkInfo = ctx.sdkInfo["semver"]
local path = sdkInfo.path
local version = sdkInfo.version

-- Create bin directory if it doesn't exist
os.execute("mkdir -p " .. path .. "/bin")
Expand All @@ -24,4 +22,4 @@ function PLUGIN:PostInstall(ctx)
if testResult ~= 0 then
error("semver installation appears to be broken")
end
end
end
4 changes: 2 additions & 2 deletions hooks/pre_install.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ function PLUGIN:PreInstall(ctx)
return {
version = version,
url = url,
note = "Downloading semver " .. version
note = "Downloading semver " .. version,
}
end
end
4 changes: 2 additions & 2 deletions metadata.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ PLUGIN = {
description = "A semantic versioning (semver) command-line tool",
author = "mise-plugins",
updateUrl = "https://github.com/mise-plugins/mise-semver",
minRuntimeVersion = "0.2.0"
}
minRuntimeVersion = "0.2.0",
}
7 changes: 7 additions & 0 deletions mise-tasks/lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
#MISE description="Lint and format check Lua scripts with luacheck and StyLua"
set -euo pipefail

luarocks install luacheck --local || true
~/.luarocks/bin/luacheck metadata.lua hooks/
stylua --check metadata.lua hooks/
18 changes: 18 additions & 0 deletions mise-tasks/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
#MISE description="Run plugin tests - install and verify semver functionality"
set -euo pipefail

mise plugin link --force semver .
mise cache clear
mise install semver@3.4.0

# Capture and display the output while also verifying it
output=$(mise exec semver@3.4.0 -- semver --version)
echo "semver output: $output"

if echo "$output" | grep -q '3.4.0'; then
echo "✓ Tests passed"
else
echo "✗ Test failed: expected version 3.4.0"
exit 1
fi
24 changes: 9 additions & 15 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
[tools]
semver = "3.4.0"
shellcheck = "latest"
shfmt = "latest"

[tasks.test]
description = "Run plugin tests"
run = "./scripts/test.sh"
[env]
MISE_USE_VERSIONS_HOST = "0"

[tasks.lint]
description = "Lint shell and Lua scripts"
run = "./scripts/lint.sh"
[tools]
lua = "5.4"
stylua = "latest"

[tasks."lint:fix"]
description = "Lint and fix shell scripts"
run = "shfmt -w scripts/*.sh"
[tasks.format]
description = "Format Lua scripts"
run = "stylua metadata.lua hooks/"

[tasks.ci]
description = "Run all CI checks"
depends = ["lint", "test"]
depends = ["lint", "test"]
Loading