Compare commits

...

5 Commits

Author SHA1 Message Date
bagas 467d43641f ci: migrate docker build to multi-machine multi-arch matrix
Docker Build and Push / Run Tests (push) Successful in 2m6s
Docker Build and Push / Build (linux/amd64) (push) Failing after 1m55s
Docker Build and Push / Build (linux/arm64) (push) Failing after 2m10s
Docker Build and Push / Merge Multi-Arch Manifest (push) Has been skipped
2026-04-07 23:27:12 +07:00
bagas d029f9e93d chore: configure renovate to group and automerge dependencies
Tests / Run Tests (pull_request) Successful in 2m8s
2026-04-01 21:11:45 +07:00
bagas 4af011b91d refactor: move types package to internal
Tests / Run Tests (pull_request) Successful in 2m7s
2026-03-30 11:50:24 +07:00
bagas ae71b46482 refactor: move session package to internal
Tests / Run Tests (pull_request) Successful in 2m4s
2026-03-30 11:37:59 +07:00
bagas 7ecc56aa3c refactor: move server package to internal
Tests / Run Tests (pull_request) Successful in 2m37s
2026-03-30 11:18:44 +07:00
32 changed files with 214 additions and 98 deletions
+151 -40
View File
@@ -9,7 +9,6 @@ jobs:
test: test:
name: Run Tests name: Run Tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v6 uses: actions/checkout@v6
@@ -29,16 +28,35 @@ jobs:
- name: Run tests - name: Run tests
run: go test -v -p 4 ./... run: go test -v -p 4 ./...
build-amd64:
build-and-push: name: Build (linux/amd64)
name: Build and Push Docker Image runs-on: [ubuntu-latest, amd64]
runs-on: ubuntu-latest
needs: test needs: test
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v6 uses: actions/checkout@v6
- name: Extract version
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
echo "COMMIT=${{ github.sha }}" >> $GITHUB_OUTPUT
if echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$'; then
echo "MAJOR=$(echo "$VERSION" | cut -d. -f1)" >> $GITHUB_OUTPUT
echo "MINOR=$(echo "$VERSION" | cut -d. -f2)" >> $GITHUB_OUTPUT
if echo "$VERSION" | grep -q '-'; then
echo "IS_PRERELEASE=true" >> $GITHUB_OUTPUT
else
echo "IS_PRERELEASE=false" >> $GITHUB_OUTPUT
fi
else
echo "Invalid version format: $VERSION"
exit 1
fi
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
@@ -49,7 +67,42 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract version and determine release type - name: Build and push by digest
id: build
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
outputs: >-
type=image,name=git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please,push-by-digest=true,name-canonical=true,push=true
build-args: |
VERSION=${{ steps.version.outputs.VERSION }}
BUILD_DATE=${{ steps.version.outputs.BUILD_DATE }}
COMMIT=${{ steps.version.outputs.COMMIT }}
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-linux-amd64
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
build-arm64:
name: Build (linux/arm64)
runs-on: [ubuntu-latest, arm64]
needs: test
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Extract version
id: version id: version
run: | run: |
VERSION=${GITHUB_REF#refs/tags/v} VERSION=${GITHUB_REF#refs/tags/v}
@@ -58,18 +111,10 @@ jobs:
echo "COMMIT=${{ github.sha }}" >> $GITHUB_OUTPUT echo "COMMIT=${{ github.sha }}" >> $GITHUB_OUTPUT
if echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$'; then if echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$'; then
MAJOR=$(echo "$VERSION" | cut -d. -f1) echo "MAJOR=$(echo "$VERSION" | cut -d. -f1)" >> $GITHUB_OUTPUT
MINOR=$(echo "$VERSION" | cut -d. -f2) echo "MINOR=$(echo "$VERSION" | cut -d. -f2)" >> $GITHUB_OUTPUT
PATCH=$(echo "$VERSION" | cut -d. -f3 | cut -d- -f1)
echo "MAJOR=$MAJOR" >> $GITHUB_OUTPUT
echo "MINOR=$MINOR" >> $GITHUB_OUTPUT
echo "PATCH=$PATCH" >> $GITHUB_OUTPUT
if echo "$VERSION" | grep -q '-'; then if echo "$VERSION" | grep -q '-'; then
PRERELEASE_TAG=$(echo "$VERSION" | cut -d- -f2 | cut -d. -f1)
echo "IS_PRERELEASE=true" >> $GITHUB_OUTPUT echo "IS_PRERELEASE=true" >> $GITHUB_OUTPUT
echo "PRERELEASE_TAG=$PRERELEASE_TAG" >> $GITHUB_OUTPUT
else else
echo "IS_PRERELEASE=false" >> $GITHUB_OUTPUT echo "IS_PRERELEASE=false" >> $GITHUB_OUTPUT
fi fi
@@ -78,35 +123,101 @@ jobs:
exit 1 exit 1
fi fi
- name: Build and push Docker image (release) - name: Set up Docker Buildx
uses: docker/build-push-action@v6 uses: docker/setup-buildx-action@v3
with:
context: .
push: true
tags: |
git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please:v${{ steps.version.outputs.VERSION }}
git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please:release
git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please:v${{ steps.version.outputs.MAJOR }}.${{ steps.version.outputs.MINOR }}
git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please:v${{ steps.version.outputs.MAJOR }}
git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please:latest
platforms: linux/amd64,linux/arm64
build-args: |
VERSION=${{ steps.version.outputs.VERSION }}
BUILD_DATE=${{ steps.version.outputs.BUILD_DATE }}
COMMIT=${{ steps.version.outputs.COMMIT }}
if: steps.version.outputs.IS_PRERELEASE == 'false'
- name: Build and push Docker image (pre-release) - name: Log in to Docker Registry
uses: docker/login-action@v3
with:
registry: git.fossy.my.id
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push by digest
id: build
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
context: . context: .
push: true platforms: linux/arm64
tags: | outputs: >-
git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please:v${{ steps.version.outputs.VERSION }} type=image,name=git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please,push-by-digest=true,name-canonical=true,push=true
git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please:staging
platforms: linux/amd64,linux/arm64
build-args: | build-args: |
VERSION=${{ steps.version.outputs.VERSION }} VERSION=${{ steps.version.outputs.VERSION }}
BUILD_DATE=${{ steps.version.outputs.BUILD_DATE }} BUILD_DATE=${{ steps.version.outputs.BUILD_DATE }}
COMMIT=${{ steps.version.outputs.COMMIT }} COMMIT=${{ steps.version.outputs.COMMIT }}
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-linux-arm64
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
merge:
name: Merge Multi-Arch Manifest
runs-on: ubuntu-latest
needs: [build-amd64, build-arm64]
steps:
- name: Download all digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true
- name: Extract version
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
if echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$'; then
echo "MAJOR=$(echo "$VERSION" | cut -d. -f1)" >> $GITHUB_OUTPUT
echo "MINOR=$(echo "$VERSION" | cut -d. -f2)" >> $GITHUB_OUTPUT
if echo "$VERSION" | grep -q '-'; then
echo "IS_PRERELEASE=true" >> $GITHUB_OUTPUT
else
echo "IS_PRERELEASE=false" >> $GITHUB_OUTPUT
fi
else
echo "Invalid version format: $VERSION"
exit 1
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Registry
uses: docker/login-action@v3
with:
registry: git.fossy.my.id
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Create and push manifest (release)
working-directory: /tmp/digests
if: steps.version.outputs.IS_PRERELEASE == 'false'
run: |
docker buildx imagetools create \
-t git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please:v${{ steps.version.outputs.VERSION }} \
-t git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please:release \
-t git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please:v${{ steps.version.outputs.MAJOR }}.${{ steps.version.outputs.MINOR }} \
-t git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please:v${{ steps.version.outputs.MAJOR }} \
-t git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please:latest \
$(printf 'git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please@sha256:%s ' *)
- name: Create and push manifest (pre-release)
working-directory: /tmp/digests
if: steps.version.outputs.IS_PRERELEASE == 'true' if: steps.version.outputs.IS_PRERELEASE == 'true'
run: |
docker buildx imagetools create \
-t git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please:v${{ steps.version.outputs.VERSION }} \
-t git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please:staging \
$(printf 'git.fossy.my.id/${{ secrets.DOCKER_USERNAME }}/tunnel-please@sha256:%s ' *)
+2 -2
View File
@@ -15,10 +15,10 @@ import (
"tunnel_pls/internal/port" "tunnel_pls/internal/port"
"tunnel_pls/internal/random" "tunnel_pls/internal/random"
"tunnel_pls/internal/registry" "tunnel_pls/internal/registry"
"tunnel_pls/internal/server"
"tunnel_pls/internal/transport" "tunnel_pls/internal/transport"
"tunnel_pls/internal/types"
"tunnel_pls/internal/version" "tunnel_pls/internal/version"
"tunnel_pls/server"
"tunnel_pls/types"
"golang.org/x/crypto/ssh" "golang.org/x/crypto/ssh"
) )
+2 -2
View File
@@ -14,8 +14,8 @@ import (
"tunnel_pls/internal/config" "tunnel_pls/internal/config"
"tunnel_pls/internal/port" "tunnel_pls/internal/port"
"tunnel_pls/internal/registry" "tunnel_pls/internal/registry"
"tunnel_pls/session/slug" "tunnel_pls/internal/session/slug"
"tunnel_pls/types" "tunnel_pls/internal/types"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock" "github.com/stretchr/testify/mock"
+3 -1
View File
@@ -1,6 +1,8 @@
package config package config
import "tunnel_pls/types" import (
"tunnel_pls/internal/types"
)
type Config interface { type Config interface {
Domain() string Domain() string
+1 -1
View File
@@ -3,7 +3,7 @@ package config
import ( import (
"os" "os"
"testing" "testing"
"tunnel_pls/types" "tunnel_pls/internal/types"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"os" "os"
"strconv" "strconv"
"strings" "strings"
"tunnel_pls/types" "tunnel_pls/internal/types"
"github.com/joho/godotenv" "github.com/joho/godotenv"
) )
+1 -1
View File
@@ -9,7 +9,7 @@ import (
"time" "time"
"tunnel_pls/internal/config" "tunnel_pls/internal/config"
"tunnel_pls/internal/registry" "tunnel_pls/internal/registry"
"tunnel_pls/types" "tunnel_pls/internal/types"
proto "git.fossy.my.id/bagas/tunnel-please-grpc/gen" proto "git.fossy.my.id/bagas/tunnel-please-grpc/gen"
"google.golang.org/grpc" "google.golang.org/grpc"
+5 -5
View File
@@ -7,14 +7,14 @@ import (
"io" "io"
"testing" "testing"
"time" "time"
"tunnel_pls/internal/session/forwarder"
"tunnel_pls/internal/session/interaction"
"tunnel_pls/internal/session/lifecycle"
"tunnel_pls/internal/session/slug"
"tunnel_pls/internal/types"
"tunnel_pls/internal/port" "tunnel_pls/internal/port"
"tunnel_pls/internal/registry" "tunnel_pls/internal/registry"
"tunnel_pls/session/forwarder"
"tunnel_pls/session/interaction"
"tunnel_pls/session/lifecycle"
"tunnel_pls/session/slug"
"tunnel_pls/types"
proto "git.fossy.my.id/bagas/tunnel-please-grpc/gen" proto "git.fossy.my.id/bagas/tunnel-please-grpc/gen"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
+5 -5
View File
@@ -3,11 +3,11 @@ package registry
import ( import (
"fmt" "fmt"
"sync" "sync"
"tunnel_pls/session/forwarder" "tunnel_pls/internal/session/forwarder"
"tunnel_pls/session/interaction" "tunnel_pls/internal/session/interaction"
"tunnel_pls/session/lifecycle" "tunnel_pls/internal/session/lifecycle"
"tunnel_pls/session/slug" "tunnel_pls/internal/session/slug"
"tunnel_pls/types" "tunnel_pls/internal/types"
) )
type Key = types.SessionKey type Key = types.SessionKey
+5 -5
View File
@@ -5,11 +5,11 @@ import (
"testing" "testing"
"time" "time"
"tunnel_pls/internal/port" "tunnel_pls/internal/port"
"tunnel_pls/session/forwarder" "tunnel_pls/internal/session/forwarder"
"tunnel_pls/session/interaction" "tunnel_pls/internal/session/interaction"
"tunnel_pls/session/lifecycle" "tunnel_pls/internal/session/lifecycle"
"tunnel_pls/session/slug" "tunnel_pls/internal/session/slug"
"tunnel_pls/types" "tunnel_pls/internal/types"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock" "github.com/stretchr/testify/mock"
@@ -13,7 +13,7 @@ import (
"tunnel_pls/internal/port" "tunnel_pls/internal/port"
"tunnel_pls/internal/random" "tunnel_pls/internal/random"
"tunnel_pls/internal/registry" "tunnel_pls/internal/registry"
"tunnel_pls/session" "tunnel_pls/internal/session"
"golang.org/x/crypto/ssh" "golang.org/x/crypto/ssh"
) )
@@ -10,8 +10,8 @@ import (
"testing" "testing"
"time" "time"
"tunnel_pls/internal/registry" "tunnel_pls/internal/registry"
"tunnel_pls/session/slug" "tunnel_pls/internal/session/slug"
"tunnel_pls/types" "tunnel_pls/internal/types"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock" "github.com/stretchr/testify/mock"
@@ -10,8 +10,8 @@ import (
"strconv" "strconv"
"sync" "sync"
"tunnel_pls/internal/config" "tunnel_pls/internal/config"
"tunnel_pls/session/slug" "tunnel_pls/internal/session/slug"
"tunnel_pls/types" "tunnel_pls/internal/types"
"golang.org/x/crypto/ssh" "golang.org/x/crypto/ssh"
) )
@@ -10,8 +10,8 @@ import (
"sync/atomic" "sync/atomic"
"testing" "testing"
"time" "time"
"tunnel_pls/session/slug" "tunnel_pls/internal/session/slug"
"tunnel_pls/types" "tunnel_pls/internal/types"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock" "github.com/stretchr/testify/mock"
@@ -6,8 +6,8 @@ import (
"sync" "sync"
"tunnel_pls/internal/config" "tunnel_pls/internal/config"
"tunnel_pls/internal/random" "tunnel_pls/internal/random"
"tunnel_pls/session/slug" "tunnel_pls/internal/session/slug"
"tunnel_pls/types" "tunnel_pls/internal/types"
"github.com/charmbracelet/bubbles/help" "github.com/charmbracelet/bubbles/help"
"github.com/charmbracelet/bubbles/key" "github.com/charmbracelet/bubbles/key"
@@ -7,7 +7,7 @@ import (
"net" "net"
"testing" "testing"
"time" "time"
"tunnel_pls/types" "tunnel_pls/internal/types"
"github.com/charmbracelet/bubbles/key" "github.com/charmbracelet/bubbles/key"
"github.com/charmbracelet/bubbles/list" "github.com/charmbracelet/bubbles/list"
@@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"time" "time"
"tunnel_pls/internal/random" "tunnel_pls/internal/random"
"tunnel_pls/types" "tunnel_pls/internal/types"
"github.com/charmbracelet/bubbles/help" "github.com/charmbracelet/bubbles/help"
"github.com/charmbracelet/bubbles/key" "github.com/charmbracelet/bubbles/key"
@@ -3,7 +3,7 @@ package interaction
import ( import (
"fmt" "fmt"
"strings" "strings"
"tunnel_pls/types" "tunnel_pls/internal/types"
"github.com/charmbracelet/bubbles/key" "github.com/charmbracelet/bubbles/key"
"github.com/charmbracelet/bubbles/textinput" "github.com/charmbracelet/bubbles/textinput"
@@ -6,10 +6,10 @@ import (
"net" "net"
"sync" "sync"
"time" "time"
"tunnel_pls/internal/session/slug"
"tunnel_pls/internal/types"
portUtil "tunnel_pls/internal/port" portUtil "tunnel_pls/internal/port"
"tunnel_pls/session/slug"
"tunnel_pls/types"
"golang.org/x/crypto/ssh" "golang.org/x/crypto/ssh"
) )
@@ -6,7 +6,7 @@ import (
"io" "io"
"net" "net"
"testing" "testing"
"tunnel_pls/types" "tunnel_pls/internal/types"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock" "github.com/stretchr/testify/mock"
@@ -12,12 +12,12 @@ import (
portUtil "tunnel_pls/internal/port" portUtil "tunnel_pls/internal/port"
"tunnel_pls/internal/random" "tunnel_pls/internal/random"
"tunnel_pls/internal/registry" "tunnel_pls/internal/registry"
"tunnel_pls/internal/session/forwarder"
"tunnel_pls/internal/session/interaction"
"tunnel_pls/internal/session/lifecycle"
"tunnel_pls/internal/session/slug"
"tunnel_pls/internal/transport" "tunnel_pls/internal/transport"
"tunnel_pls/session/forwarder" "tunnel_pls/internal/types"
"tunnel_pls/session/interaction"
"tunnel_pls/session/lifecycle"
"tunnel_pls/session/slug"
"tunnel_pls/types"
"golang.org/x/crypto/ssh" "golang.org/x/crypto/ssh"
) )
@@ -15,8 +15,8 @@ import (
"time" "time"
"tunnel_pls/internal/config" "tunnel_pls/internal/config"
"tunnel_pls/internal/registry" "tunnel_pls/internal/registry"
"tunnel_pls/session/lifecycle" "tunnel_pls/internal/session/lifecycle"
"tunnel_pls/types" "tunnel_pls/internal/types"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock" "github.com/stretchr/testify/mock"
+1 -1
View File
@@ -16,7 +16,7 @@ import (
"tunnel_pls/internal/http/stream" "tunnel_pls/internal/http/stream"
"tunnel_pls/internal/middleware" "tunnel_pls/internal/middleware"
"tunnel_pls/internal/registry" "tunnel_pls/internal/registry"
"tunnel_pls/types" "tunnel_pls/internal/types"
"golang.org/x/crypto/ssh" "golang.org/x/crypto/ssh"
) )
+5 -5
View File
@@ -11,11 +11,11 @@ import (
"testing" "testing"
"time" "time"
"tunnel_pls/internal/registry" "tunnel_pls/internal/registry"
"tunnel_pls/session/forwarder" "tunnel_pls/internal/session/forwarder"
"tunnel_pls/session/interaction" "tunnel_pls/internal/session/interaction"
"tunnel_pls/session/lifecycle" "tunnel_pls/internal/session/lifecycle"
"tunnel_pls/session/slug" "tunnel_pls/internal/session/slug"
"tunnel_pls/types" "tunnel_pls/internal/types"
"golang.org/x/crypto/ssh" "golang.org/x/crypto/ssh"
+1 -1
View File
@@ -14,7 +14,7 @@ import (
"testing" "testing"
"time" "time"
"tunnel_pls/internal/config" "tunnel_pls/internal/config"
"tunnel_pls/types" "tunnel_pls/internal/types"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock" "github.com/stretchr/testify/mock"
+5 -2
View File
@@ -2,6 +2,8 @@
"extends": [ "extends": [
"config:recommended" "config:recommended"
], ],
"prConcurrentLimit": 1,
"prHourlyLimit": 1,
"packageRules": [ "packageRules": [
{ {
"matchUpdateTypes": [ "matchUpdateTypes": [
@@ -10,9 +12,10 @@
"pin", "pin",
"digest" "digest"
], ],
"groupName": "all-dependencies",
"automerge": true, "automerge": true,
"baseBranchPatterns": [ "matchPackageNames": [
"staging" "*"
] ]
} }
] ]