-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (130 loc) · 4.42 KB
/
build.yml
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# SPDX-FileCopyrightText: 2021 Eduardo Robles <[email protected]>
#
# SPDX-License-Identifier: AGPL-3.0-only
name: "Workflow Tasks"
on:
push:
branches:
- master
- '[0-9]+.[0-9]+.x'
tags:
- '**'
pull_request:
branches:
- master
- '[0-9]+.[0-9]+.x'
jobs:
nixFlakeInfo:
name: Register Nix Flake Information
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v17
with:
install_url: https://github.com/numtide/nix-unstable-installer/releases/download/nix-2.10.0pre20220629_b7eb4ac/install
nix_path: nixpkgs=channel:nixos-22.05
extra_nix_config: |
experimental-features = nix-command flakes
# not running this command in https://github.com/nektos/act
# why? because it doesn't work for some reason
#- name: Print nixpkgs version
# if: ${{ !env.ACT }}
# run: nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'
- name: Show flake
run: nix --extra-experimental-features "nix-command flakes" flake show
# in all these nix command we add again the --extra-experimental-features
# because apparently otherwise it doesn't work with
# https://github.com/nektos/act
- name: Show flake metadata
run: nix --extra-experimental-features "nix-command flakes" flake metadata
- name: Run flake check
run: nix --extra-experimental-features "nix-command flakes" flake check
nixFlakeBuild:
name: Build Nix Flake
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v17
with:
install_url: https://github.com/numtide/nix-unstable-installer/releases/download/nix-2.10.0pre20220629_b7eb4ac/install
nix_path: nixpkgs=channel:nixos-22.05
extra_nix_config: |
experimental-features = nix-command flakes
- name: Build the flake
run: nix --extra-experimental-features "nix-command flakes" build -L
- name: Archive artifacts
if: ${{ !env.ACT }}
uses: actions/upload-artifact@v2
with:
name: ballot-verifier-${{ matrix.os }}
path: /nix/store/*-ballot-verifier*
testing:
name: Run unit tests
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v17
with:
install_url: https://github.com/numtide/nix-unstable-installer/releases/download/nix-2.10.0pre20220629_b7eb4ac/install
nix_path: nixpkgs=channel:nixos-22.05
extra_nix_config: |
experimental-features = nix-command flakes
- name: Run unit tests
run: |
nix \
--extra-experimental-features "nix-command flakes" \
develop \
--command bash -c "cmake -G Ninja . && ninja -v && ctest -VV"
checkFormat:
name: Check code quality
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v17
with:
install_url: https://github.com/numtide/nix-unstable-installer/releases/download/nix-2.10.0pre20220629_b7eb4ac/install
nix_path: nixpkgs=channel:nixos-22.05
extra_nix_config: |
experimental-features = nix-command flakes
- name: Check all files have licensing information
run: |
nix \
--extra-experimental-features "nix-command flakes" \
develop \
--command bash -c "reuse lint"
- name: Run check-format
run: |
nix \
--extra-experimental-features "nix-command flakes" \
develop \
--command bash -c "cmake -G Ninja . && ninja check-format" || {
nix \
--extra-experimental-features "nix-command flakes" \
develop \
--command bash -c "cmake -G Ninja . && ninja fix-format"
git diff
echo "error in check-format"
(exit -1)
}
- name: Run cppcheck
run: |
nix \
--extra-experimental-features "nix-command flakes" \
develop \
--command bash -c "cppcheck \
--enable=all \
--suppressions-list=.cppcheck-suppressions.txt \
--error-exitcode=1 \
src include apps tests/*.cpp"