-
Notifications
You must be signed in to change notification settings - Fork 6
43 lines (41 loc) · 2.5 KB
/
build.yml
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
name: build
on:
workflow_call:
inputs:
version:
type: string
jobs:
static:
runs-on: ubuntu-latest
container:
image: debian:bookworm-slim
steps:
- uses: actions/checkout@v4
- run: |
apt-get update -qq
apt-get install -y --no-install-recommends ca-certificates gcc libc6-dev
- uses: actions/setup-go@v5
with:
go-version: '>=1.24.0'
- run: |
go generate ./migrations
go vet ./...
(cd /tmp && go install honnef.co/go/tools/cmd/staticcheck@latest)
~/go/bin/staticcheck ./...
go test ./... -failfast -vet off -tags netgo,sqlite_omit_load_extension,fts5 -race
- run: |
CGO_CFLAGS="-O2 -fomit-frame-pointer -ffunction-sections -fdata-sections -fmerge-all-constants" go build -tags netgo,sqlite_omit_load_extension,fts5 -ldflags "-w -s -linkmode external -extldflags '-static -Wl,--gc-sections' -X github.com/dimkr/tootik/buildinfo.Version=${{ inputs.version }}" -trimpath -o tootik-amd64 ./cmd/tootik
- run: |
apt-get install -y gcc-aarch64-linux-gnu
CGO_CFLAGS="-O2 -fomit-frame-pointer -ffunction-sections -fdata-sections -fmerge-all-constants" GOARCH=arm64 CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 go build -tags netgo,sqlite_omit_load_extension,fts5 -ldflags "-w -s -linkmode external -extldflags '-static -Wl,--gc-sections' -X github.com/dimkr/tootik/buildinfo.Version=${{ inputs.version }}" -trimpath -o tootik-arm64 ./cmd/tootik
- run: |
apt-get install -y gcc-arm-linux-gnueabihf
CGO_CFLAGS="-O2 -fomit-frame-pointer -ffunction-sections -fdata-sections -fmerge-all-constants" GOARCH=arm CC=arm-linux-gnueabihf-gcc CGO_ENABLED=1 go build -tags netgo,sqlite_omit_load_extension,fts5 -ldflags "-w -s -linkmode external -extldflags '-static -Wl,--gc-sections' -X github.com/dimkr/tootik/buildinfo.Version=${{ inputs.version }}" -trimpath -o tootik-arm ./cmd/tootik
- run: |
apt-get install -y gcc-multilib
CGO_CFLAGS="-O2 -fomit-frame-pointer -ffunction-sections -fdata-sections -fmerge-all-constants" GOARCH=386 CGO_ENABLED=1 go build -tags netgo,sqlite_omit_load_extension,fts5 -ldflags "-w -s -linkmode external -extldflags '-static -Wl,--gc-sections' -X github.com/dimkr/tootik/buildinfo.Version=${{ inputs.version }}" -trimpath -o tootik-386 ./cmd/tootik
- uses: actions/upload-artifact@v4
with:
name: tootik-${{ inputs.version }}
path: tootik-*
retention-days: 1