Skip to content

Commit 01cf134

Browse files
committed
adding ubuntu VM based ci
1 parent 1985ba2 commit 01cf134

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed

.github/workflows/ubuntu_ci.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
permissions:
9+
contents: write
10+
actions: write
11+
attestations: write
12+
packages: read
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
GITHUB_REPOSITORY: ${{ github.repository }}
20+
GITHUB_REF: ${{ github.ref }}
21+
GITHUB_EVENT_PATH: ${{ github.event_path }}
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
27+
- name: Install system dependencies
28+
run: |
29+
sudo apt-get update
30+
sudo apt-get install -y \
31+
lsb-release \
32+
wget \
33+
tar \
34+
gzip \
35+
git \
36+
btrfs-progs \
37+
libbtrfs-dev \
38+
lvm2 \
39+
libdevmapper-dev \
40+
squashfs-tools \
41+
fuse-overlayfs \
42+
squashfuse \
43+
inotify-tools \
44+
build-essential
45+
46+
- name: Set up Go
47+
uses: actions/setup-go@v4
48+
with:
49+
go-version: '1.24.0'
50+
check-latest: true
51+
52+
# - name: Dump GO env
53+
# run: |
54+
# echo "--- all GO* vars ---"
55+
# env | grep '^GO' || true
56+
# echo "--- go env ---"
57+
# go env
58+
59+
- name: Install go deps
60+
run: go get ./...
61+
62+
- name: Build Linux binaries (with Ubuntu version)
63+
env:
64+
CGO_ENABLED: "1"
65+
CC: gcc
66+
GOOS: linux
67+
GOFLAGS: "-buildvcs=false"
68+
GO_LDFLAGS: "-linkmode external"
69+
CGO_LDFLAGS: "-g -O2"
70+
run: |
71+
# version for tag
72+
VER="$(lsb_release -rs)"
73+
mkdir -p dist
74+
HOST_ARCH=$(go env GOHOSTARCH)
75+
OUT="parallax-${{ github.ref_name }}-ubuntu-${VER}-${HOST_ARCH}"
76+
echo "Building $OUT"
77+
GOARCH=$HOST_ARCH go build -v -x \
78+
-ldflags "-X 'github.com/sarus-suite/parallax/version.Version=${{ github.ref_name }}'" \
79+
-o dist/$OUT \
80+
.
81+
82+
- name: Inspect binary
83+
run: |
84+
VER="$(lsb_release -rs)"
85+
HOST_ARCH=$(go env GOHOSTARCH)
86+
OUT="parallax-${{ github.ref_name }}-ubuntu-${VER}-${HOST_ARCH}"
87+
file dist/$OUT
88+
readelf -l dist/$OUT | grep interpreter || true
89+
ldd dist/$OUT || echo "static :/"
90+
91+
- name: Create GitHub Release
92+
id: create_release
93+
uses: actions/create-release@v1
94+
env:
95+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
96+
with:
97+
tag_name: ${{ github.ref }}
98+
release_name: Release ${{ github.ref }}
99+
draft: false
100+
prerelease: false
101+
102+
- name: Upload Release Asset
103+
id: upload-release-asset
104+
uses: actions/upload-release-asset@v1
105+
env:
106+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107+
with:
108+
upload_url: ${{ steps.create_release.outputs.upload_url }}
109+
asset_path: dist/parallax-${{ github.ref_name }}-ubuntu-$(lsb_release -rs)-${HOST_ARCH}
110+
asset_name: parallax-${{ github.ref_name }}-ubuntu-$(lsb_release -rs)-${HOST_ARCH}
111+
asset_content_type: application/octet-stream
112+

0 commit comments

Comments
 (0)