mirror of
https://github.com/skidoodle/ctx.git
synced 2026-04-28 11:17:42 +02:00
bd22ad5500
Run `go test -v ./...` in the release workflow before GoReleaser. In the Windows test job replace Get-Clipboard with System.Windows.Forms::GetFileDropList(), check for "$PWD\ctx.txt" and improve success/error output.
54 lines
1.4 KiB
YAML
54 lines
1.4 KiB
YAML
name: Test Build
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
|
|
jobs:
|
|
test:
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: stable
|
|
|
|
- name: Enable CGO (Mac/Linux only)
|
|
if: matrix.os != 'windows-latest'
|
|
run: echo "CGO_ENABLED=1" >> $GITHUB_ENV
|
|
|
|
- name: Build
|
|
run: go build -v .
|
|
|
|
- name: Verify Clipboard (Linux)
|
|
if: matrix.os == 'ubuntu-latest'
|
|
run: |
|
|
sudo apt-get update && sudo apt-get install -y xclip xvfb
|
|
|
|
xvfb-run sh -c '
|
|
./ctx .
|
|
CLIP_CONTENT=$(xclip -selection clipboard -o -t text/uri-list)
|
|
echo "Clipboard contains: $CLIP_CONTENT"
|
|
echo "$CLIP_CONTENT" | grep "file://" || exit 1
|
|
echo "$CLIP_CONTENT" | grep "ctx.txt" || exit 1
|
|
'
|
|
|
|
- name: Verify Clipboard (Windows)
|
|
if: matrix.os == 'windows-latest'
|
|
run: |
|
|
./ctx.exe .
|
|
Add-Type -AssemblyName System.Windows.Forms
|
|
$files = [System.Windows.Forms.Clipboard]::GetFileDropList()
|
|
if ($files.Contains("$PWD\ctx.txt")) {
|
|
Write-Host "Success: Clipboard contains ctx.txt"
|
|
exit 0
|
|
}
|
|
Write-Error "Clipboard did not contain ctx.txt. Found: $files"
|
|
exit 1
|