-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (69 loc) · 2.33 KB
/
build.yaml
File metadata and controls
79 lines (69 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Build GitHub Developer Profiler
on:
push:
branches:
- '*'
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ${{ matrix.os }}
env:
VERSION: ''
strategy:
matrix:
include:
- os: ubuntu-latest
goos: linux
goarch: amd64
ext: ""
- os: macos-latest
goos: darwin
goarch: amd64
ext: ""
- os: windows-latest
goos: windows
goarch: amd64
ext: ".exe"
steps:
- uses: actions/checkout@v4
- name: Install Linux dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update && sudo apt-get install -y \
libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxxf86vm-dev \
libgl1-mesa-dev libglu1-mesa-dev build-essential
- name: Install macOS dependencies
if: matrix.os == 'macos-latest'
run: |
# Install required system libraries for Fyne on macOS
brew install pkg-config
- name: Ensure CGO is enabled
run: echo "CGO_ENABLED=1" >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Extract version
id: extract_version
run: echo "VERSION=$(git describe --tags --always --dirty)" >> $GITHUB_ENV
- name: Build for ${{ matrix.goos }}
shell: bash
run: |
echo "VERSION is $VERSION"
BUILD_DATE=$(date -u '+%Y-%m-%d_%H:%M:%S_UTC')
GIT_COMMIT=$(git rev-parse --short HEAD)
OUTFILE=GitHub_Developer_Profiler-${{ matrix.goos }}-${VERSION}-${{ matrix.goarch }}${{ matrix.ext }}
echo "OUTFILE is $OUTFILE"
go build -ldflags="-s -w -X main.version=$VERSION -X main.buildDate=$BUILD_DATE -X main.gitCommit=$GIT_COMMIT" -o $OUTFILE .
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
VERSION: ${{ env.VERSION }}
- name: Test
run: go test -v ./...
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.goos }}-${{ matrix.goarch }}
path: GitHub_Developer_Profiler-${{ matrix.goos }}-${{ env.VERSION }}-${{ matrix.goarch }}${{ matrix.ext }}