Skip to content

Commit eaaa284

Browse files
committed
chore(release): support deb & rpm, close #1206
1 parent 391a250 commit eaaa284

File tree

4 files changed

+157
-1
lines changed

4 files changed

+157
-1
lines changed

.github/workflows/auto-release.yml

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,56 @@ permissions:
1010

1111
jobs:
1212
auto-release:
13-
runs-on: ubuntu-latest
13+
runs-on: ubuntu-24.04
1414
steps:
1515
- uses: actions/checkout@v4
1616

17+
- name: Setup Ubuntu dependencies
18+
uses: ./.github/actions/setup-ubuntu-deps
19+
20+
- name: Build cabin
21+
run: make BUILD=release -j4
22+
env:
23+
CXX: g++-14
24+
25+
- name: Create DEB package
26+
uses: blinktag/nfpm@v2.27.1
27+
with:
28+
packager: deb
29+
env:
30+
CABIN_VERSION: ${{ github.ref_name }}
31+
32+
- name: Create RPM package
33+
uses: blinktag/nfpm@v2.27.1
34+
with:
35+
packager: rpm
36+
env:
37+
CABIN_VERSION: ${{ github.ref_name }}
38+
1739
- name: Release
1840
uses: softprops/action-gh-release@v2
1941
with:
2042
draft: false
2143
generate_release_notes: true
44+
files: |
45+
*.deb
46+
*.rpm
2247
body: |
2348
:sparkling_heart: I maintain **Cabin** in my spare time. Buy me a coffee on [GitHub Sponsors](https://github.com/sponsors/ken-matsui) so I can keep shipping features!
2449
50+
## Installation
51+
52+
### Ubuntu/Debian
53+
```bash
54+
wget https://github.com/cabinpkg/cabin/releases/download/${{ github.ref_name }}/cabin_${{ github.ref_name }}_amd64.deb
55+
sudo dpkg -i cabin_${{ github.ref_name }}_amd64.deb
56+
```
57+
58+
### RHEL/CentOS/Fedora
59+
```bash
60+
wget https://github.com/cabinpkg/cabin/releases/download/${{ github.ref_name }}/cabin-${{ github.ref_name }}-1.x86_64.rpm
61+
sudo rpm -i cabin-${{ github.ref_name }}-1.x86_64.rpm
62+
```
63+
2564
env:
2665
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/cpp.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,53 @@ jobs:
135135
--output-file coverage.info
136136
lcov --list coverage.info
137137
138+
package-test:
139+
needs: build-and-test
140+
runs-on: ubuntu-24.04
141+
env:
142+
CXX: g++-14
143+
steps:
144+
- uses: actions/checkout@v4
145+
146+
- name: Setup Ubuntu dependencies
147+
uses: ./.github/actions/setup-ubuntu-deps
148+
149+
- name: Build cabin
150+
run: make BUILD=release -j4
151+
152+
- name: Test DEB package creation
153+
uses: blinktag/nfpm@v2.27.1
154+
with:
155+
packager: deb
156+
env:
157+
CABIN_VERSION: ${{ github.sha }}
158+
159+
- name: Test RPM package creation
160+
uses: blinktag/nfpm@v2.27.1
161+
with:
162+
packager: rpm
163+
env:
164+
CABIN_VERSION: ${{ github.sha }}
165+
166+
- name: List created packages
167+
run: ls -la ./*.deb ./*.rpm
168+
169+
- name: Verify package contents
170+
run: |
171+
dpkg-deb --contents ./*.deb | grep '/usr/bin/cabin'
172+
rpm -qlp ./*.rpm | grep '/usr/bin/cabin'
173+
174+
- name: Test DEB package installation
175+
run: sudo dpkg -i ./*.deb
176+
177+
- name: Create test project
178+
run: cabin new test_pj
179+
working-directory: ${{ runner.temp }}
180+
181+
- name: Test cabin functionality
182+
run: cabin run | tee /dev/stderr | grep 'Hello, world!'
183+
working-directory: ${{ runner.temp }}/test_pj
184+
138185
format:
139186
needs: build-and-test
140187
runs-on: ubuntu-24.04

CONTRIBUTING.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,32 @@ Make sure to add new tests for any new functionality you introduce. See
9393
<https://github.com/felipec/sharness/blob/v1.2.1/API.md> for more information on
9494
how to use `sharness`.
9595

96+
### Packaging
97+
98+
To test the Linux package creation locally, you can use nFPM:
99+
100+
```bash
101+
# Install nFPM (if not already installed)
102+
brew install nfpm # macOS
103+
# or follow instructions at https://nfpm.goreleaser.com/install/
104+
105+
# Build cabin first
106+
make BUILD=release -j$(nproc)
107+
108+
# Create DEB package
109+
CABIN_VERSION="1.0.0" nfpm pkg --packager deb
110+
111+
# Create RPM package
112+
CABIN_VERSION="1.0.0" nfpm pkg --packager rpm
113+
114+
# Verify packages were created
115+
ls -la *.deb *.rpm
116+
```
117+
118+
The packaging configuration is defined in `nfpm.yaml`. Both DEB and RPM
119+
packages are automatically created and published on GitHub releases when tags
120+
are pushed.
121+
96122
## Documentation
97123

98124
If your changes affect the project's documentation, ensure you update the

nfpm.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: cabin
2+
arch: amd64
3+
platform: linux
4+
version: "${CABIN_VERSION}"
5+
section: utils
6+
priority: extra
7+
maintainer: "Ken Matsui <26405363+ken-matsui@users.noreply.github.com>"
8+
description: |
9+
C++ package manager and build system.
10+
11+
Cabin is a modern C++ package manager and build system that makes it easy
12+
to build and manage C++ projects with external dependencies.
13+
vendor: "Cabin"
14+
homepage: "https://cabinpkg.com"
15+
license: "Apache-2.0"
16+
17+
depends:
18+
- "libstdc++6"
19+
20+
contents:
21+
- src: ./build/cabin
22+
dst: /usr/bin/cabin
23+
file_info:
24+
mode: 0755
25+
26+
overrides:
27+
deb:
28+
depends:
29+
- "libstdc++6"
30+
- "libfmt9 | libfmt-dev"
31+
- "libspdlog1.10 | libspdlog-dev"
32+
- "libcurl4"
33+
- "libgit2-1.7 | libgit2-dev"
34+
- "nlohmann-json3-dev | libnlohmann-json-dev"
35+
- "libtbb12 | libtbb-dev"
36+
rpm:
37+
depends:
38+
- "libstdc++"
39+
- "fmt-devel"
40+
- "spdlog-devel"
41+
- "libcurl-devel"
42+
- "libgit2-devel"
43+
- "json-devel"
44+
- "tbb-devel"

0 commit comments

Comments
 (0)