mirror of
https://github.com/skidoodle/ctx.git
synced 2026-04-28 03:07:41 +02:00
af9e0a5372
Implement CopyFile for darwin, linux, and windows and call it from main to copy generated output to the clipboard. Enable CGO for builds, update goreleaser and release workflow to use macOS, and add a cross-platform test workflow that verifies the clipboard.
53 lines
1.4 KiB
YAML
53 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 .
|
|
$files = Get-Clipboard -Format FileDropList
|
|
if ($files) {
|
|
Write-Host "Clipboard contains: $files"
|
|
if ($files.Name -contains "ctx.txt") { exit 0 }
|
|
}
|
|
Write-Error "Clipboard did not contain ctx.txt"
|
|
exit 1
|