Skip to content

Commit c601b64

Browse files
committed
chore: build some stuff in the ci
1 parent c97520d commit c601b64

File tree

4 files changed

+296
-19
lines changed

4 files changed

+296
-19
lines changed

.github/workflows/ci.yml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: "CI"
2+
3+
on:
4+
push:
5+
branches: [ "main", "master", "devel", "releases/v*" ]
6+
tags:
7+
- 'v*'
8+
pull_request:
9+
branches: [ "main", "master", "devel", "releases/v*" ]
10+
merge_group:
11+
branches: [ "main", "master", "devel", "releases/v*" ]
12+
13+
workflow_dispatch:
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
17+
cancel-in-progress: true
18+
19+
20+
jobs:
21+
lint:
22+
name: "Lint"
23+
runs-on: ubuntu-latest
24+
timeout-minutes: 30
25+
steps:
26+
- uses: actions/checkout@v4
27+
- uses: dpc/nix-installer-action@dpc/jj-vqymqvyntouw
28+
- uses: cachix/cachix-action@v15
29+
with:
30+
name: rostra
31+
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
32+
continue-on-error: true
33+
34+
- name: Check `nix flake show`
35+
run: nix flake show .#
36+
37+
38+
39+
pkg:
40+
name: "Build packages"
41+
runs-on: ubuntu-latest
42+
timeout-minutes: 30
43+
steps:
44+
- uses: actions/checkout@v4
45+
- uses: dpc/nix-installer-action@dpc/jj-vqymqvyntouw
46+
- uses: cachix/cachix-action@v15
47+
with:
48+
name: rostra
49+
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
50+
continue-on-error: true
51+
52+
53+
- name: Set BUILD_ID to tag or commit hash
54+
run: |
55+
if [[ $GITHUB_REF_TYPE == "tag" ]]; then
56+
echo "BUILD_ID=${GITHUB_REF_NAME}" >> $GITHUB_ENV
57+
else
58+
echo "BUILD_ID=${GITHUB_SHA}" >> $GITHUB_ENV
59+
fi
60+
61+
- name: Build rostra
62+
env:
63+
# seems like cachix needs this explicitly set in the env
64+
CACHIX_AUTH_TOKEN: '${{ secrets.CACHIX_AUTH_TOKEN }}'
65+
run: |
66+
mkdir -p bins
67+
nix build -L .#rostra && sha256sum "./result/bin/rostra"
68+
69+
closure_size=$(nix path-info -rS --json .#rostra| jq '. | to_entries[] | select(.value.ultimate == true) | .value.narSize')
70+
>&2 echo "rostra's Nix closure size: $closure_size"
71+
72+
if [ 100000000 -lt $closure_size ]; then
73+
>&2 echo "rostra's Nix closure size seems too big: $closure_size"
74+
exit 1
75+
fi
76+
77+
nix bundle --bundler .# ".#rostra" -o "bins/rostra" && sha256sum "bins/rostra-$BUILD_ID"
78+
79+
80+
- name: Upload Binaries
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: "${{ matrix.build.flake-output}}-linux-x86_64"
84+
path: "bins/**"
85+
86+
- name: Release Binaries
87+
uses: softprops/action-gh-release@v2
88+
if: startsWith(github.ref, 'refs/tags/')
89+
with:
90+
files: "bins/**"
91+
prerelease: ${{ contains(github.ref, 'rc') }}
92+
body: ${{ contains(github.ref, 'rc') && env.PRERELEASE_MESSAGE || '' }}
93+
94+
- name: Build DEB package
95+
run: |
96+
nix bundle -L --bundler .#toDEB --accept-flake-config -o debs/rostra .#rostra
97+
# workaround: https://github.com/actions/upload-artifact/issues/92
98+
cp -a debs/rostra/*.deb debs/
99+
100+
- name: Build RPM package
101+
run: |
102+
nix bundle -L --bundler .#toRPM --accept-flake-config -o rpms/rostra .#rostra
103+
# workaround: https://github.com/actions/upload-artifact/issues/92
104+
cp -a rpms/rostra/*.rpm rpms/
105+
106+
- name: Upload DEB packages
107+
uses: actions/upload-artifact@v4
108+
with:
109+
name: "${{ matrix.build.flake-output }}-deb-bundle"
110+
path: "debs/**.deb"
111+
112+
- name: Release DEB packages
113+
uses: softprops/action-gh-release@v2
114+
if: startsWith(github.ref, 'refs/tags/')
115+
with:
116+
files: "debs/**.deb"
117+
prerelease: ${{ contains(github.ref, 'rc') }}
118+
body: ${{ contains(github.ref, 'rc') && env.PRERELEASE_MESSAGE || '' }}
119+
120+
- name: Upload RPM packages
121+
uses: actions/upload-artifact@v4
122+
with:
123+
name: "${{ matrix.build.flake-output }}-rpm-bundle"
124+
path: "rpms/**.rpm"
125+
126+
- name: Release RPM packages
127+
uses: softprops/action-gh-release@v2
128+
if: startsWith(github.ref, 'refs/tags/')
129+
with:
130+
files: "rpms/**.rpm"
131+
prerelease: ${{ contains(github.ref, 'rc') }}
132+
body: ${{ contains(github.ref, 'rc') && env.PRERELEASE_MESSAGE || '' }}

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,18 @@ it's advised to run Rostra directly on your system.
4040

4141
#### Using Cargo
4242

43-
**NOTE**: [This flow currently doesn't work end to end](https://github.com/dpc/rostra/discussions/7).
44-
45-
As a Rust project Rostra can be installed using Cargo:
43+
You can clone the git repository locally and run:
4644

4745
```
48-
cargo install --git https://github.com/dpc/rostra
46+
cargo run --release web-ui
4947
```
5048

49+
to start the web ui.
50+
51+
**NOTE**: [`cargo install` can't bundle web UI assets embedded in the git
52+
repository, which are necessary for the web UI to work.](https://github.com/dpc/rostra/discussions/7).
53+
54+
5155
#### Using Nix
5256

5357
You can run Rostra using Nix with:

flake.lock

Lines changed: 138 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)