Compare commits

...

9 Commits

6 changed files with 34 additions and 172 deletions
+5 -71
View File
@@ -5,79 +5,13 @@ on:
schedule: schedule:
- cron: "0 3 * * *" - cron: "0 3 * * *"
env:
GO_VERSION: ">=1.21"
permissions: permissions:
contents: write contents: write
actions: write actions: write
jobs: jobs:
# This job is responsible for preparation of the build autoupdate:
# environment variables. uses: lukaszraczylo/shared-actions/.github/workflows/go-autoupdate.yaml@main
prepare: with:
name: Preparing build context go-version: ">=1.21"
runs-on: ubuntu-latest release-workflow: "release.yml"
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
id: cache
with:
go-version: ${{env.GO_VERSION}}
cache-dependency-path: "**/*.sum"
- name: Go get dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
go get ./...
# This job is responsible for running tests and linting the codebase
test:
name: "Unit testing"
runs-on: ubuntu-latest
container: golang:1
needs: [prepare]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure full history is checked out
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{env.GO_VERSION}}
cache-dependency-path: "**/*.sum"
- name: Install dependencies
run: |
apt-get update
apt-get install ca-certificates make -y
update-ca-certificates
go mod tidy
go get -u -v ./...
go mod tidy -v
- name: Run unit tests
run: |
CI_RUN=${CI} make test
git config --global --add safe.directory /__w/kportal/kportal
- name: Commit changes
id: auto-commit
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Update go.mod and go.sum"
commit_options: "--no-verify --signoff"
file_pattern: "go.mod go.sum"
- name: Trigger release workflow
if: steps.auto-commit.outputs.changes_detected == 'true'
run: gh workflow run release.yml
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+8 -80
View File
@@ -5,90 +5,18 @@ on:
branches: branches:
- main - main
paths: paths:
- '**.go' - "**.go"
- 'go.mod' - "go.mod"
- 'go.sum' - "go.sum"
workflow_dispatch: workflow_dispatch:
permissions: permissions:
contents: write contents: write
jobs: jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Run tests with race detector
run: go test -race -v ./...
version:
name: Calculate Version
needs: test
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version_formatted.outputs.version }}
version_tag: ${{ steps.version_formatted.outputs.version_tag }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Calculate semantic version
id: semver
uses: lukaszraczylo/semver-generator@v1
with:
config_file: semver.yaml
repository_local: true
- name: Format version
id: version_formatted
run: |
VERSION="${{ steps.semver.outputs.semantic_version }}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "version_tag=v${VERSION}" >> $GITHUB_OUTPUT
- name: Display version
run: |
echo "Calculated version: ${{ steps.version_formatted.outputs.version }}"
echo "Version tag: ${{ steps.version_formatted.outputs.version_tag }}"
release: release:
name: Release with GoReleaser uses: lukaszraczylo/shared-actions/.github/workflows/go-release.yaml@main
needs: version with:
runs-on: ubuntu-latest go-version: "1.23"
steps: secrets:
- name: Checkout code homebrew-tap-token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Create and push tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a ${{ needs.version.outputs.version_tag }} -m "Release ${{ needs.version.outputs.version_tag }}"
git push origin ${{ needs.version.outputs.version_tag }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: '~> v2'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
+11 -9
View File
@@ -23,11 +23,11 @@ builds:
archives: archives:
- id: kportal - id: kportal
format: tar.gz formats: [tar.gz]
name_template: "kportal-{{ .Version }}-{{ .Os }}-{{ .Arch }}" name_template: "kportal-{{ .Version }}-{{ .Os }}-{{ .Arch }}"
format_overrides: format_overrides:
- goos: windows - goos: windows
format: zip formats: [zip]
files: files:
- LICENSE - LICENSE
- README.md - README.md
@@ -53,17 +53,19 @@ release:
draft: false draft: false
prerelease: auto prerelease: auto
brews: homebrew_casks:
- repository: - repository:
owner: lukaszraczylo owner: lukaszraczylo
name: homebrew-taps name: homebrew-taps
token: "{{ .Env.HOMEBREW_TAP_TOKEN }}" token: "{{ .Env.HOMEBREW_TAP_TOKEN }}"
directory: Formula directory: Casks
homepage: https://lukaszraczylo.github.io/kportal homepage: https://lukaszraczylo.github.io/kportal
description: "Modern Kubernetes port-forward manager with interactive TUI" description: "Modern Kubernetes port-forward manager with interactive TUI"
license: MIT license: MIT
test: | hooks:
system "#{bin}/kportal", "--version" post:
dependencies: install: |
- name: kubernetes-cli if OS.mac?
type: optional system_command "/usr/bin/xattr",
args: ["-dr", "com.apple.quarantine", "#{staged_path}/kportal"]
end
+7 -2
View File
@@ -54,12 +54,17 @@ kportal manages multiple Kubernetes port-forwards with an interactive terminal i
## 📦 Installation ## 📦 Installation
### Homebrew (macOS/Linux) ### Homebrew (macOS)
```bash ```bash
brew install lukaszraczylo/taps/kportal brew install --cask lukaszraczylo/taps/kportal
``` ```
> **Note**: If you previously installed via `brew install lukaszraczylo/taps/kportal` (formula), uninstall first:
> ```bash
> brew uninstall kportal
> ```
### Quick Install ### Quick Install
```bash ```bash
+3 -3
View File
@@ -556,11 +556,11 @@
<i class="fas fa-beer text-orange-500 dark:text-orange-400 text-2xl mr-3"></i> <i class="fas fa-beer text-orange-500 dark:text-orange-400 text-2xl mr-3"></i>
<div> <div>
<h3 class="text-xl font-semibold text-gray-900 dark:text-gray-100">Homebrew</h3> <h3 class="text-xl font-semibold text-gray-900 dark:text-gray-100">Homebrew</h3>
<p class="text-gray-600 dark:text-gray-400 text-sm">macOS & Linux</p> <p class="text-gray-600 dark:text-gray-400 text-sm">macOS</p>
</div> </div>
</div> </div>
<div onclick="copyToClipboard('brew install lukaszraczylo/taps/kportal', this)" class="relative bg-gradient-to-br from-gray-900 to-gray-800 dark:from-gray-950 dark:to-black text-gray-100 p-4 rounded-lg text-sm cursor-pointer group overflow-x-auto border border-gray-700 hover:border-orange-500 transition-all duration-300"> <div onclick="copyToClipboard('brew install --cask lukaszraczylo/taps/kportal', this)" class="relative bg-gradient-to-br from-gray-900 to-gray-800 dark:from-gray-950 dark:to-black text-gray-100 p-4 rounded-lg text-sm cursor-pointer group overflow-x-auto border border-gray-700 hover:border-orange-500 transition-all duration-300">
<code class="block whitespace-nowrap font-mono">brew install lukaszraczylo/taps/kportal</code> <code class="block whitespace-nowrap font-mono">brew install --cask lukaszraczylo/taps/kportal</code>
<div class="absolute top-3 right-3"><i class="fas fa-copy text-gray-500 group-hover:text-orange-400 transition-colors duration-300"></i></div> <div class="absolute top-3 right-3"><i class="fas fa-copy text-gray-500 group-hover:text-orange-400 transition-colors duration-300"></i></div>
</div> </div>
</div> </div>
-7
View File
@@ -221,10 +221,3 @@ func (r *Runner) makeRequest(ctx context.Context, cfg Config) (statusCode int, b
return resp.StatusCode, int64(len(respBody)), bytesWritten, nil return resp.StatusCode, int64(len(respBody)), bytesWritten, nil
} }
// Progress represents the current progress of a benchmark run
type Progress struct {
Completed int
Total int
Elapsed time.Duration
}