-
Notifications
You must be signed in to change notification settings - Fork 0
154 lines (126 loc) · 4.86 KB
/
ci.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
147
148
149
150
151
152
153
154
name: ci
on:
push:
branches:
- master
- develop
- ci
pull_request:
branches:
- master
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
name: "Test | PHP ${{ matrix.php-version }}"
strategy:
matrix:
php-version:
- "8.1"
- "8.2"
- "8.3"
steps:
- uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: "none"
extensions: json, opcache
php-version: "${{ matrix.php-version }}"
tools: composer:v2
- run: phpize
- run: ./configure
- run: make
- run: make test
coverage:
runs-on: ubuntu-latest
name: "Coverage (${{ matrix.debug }}) | PHP ${{ matrix.php-version }}"
strategy:
matrix:
debug:
- "std"
- "debug"
php-version:
- "8.1"
- "8.2"
- "8.3"
steps:
- uses: actions/checkout@v4
- name: Install Pkgs
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: lcov
version: lcov
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: pcov
extensions: json, opcache
php-version: "${{ matrix.php-version }}"
tools: composer:v2
- run: phpize
- run: ./configure CFLAGS="-fprofile-arcs -ftest-coverage ${CFLAGS}" LDFLAGS="--coverage ${LDFLAGS}"
if: matrix.debug == 'debug'
- run: ./configure --enable-vyrtue-debug CFLAGS="-fprofile-arcs -ftest-coverage ${CFLAGS}" LDFLAGS="--coverage ${LDFLAGS}"
if: matrix.debug != 'debug'
- run: lcov --directory . --zerocounters
- run: lcov --directory . --capture --compat-libtool --initial --output-file coverage.info
- run: make
- run: make test
- run: |
lcov --no-checksum --directory . --capture --compat-libtool --output-file coverage.info
lcov --remove coverage.info "/usr*" \
--remove coverage.info "*/.phpenv/*" \
--compat-libtool \
--output-file coverage.info
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
file: coverage.info
format: lcov
parallel: true
finish:
needs: coverage
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
nix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set Up Build Cache
uses: actions/cache@v4
id: nix-cache
with:
path: /tmp/nix-store.nar
key: nix-store.nar-${{ runner.os }}-${{ hashFiles('flake.nix', 'flake.lock') }}
restore-keys: nix-store.nar-${{ runner.os }}-
- uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixos-23.11
- name: Import Nix Store Cache
if: "steps.nix-cache.outputs.cache-hit == 'true'"
run: |
nix-store --import < /tmp/nix-store.nar
- name: nix build -L
run: |
nix eval .#packages --impure --raw --apply '(import ./.github/attrs.nix { prefix = ".#packages"; })' \
| xargs nix build -L
- run: nix flake check -L
- name: Export Nix Store Cache
shell: bash
run: |
packages=
packages+=$(nix eval .#packages --impure --raw --apply '(import ./.github/attrs.nix { prefix = ".#packages"; })')
packages+=$'\n'
packages+=$(nix eval .#checks --impure --raw --apply '(import ./.github/attrs.nix { prefix = ".#checks"; })')
echo "$packages" \
| xargs -I{} bash -c 'nix eval --raw {} && echo' \
| grep -v pre-commit-run \
| xargs nix-store -qR \
| xargs nix-store --export > /tmp/nix-store.nar