forked from dpc/rostra
-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (108 loc) · 4.01 KB
/
ci.yml
File metadata and controls
131 lines (108 loc) · 4.01 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: "Release packages"
on:
push:
branches: [ "main", "master", "devel", "releases/v*" ]
tags:
- 'v*'
pull_request:
branches: [ "main", "master", "devel", "releases/v*" ]
merge_group:
branches: [ "main", "master", "devel", "releases/v*" ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
lint:
name: "Lint"
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dpc/nix-installer-action@dpc/jj-vqymqvyntouw
- uses: cachix/cachix-action@v15
with:
name: rostra
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
continue-on-error: true
- name: Check `nix flake show`
run: nix flake show .#
pkg:
name: "Build packages"
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dpc/nix-installer-action@dpc/jj-vqymqvyntouw
- uses: cachix/cachix-action@v15
with:
name: rostra
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
continue-on-error: true
- name: Set BUILD_ID to tag or commit hash
run: |
if [[ $GITHUB_REF_TYPE == "tag" ]]; then
echo "BUILD_ID=${GITHUB_REF_NAME}" >> $GITHUB_ENV
else
echo "BUILD_ID=${GITHUB_SHA}" >> $GITHUB_ENV
fi
- name: Build rostra
env:
# seems like cachix needs this explicitly set in the env
CACHIX_AUTH_TOKEN: '${{ secrets.CACHIX_AUTH_TOKEN }}'
run: |
mkdir -p bins
nix build -L .#rostra && sha256sum "./result/bin/rostra"
closure_size=$(nix path-info -rS --json .#rostra | jq '. | to_entries[] | select(.value.ultimate == true) | .value.narSize')
>&2 echo "rostra's Nix closure size: $closure_size"
if [ 200000000 -lt $closure_size ]; then
>&2 echo "rostra's Nix closure size seems too big: $closure_size"
exit 1
fi
nix bundle --bundler .# ".#rostra" -o "bins/rostra-$BUILD_ID" && sha256sum "bins/rostra-$BUILD_ID"
- name: Upload Binaries
uses: actions/upload-artifact@v4
with:
name: "rostra-linux-x86_64"
path: "bins/**"
- name: Release Binaries
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: "bins/**"
prerelease: ${{ contains(github.ref, 'rc') }}
body: ${{ contains(github.ref, 'rc') && env.PRERELEASE_MESSAGE || '' }}
- name: Build DEB package
run: |
nix bundle -L --bundler .#toDEB --accept-flake-config -o debs/rostra .#rostra
# workaround: https://github.com/actions/upload-artifact/issues/92
cp -a debs/rostra/*.deb debs/
- name: Build RPM package
run: |
nix bundle -L --bundler .#toRPM --accept-flake-config -o rpms/rostra .#rostra
# workaround: https://github.com/actions/upload-artifact/issues/92
cp -a rpms/rostra/*.rpm rpms/
- name: Upload DEB packages
uses: actions/upload-artifact@v4
with:
name: "rostra-deb-bundle"
path: "debs/**.deb"
- name: Release DEB packages
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: "debs/**.deb"
prerelease: ${{ contains(github.ref, 'rc') }}
body: ${{ contains(github.ref, 'rc') && env.PRERELEASE_MESSAGE || '' }}
- name: Upload RPM packages
uses: actions/upload-artifact@v4
with:
name: "rostra-rpm-bundle"
path: "rpms/**.rpm"
- name: Release RPM packages
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: "rpms/**.rpm"
prerelease: ${{ contains(github.ref, 'rc') }}
body: ${{ contains(github.ref, 'rc') && env.PRERELEASE_MESSAGE || '' }}