Skip to content

Commit f1c49f2

Browse files
committed
misc: Go workflow for building and testing
Sets up a Go workflow to automate building and testing of the project. The workflow configures a matrix strategy to build binaries, shared libraries, and header files for both Linux (amd64) and Windows (amd64) platforms. It also uploads the generated artifacts.
1 parent fff5278 commit f1c49f2

File tree

1 file changed

+35
-4
lines changed

1 file changed

+35
-4
lines changed

.github/workflows/go.yml

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,25 @@ on:
1212
jobs:
1313

1414
build:
15-
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
include:
18+
- os: ubuntu-latest
19+
goos: linux
20+
goarch: amd64
21+
binary_name: quill
22+
shared_lib_name: libquill.so
23+
header_name: libquill.h
24+
artifact_name: quill-linux-amd64
25+
- os: windows-latest
26+
goos: windows
27+
goarch: amd64
28+
binary_name: quill.exe
29+
shared_lib_name: libquill.dll
30+
header_name: libquill.h
31+
artifact_name: quill-windows-amd64
32+
33+
runs-on: ${{ matrix.os }}
1634
steps:
1735
- uses: actions/checkout@v4
1836

@@ -22,10 +40,23 @@ jobs:
2240
go-version: '1.23'
2341

2442
- name: Build Quill Binary
25-
run: go build -o quill ./cmd/quill
43+
env:
44+
GOOS: ${{ matrix.goos }}
45+
GOARCH: ${{ matrix.goarch }}
46+
run: go build -o ${{ matrix.binary_name }} ./cmd/quill
47+
48+
- name: Build Shared Library
49+
env:
50+
GOOS: ${{ matrix.goos }}
51+
GOARCH: ${{ matrix.goarch }}
52+
CGO_ENABLED: 1
53+
run: go build -buildmode=c-shared -o ${{ matrix.shared_lib_name }} ./cmd/c
2654

2755
- name: Upload Quill Binary
2856
uses: actions/upload-artifact@v4
2957
with:
30-
name: quill-binary
31-
path: quill
58+
name: ${{ matrix.artifact_name }}
59+
path: |
60+
${{ matrix.binary_name }}
61+
${{ matrix.shared_lib_name }}
62+
${{ matrix.header_name }}

0 commit comments

Comments
 (0)