| 1 |
name: Build clipboard |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- master |
| 7 |
pull_request: |
| 8 |
branches: |
| 9 |
- master |
| 10 |
|
| 11 |
concurrency: |
| 12 |
group: ${{ github.workflow }}-${{ github.ref }} |
| 13 |
cancel-in-progress: true |
| 14 |
|
| 15 |
permissions: |
| 16 |
contents: read |
| 17 |
|
| 18 |
jobs: |
| 19 |
linux: |
| 20 |
runs-on: ubuntu-latest |
| 21 |
steps: |
| 22 |
- name: Harden Runner |
| 23 |
uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf |
| 24 |
with: |
| 25 |
egress-policy: audit |
| 26 |
allowed-endpoints: > |
| 27 |
github.com:443 |
| 28 |
objects.githubusercontent.com:443 |
| 29 |
proxy.golang.org:443 |
| 30 |
raw.githubusercontent.com:443 |
| 31 |
storage.googleapis.com:443 |
| 32 |
sum.golang.org:443 |
| 33 |
golang.org:443 |
| 34 |
go.dev:443 |
| 35 |
azure.archive.ubuntu.com:443 |
| 36 |
azure.archive.ubuntu.com:80 |
| 37 |
archive.ubuntu.com:443 |
| 38 |
security.ubuntu.com:443 |
| 39 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| 40 |
with: |
| 41 |
fetch-depth: 0 |
| 42 |
|
| 43 |
- name: Set up Go |
| 44 |
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b |
| 45 |
with: |
| 46 |
go-version: '1.24' |
| 47 |
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 |
| 48 |
with: |
| 49 |
path: ~/go/pkg/mod |
| 50 |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| 51 |
restore-keys: | |
| 52 |
${{ runner.os }}-go- |
| 53 |
- name: Ubuntu Dependencies |
| 54 |
run: sudo apt-get install --yes wl-clipboard xclip xsel xvfb x11-xserver-utils |
| 55 |
|
| 56 |
- |
| 57 |
name: Debug |
| 58 |
run: | |
| 59 |
echo "Go env ------------------" |
| 60 |
pwd |
| 61 |
echo ${HOME} |
| 62 |
echo ${GITHUB_WORKSPACE} |
| 63 |
echo ${GOPATH} |
| 64 |
echo ${GOROOT} |
| 65 |
echo ${DISPLAY} |
| 66 |
env |
| 67 |
|
| 68 |
- name: Build and Unit Test |
| 69 |
run: xvfb-run --auto-servernum go test ./... |
| 70 |
|
| 71 |
- name: cleanup xvfb |
| 72 |
run: | |
| 73 |
xvfb_pids=`ps aux | grep tmp/xvfb-run | grep -v grep | awk '{print $2}'` |
| 74 |
if [ "$xvfb_pids" != "" ]; then |
| 75 |
echo "Killing the following xvfb processes: $xvfb_pids" |
| 76 |
sudo kill $xvfb_pids |
| 77 |
else |
| 78 |
echo "No xvfb processes to kill" |
| 79 |
fi |
| 80 |
env: |
| 81 |
CI: true |
| 82 |
|
| 83 |
windows: |
| 84 |
runs-on: windows-latest |
| 85 |
defaults: |
| 86 |
run: |
| 87 |
shell: msys2 {0} |
| 88 |
steps: |
| 89 |
- name: Harden Runner |
| 90 |
uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf |
| 91 |
with: |
| 92 |
egress-policy: audit |
| 93 |
|
| 94 |
- uses: msys2/setup-msys2@61f9e5e925871ba6c9e3e8da24ede83ea27fa91f |
| 95 |
with: |
| 96 |
release: false |
| 97 |
path-type: inherit |
| 98 |
install: >- |
| 99 |
base-devel |
| 100 |
git |
| 101 |
|
| 102 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| 103 |
with: |
| 104 |
fetch-depth: 0 |
| 105 |
|
| 106 |
- name: Set up Go |
| 107 |
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b |
| 108 |
with: |
| 109 |
go-version: '1.24' |
| 110 |
|
| 111 |
- name: Build and Unit Test |
| 112 |
run: go test ./... |
| 113 |
|
| 114 |
macos: |
| 115 |
runs-on: macos-latest |
| 116 |
steps: |
| 117 |
- name: Harden Runner |
| 118 |
uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf |
| 119 |
with: |
| 120 |
egress-policy: audit |
| 121 |
|
| 122 |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| 123 |
with: |
| 124 |
fetch-depth: 0 |
| 125 |
|
| 126 |
- name: Set up Go |
| 127 |
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b |
| 128 |
with: |
| 129 |
go-version: '1.24' |
| 130 |
|
| 131 |
- name: Build and Unit Test |
| 132 |
run: go test ./... |