Skip to content

fix(security): updated OpenSSH configuration for Windows to set corre… #55

fix(security): updated OpenSSH configuration for Windows to set corre…

fix(security): updated OpenSSH configuration for Windows to set corre… #55

Workflow file for this run

name: Test
on:
push:
branches: [main, master, develop]
pull_request:
branches: [main, master, develop]
workflow_dispatch:
jobs:
test:
name: Run Tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: ['1.21', '1.22']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Cache Go modules
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Download dependencies
run: go mod download
- name: Run unit tests
shell: bash
run: go test -v -race -coverprofile=coverage.out ./...
- name: Build binary for integration tests
if: matrix.os != 'windows-latest'
shell: bash
run: go build -o shelldock .
- name: Run integration tests
if: matrix.os != 'windows-latest'
shell: bash
run: |
chmod +x test/test-suite.sh
./test/test-suite.sh
- name: Upload coverage
uses: codecov/codecov-action@v4
if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.21'
with:
file: ./coverage.out
flags: unittests
name: codecov-umbrella
lint:
name: Lint
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.21'
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: latest
args: --timeout=5m
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
goos: [linux, darwin, windows]
goarch: [amd64, arm64]
exclude:
- os: ubuntu-latest
goos: darwin
- os: ubuntu-latest
goos: windows
- os: macos-latest
goos: linux
- os: macos-latest
goos: windows
- os: windows-latest
goos: linux
- os: windows-latest
goos: darwin
- os: ubuntu-latest
goarch: arm64
goos: windows
- os: macos-latest
goarch: arm64
goos: windows
- os: windows-latest
goarch: arm64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Build (Linux/macOS)
if: matrix.os != 'windows-latest'
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
go build -o shelldock-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goos == 'windows' && '.exe' || '' }} .
- name: Install goversioninfo (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@latest
- name: Build (Windows)
if: matrix.os == 'windows-latest'
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
shell: pwsh
run: |
.\scripts\build-windows.ps1 -Version "0.0.0-test" -OutputName "shelldock-${{ matrix.goos }}-${{ matrix.goarch }}.exe"
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.goos }}-${{ matrix.goarch }}
path: shelldock-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goos == 'windows' && '.exe' || '' }}
install-test:
name: Install and Test (${{ matrix.os }})
needs: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
goos: linux
binary_name: shelldock-linux-amd64
artifact_name: build-linux-amd64
install_path: /usr/local/bin/shelldock
- os: macos-latest
goos: darwin
binary_name: shelldock-darwin-amd64
artifact_name: build-darwin-amd64
install_path: /usr/local/bin/shelldock
- os: windows-latest
goos: windows
binary_name: shelldock-windows-amd64.exe
artifact_name: build-windows-amd64
install_path: C:\Program Files\shelldock\shelldock.exe
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download binary artifact
uses: actions/download-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ./build
- name: List downloaded files (Linux/macOS)
if: matrix.os != 'windows-latest'
run: |
ls -la ./build/
- name: List downloaded files (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
Get-ChildItem -Path ./build -Recurse
- name: Install ShellDock (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo mkdir -p /usr/local/bin
# Find the binary file (artifact may have different structure)
BINARY=$(find ./build -name "${{ matrix.binary_name }}" -o -name "shelldock-*" | head -n 1)
if [ -z "$BINARY" ]; then
echo "❌ Binary not found in build directory"
ls -la ./build/
exit 1
fi
sudo cp "$BINARY" ${{ matrix.install_path }}
sudo chmod +x ${{ matrix.install_path }}
echo "${{ matrix.install_path }}" >> $GITHUB_PATH
echo "✅ Installed from: $BINARY"
- name: Install ShellDock (macOS)
if: matrix.os == 'macos-latest'
run: |
sudo mkdir -p /usr/local/bin
# Find the binary file (artifact may have different structure)
BINARY=$(find ./build -name "${{ matrix.binary_name }}" -o -name "shelldock-*" | head -n 1)
if [ -z "$BINARY" ]; then
echo "❌ Binary not found in build directory"
ls -la ./build/
exit 1
fi
sudo cp "$BINARY" ${{ matrix.install_path }}
sudo chmod +x ${{ matrix.install_path }}
echo "${{ matrix.install_path }}" >> $GITHUB_PATH
echo "✅ Installed from: $BINARY"
- name: Install ShellDock (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
New-Item -ItemType Directory -Path "C:\Program Files\shelldock" -Force
# Find the binary file (artifact may have different structure)
$binary = Get-ChildItem -Path ./build -Recurse -Filter "shelldock*.exe" | Select-Object -First 1
if (-not $binary) {
Write-Error "Binary not found in build directory"
Get-ChildItem -Path ./build -Recurse
exit 1
}
Copy-Item $binary.FullName "${{ matrix.install_path }}"
$env:PATH += ";C:\Program Files\shelldock"
echo "C:\Program Files\shelldock" | Out-File -FilePath $env:GITHUB_PATH -Append
Write-Host "✅ Installed from: $($binary.FullName)"
- name: Verify installation (Linux/macOS)
if: matrix.os != 'windows-latest'
run: |
which shelldock || (echo "shelldock not in PATH" && exit 1)
shelldock --version
echo "✅ Installation verified"
- name: Verify installation (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
if (-not (Get-Command shelldock -ErrorAction SilentlyContinue)) {
Write-Error "shelldock not in PATH"
exit 1
}
shelldock --version
Write-Host "✅ Installation verified"
- name: Test basic commands (Linux/macOS)
if: matrix.os != 'windows-latest'
run: |
echo "Testing shelldock list..."
shelldock list
echo "Testing shelldock show test..."
shelldock show test
echo "✅ Basic commands work"
- name: Test basic commands (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
Write-Host "Testing shelldock list..."
shelldock list
Write-Host "Testing shelldock show test..."
shelldock show test
Write-Host "✅ Basic commands work"
- name: Run test command set (Linux/macOS)
if: matrix.os != 'windows-latest'
run: |
echo "Running shelldock test command set..."
shelldock test --yes
echo "✅ Test command set executed successfully"
- name: Run test command set (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
Write-Host "Running shelldock test command set..."
shelldock test --yes
Write-Host "✅ Test command set executed successfully"
- name: Test version flag
if: matrix.os != 'windows-latest'
run: |
VERSION=$(shelldock --version)
if [ -z "$VERSION" ]; then
echo "❌ Version command failed"
exit 1
fi
echo "✅ Version: $VERSION"
- name: Test version flag (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
$version = shelldock --version
if ([string]::IsNullOrEmpty($version)) {
Write-Error "Version command failed"
exit 1
}
Write-Host "✅ Version: $version"
- name: Test help command
if: matrix.os != 'windows-latest'
run: |
shelldock --help | head -n 5
echo "✅ Help command works"
- name: Test help command (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
shelldock --help | Select-Object -First 5
Write-Host "✅ Help command works"