Skip to content

Commit 047ebfc

Browse files
authored
Add CI flow (#8)
1 parent 2ceb831 commit 047ebfc

File tree

4 files changed

+221
-1
lines changed

4 files changed

+221
-1
lines changed

.github/workflows/build.yml

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
name: Build and Release
2+
on:
3+
push:
4+
branches: main
5+
6+
# Automatically cancel any previous workflow on new push.
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
build:
13+
strategy:
14+
matrix:
15+
# Include amd64 on all platforms.
16+
goos: [windows, freebsd, openbsd, linux, dragonfly, darwin]
17+
goarch: [amd64, 386]
18+
exclude:
19+
# Exclude i386 on darwin and dragonfly
20+
# because they are not supported by go.
21+
- goarch: 386
22+
goos: dragonfly
23+
- goarch: 386
24+
goos: darwin
25+
include:
26+
# BEIGIN MacOS ARM64
27+
- goos: darwin
28+
goarch: arm64
29+
# END MacOS ARM64
30+
# BEGIN Linux ARM 5 6 7
31+
- goos: linux
32+
goarch: arm
33+
goarm: 7
34+
- goos: linux
35+
goarch: arm
36+
goarm: 6
37+
- goos: linux
38+
goarch: arm
39+
goarm: 5
40+
# END Linux ARM 5 6 7
41+
# BEGIN Android ARM 8
42+
- goos: android
43+
goarch: arm64
44+
# END Android ARM 8
45+
# Windows ARM 7
46+
- goos: windows
47+
goarch: arm
48+
goarm: 7
49+
# BEGIN Other architectures
50+
# BEGIN riscv64 & ARM64
51+
- goos: linux
52+
goarch: arm64
53+
- goos: linux
54+
goarch: riscv64
55+
# END riscv64 & ARM64
56+
# BEGIN MIPS
57+
- goos: linux
58+
goarch: mips64
59+
- goos: linux
60+
goarch: mips64le
61+
- goos: linux
62+
goarch: mipsle
63+
- goos: linux
64+
goarch: mips
65+
# END MIPS
66+
# BEGIN PPC
67+
- goos: linux
68+
goarch: ppc64
69+
- goos: linux
70+
goarch: ppc64le
71+
# END PPC
72+
# BEGIN FreeBSD ARM
73+
- goos: freebsd
74+
goarch: arm64
75+
- goos: freebsd
76+
goarch: arm
77+
goarm: 7
78+
# END FreeBSD ARM
79+
# BEGIN S390X
80+
- goos: linux
81+
goarch: s390x
82+
# END S390X
83+
# BEGIN LoongArch64
84+
- goos: linux
85+
goarch: loong64
86+
# END LoongArch64
87+
# END Other architectures
88+
# BEGIN OPENBSD ARM
89+
- goos: openbsd
90+
goarch: arm64
91+
- goos: openbsd
92+
goarch: arm
93+
goarm: 7
94+
# END OPENBSD ARM
95+
fail-fast: false
96+
97+
runs-on: ubuntu-latest
98+
env:
99+
GOOS: ${{ matrix.goos }}
100+
GOARCH: ${{ matrix.goarch }}
101+
GOARM: ${{ matrix.goarm }}
102+
CGO_ENABLED: 0
103+
steps:
104+
- name: Checkout codebase
105+
uses: actions/checkout@v4
106+
107+
- name: Show workflow information
108+
id: get_filename
109+
run: |
110+
export _NAME=$(jq ".[\"$GOOS-$GOARCH$GOARM$GOMIPS\"].friendlyName" -r < .github/build/friendly-filenames.json)
111+
echo "GOOS: $GOOS, GOARCH: $GOARCH, GOARM: $GOARM, GOMIPS: $GOMIPS, RELEASE_NAME: $_NAME"
112+
113+
- name: Set up Go
114+
uses: actions/setup-go@v5
115+
with:
116+
go-version: ^1.23
117+
cache: false
118+
119+
- name: Get project dependencies
120+
run: |
121+
# we do not cross-compile this.
122+
GOOS=linux GOARCH=amd64 GOARM="" GOBIN="$PWD/bin/" go install github.com/jessevdk/go-assets-builder@latest
123+
$PWD/bin/go-assets-builder assets -o assets.go
124+
# download the modules.
125+
go mod download
126+
127+
- name: Build notebook
128+
run: go build -o rz-notebook-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goarm }} -ldflags "-X main.NBVERSION=$(git rev-list -1 HEAD)"
129+
130+
- name: Build Mips softfloat
131+
if: matrix.goarch == 'mips' || matrix.goarch == 'mipsle'
132+
run: GOMIPS=softfloat go build -o rz-notebook-${{ matrix.goos }}-${{ matrix.goarch }} -ldflags "-X main.NBVERSION=$(git rev-list -1 HEAD)"
133+
134+
- name: Rename Windows
135+
if: matrix.goos == 'windows'
136+
run: mv rz-notebook-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goarm }} rz-notebook-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goarm }}.exe
137+
138+
- name: Upload files to Artifacts
139+
uses: actions/upload-artifact@v4
140+
with:
141+
name: rz-notebook-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goarm }}
142+
path: ./rz-notebook-${{ matrix.goos }}-*
143+
144+
create_release:
145+
name: Create Release
146+
runs-on: ubuntu-latest
147+
needs: [build]
148+
steps:
149+
- uses: actions/checkout@v4
150+
- uses: actions/download-artifact@v4
151+
- name: List downloaded files
152+
run: ls -lah * */*
153+
154+
- name: Create Release
155+
id: create_release
156+
if: startsWith(github.ref, 'refs/tags/') || contains(github.ref, 'test-release')
157+
uses: softprops/action-gh-release@v2
158+
with:
159+
token: ${{ secrets.GITHUB_TOKEN }}
160+
name: Release ${{ github.ref }}
161+
draft: true
162+
prerelease: false
163+
files: |
164+
./rz-notebook-*/*
165+
166+
- name: Create Nightly
167+
id: create_release
168+
uses: softprops/action-gh-release@v2
169+
with:
170+
token: ${{ secrets.GITHUB_TOKEN }}
171+
name: Nightly
172+
draft: false
173+
prerelease: true
174+
files: |
175+
./rz-notebook-*/*

.github/workflows/ci.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Build Notebook
2+
on:
3+
pull_request:
4+
branches: main
5+
6+
# Automatically cancel any previous workflow on new push.
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
build:
13+
strategy:
14+
fail-fast: false
15+
16+
runs-on: ubuntu-latest
17+
env:
18+
CGO_ENABLED: 0
19+
steps:
20+
- name: Checkout codebase
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Go
24+
uses: actions/setup-go@v5
25+
with:
26+
go-version: ^1.23
27+
cache: false
28+
29+
- name: Get project dependencies
30+
run: |
31+
# we do not cross-compile this.
32+
GOOS=linux GOARCH=amd64 GOARM="" GOBIN="$PWD/bin/" go install github.com/jessevdk/go-assets-builder@latest
33+
$PWD/bin/go-assets-builder assets -o assets.go
34+
# download the modules.
35+
go mod download
36+
37+
- name: Build notebook
38+
run: go build -o rz-notebook -ldflags "-X main.NBVERSION=$(git rev-list -1 HEAD)"
39+
40+
- name: Upload files to Artifacts
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: rz-notebook
44+
path: ./rz-notebook

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
rz-notebook
12
rizin-notebook
23
.test-data

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Requires at least rizin version `0.2.0`
1515
## Building
1616

1717
```bash
18-
go get -v github.com/gin-gonic/gin
18+
# required for go-assets-builder
1919
go get -v github.com/jessevdk/go-assets-builder
2020

2121
go-assets-builder assets -o assets.go

0 commit comments

Comments
 (0)